Skip to content

Commit

Permalink
fix(linux): improve AppImage AppRun
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher committed Mar 25, 2024
1 parent 89e8b96 commit 74e95b8
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions packaging/linux/AppImage/AppRun
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
# path of the extracted AppRun
HERE="$(dirname "$(readlink -f "${0}")")"
SUNSHINE_PATH=/usr/bin/sunshine
SUNSHINE_BIN_HERE=$HERE/usr/bin/sunshine
SUNSHINE_APPIMAGE_BIN=$HERE/usr/bin/sunshine
SUNSHINE_SHARE_HERE=$HERE/usr/share/sunshine
SUNSHINE_DEST_DIR=/opt/sunshine-appimage
SUNSHINE_BIN=$SUNSHINE_DEST_DIR/usr/bin/sunshine

# Set APPDIR when running directly from the AppDir:
if [ -z "$APPDIR" ]; then
Expand All @@ -22,7 +24,7 @@ echo "
------------------------------
sunshine.AppImage options
------------------------
-------------------------
Usage: $ARGV0 --help, -h
------ # This message
Expand All @@ -40,7 +42,7 @@ echo "
----------------
"
# print sunshine binary help, replacing the sunshine command in usage statement
"$SUNSHINE_BIN_HERE" --help | sed -e "s#$SUNSHINE_BIN_HERE#$ARGV0#g"
"$SUNSHINE_APPIMAGE_BIN" --help | sed -e "s#$SUNSHINE_APPIMAGE_BIN#$ARGV0#g"
}

function install() {
Expand All @@ -56,8 +58,14 @@ function install() {
# patch service executable path
sed -i -e "s#$SUNSHINE_PATH#$(readlink -f $ARGV0)#g" ~/.config/systemd/user/sunshine.service

# extract the AppImage
"$ARGV0" --appimage-extract

# move the AppImage
sudo mv ./squashfs-root "$SUNSHINE_DEST_DIR"

# setcap
sudo setcap cap_sys_admin+p "$(readlink -f "$SUNSHINE_BIN_HERE")"
sudo setcap cap_sys_admin+p "$(readlink -f "$SUNSHINE_BIN")"
}

function remove() {
Expand All @@ -66,6 +74,9 @@ function remove() {

# remove service
sudo rm -f ~/.config/systemd/user/sunshine.service

# remove the extracted AppImage directory
sudo rm -rf "$SUNSHINE_DEST_DIR"
}

# process arguments
Expand All @@ -89,4 +100,4 @@ fi
mkdir -p ~/.config/sunshine

# run sunshine
"$SUNSHINE_BIN_HERE" $@
"$SUNSHINE_BIN" $@

0 comments on commit 74e95b8

Please sign in to comment.