diff options
author | Gunnar Beutner <gunnar@beutner.name> | 2021-04-20 18:36:03 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-04-23 11:33:57 +0200 |
commit | e72235b9812557c8e313b2d49a8bdd21abfda843 (patch) | |
tree | c8772fcf8d172b0e743e635b445f616408fcd2c9 /Ports/.port_include.sh | |
parent | 1e5a7ca0a7f4ab8cf4de06533902a699b57a9509 (diff) | |
download | serenity-e72235b9812557c8e313b2d49a8bdd21abfda843.zip |
Ports: Add launchers for some of the ports
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 |