diff options
Diffstat (limited to 'Ports/.port_include.sh')
-rwxr-xr-x | Ports/.port_include.sh | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/Ports/.port_include.sh b/Ports/.port_include.sh index aac65135b7..29651d2f3f 100755 --- a/Ports/.port_include.sh +++ b/Ports/.port_include.sh @@ -68,6 +68,9 @@ shift : "${auth_type:=md5}" : "${auth_import_key:=}" : "${auth_opts:=}" +: "${launcher_name:=}" +: "${launcher_category:=}" +: "${launcher_command:=}" run_nocd() { echo "+ $@ (nocd)" @@ -77,9 +80,34 @@ run() { echo "+ $@" (cd "$workdir" && "$@") } -run_replace_in_file(){ +run_replace_in_file() { run perl -p -i -e "$1" $2 } +install_launcher() { + if [ -z "$launcher_name" ] || [ -z "${launcher_category}" ] || [ -z "${launcher_command}" ]; then + return + fi + script_name="${launcher_name,,}" + script_name="${script_name// /}" + mkdir -p $DESTDIR/usr/local/libexec + cat >$DESTDIR/usr/local/libexec/$script_name <<SCRIPT +#!/bin/sh +set -e +cd -- "\$(dirname -- "\$(which -- $(printf %q "${launcher_command%% *}"))")" +exec $(printf '%q ' $launcher_command) +SCRIPT + chmod +x $DESTDIR/usr/local/libexec/$script_name + + chmod +x $DESTDIR/usr/local/libexec + mkdir -p $DESTDIR/res/apps + cat >$DESTDIR/res/apps/$script_name.af <<CONFIG +[App] +Name=$launcher_name +Executable=/usr/local/libexec/$script_name +Category=$launcher_category +CONFIG + unset script_name +} # Checks if a function is defined. In this case, if the function is not defined in the port's script, then we will use our defaults. This way, ports don't need to include these functions every time, but they can override our defaults if needed. func_defined() { PATH= command -V "$1" > /dev/null 2>&1 @@ -219,6 +247,7 @@ func_defined build || build() { } func_defined install || install() { run make DESTDIR=$DESTDIR $installopts install + install_launcher } func_defined post_install || post_install() { echo |