1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-30 13:17:45 +00:00

Ports: Add launchers for some of the ports

This commit is contained in:
Gunnar Beutner 2021-04-20 18:36:03 +02:00 committed by Linus Groh
parent 1e5a7ca0a7
commit e72235b981
9 changed files with 57 additions and 5 deletions

View file

@ -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