From 4ed734757ea4449ebb9c4caa7f379924eebcaa1f Mon Sep 17 00:00:00 2001 From: Lothar Serra Mari Date: Sun, 11 Apr 2021 21:47:01 +0200 Subject: [PATCH] DISTS: Sync snapcraft build recipe --- dists/snap/scripts/bin/daemon-start.sh | 39 ++++++++++++++------------ dists/snap/snap/hooks/configure | 15 +++++++++- dists/snap/snap/hooks/install | 12 ++------ dists/snap/snap/hooks/post-refresh | 12 ++------ dists/snap/snap/snapcraft.yaml | 17 ++++++++--- 5 files changed, 54 insertions(+), 41 deletions(-) diff --git a/dists/snap/scripts/bin/daemon-start.sh b/dists/snap/scripts/bin/daemon-start.sh index 12f9d785879..36608f9a43b 100755 --- a/dists/snap/scripts/bin/daemon-start.sh +++ b/dists/snap/scripts/bin/daemon-start.sh @@ -1,22 +1,25 @@ #!/bin/sh -if [ "$(id -u)" = "0" ] && [ "$(snapctl get daemon)" = "false" ] -then - # If not configured to run as a daemon we have to stop here - # (There's no "snapctl disable ...") - snapctl stop $SNAP_NAME.daemon - exit 0 +real_xdg_runtime_dir=$(dirname "${XDG_RUNTIME_DIR}") +real_wayland=${real_xdg_runtime_dir}/${WAYLAND_DISPLAY:-wayland-0} + +if [ ! -O "${real_wayland}" ]; then + # On core systems mir-kiosk may also need to create the host XDG_RUNTIME_DIR + if [ ! -O "${real_xdg_runtime_dir}" ]; then + echo waiting for host XDG_RUNTIME_DIR... + until [ -O "${real_xdg_runtime_dir}" ] + do + inotifywait --event create $(dirname "${real_xdg_runtime_dir}") || sleep 4 + done + fi + + echo waiting for Wayland socket... + until [ -O "${real_wayland}" ] + do + inotifywait --event create $(dirname "${real_wayland}") || sleep 4 + done + + echo ...waiting done fi -mkdir -p "$XDG_RUNTIME_DIR" -m 700 - -if [ -z "${WAYLAND_DISPLAY}" ] -then WAYLAND_DISPLAY=wayland-0 -fi - -real_wayland=$(dirname "$XDG_RUNTIME_DIR")/${WAYLAND_DISPLAY} -while [ ! -O "${real_wayland}" ]; do echo waiting for Wayland socket; sleep 4; done - -ln -sf "${real_wayland}" "$XDG_RUNTIME_DIR" - -exec "$@" \ No newline at end of file +exec "$@" diff --git a/dists/snap/snap/hooks/configure b/dists/snap/snap/hooks/configure index ad46d7b9e27..4936b754cb1 100755 --- a/dists/snap/snap/hooks/configure +++ b/dists/snap/snap/hooks/configure @@ -1,2 +1,15 @@ #!/bin/sh -snapctl restart $SNAP_NAME + +if [ "$(snapctl get daemon)" = "" ]; then + # By default, we run as a daemon on core, otherwise configure the daemon to stop + if grep -q -e snap_core= -e snapd_recovery_mode= /proc/cmdline + then snapctl set daemon=true + else snapctl set daemon=false + fi +fi + +if [ "$(snapctl get daemon)" = "true" ]; then + snapctl start --enable $SNAP_NAME.daemon 2>&1 || true +else + snapctl stop --disable $SNAP_NAME.daemon 2>&1 || true +fi diff --git a/dists/snap/snap/hooks/install b/dists/snap/snap/hooks/install index 6b2ad9108a5..472a44ef5b1 100755 --- a/dists/snap/snap/hooks/install +++ b/dists/snap/snap/hooks/install @@ -1,12 +1,6 @@ #!/bin/sh set -x -if [ "$(snapctl get daemon)" = "" ] -then - # We run as a daemon on core, otherwise configure the daemon to stop - # (There's no "snapctl disable ...") - if grep -q snap_core= /proc/cmdline - then snapctl set daemon=true - else snapctl set daemon=false - fi -fi +# we install with the daemon disabled, the configure hook +# will start it if appropriate +snapctl stop --disable $SNAP_NAME.daemon diff --git a/dists/snap/snap/hooks/post-refresh b/dists/snap/snap/hooks/post-refresh index 6b2ad9108a5..472a44ef5b1 100755 --- a/dists/snap/snap/hooks/post-refresh +++ b/dists/snap/snap/hooks/post-refresh @@ -1,12 +1,6 @@ #!/bin/sh set -x -if [ "$(snapctl get daemon)" = "" ] -then - # We run as a daemon on core, otherwise configure the daemon to stop - # (There's no "snapctl disable ...") - if grep -q snap_core= /proc/cmdline - then snapctl set daemon=true - else snapctl set daemon=false - fi -fi +# we install with the daemon disabled, the configure hook +# will start it if appropriate +snapctl stop --disable $SNAP_NAME.daemon diff --git a/dists/snap/snap/snapcraft.yaml b/dists/snap/snap/snapcraft.yaml index daf3f5dddcf..25490b34064 100644 --- a/dists/snap/snap/snapcraft.yaml +++ b/dists/snap/snap/snapcraft.yaml @@ -20,6 +20,7 @@ description: | you will find some really obscure adventures and truly hidden gems to explore. confinement: strict grade: stable +compression: lzo apps: scummvm: @@ -42,6 +43,7 @@ apps: - mount-observe - system-observe - network-observe + - hardware-observe - joystick environment: LD_LIBRARY_PATH: "$LD_LIBRARY_PATH:$SNAP/usr/lib/${SNAPCRAFT_ARCH_TRIPLET}/libunity/:$SNAP/usr/lib/${SNAPCRAFT_ARCH_TRIPLET}/pulseaudio/:$SNAP/usr/lib/${SNAPCRAFT_ARCH_TRIPLET}/speech-dispatcher/" @@ -49,7 +51,7 @@ apps: DBUS_FATAL_WARNINGS: 0 daemon: - command: bin/daemon-start.sh $SNAP/bin/scummvm-launch.sh -f + command: bin/daemon-start.sh $SNAP/snap/command-chain/desktop-launch $SNAP/bin/wayland-if-possible.sh $SNAP/bin/scummvm-launch.sh -f daemon: simple restart-condition: always plugs: @@ -62,9 +64,13 @@ apps: - network-bind - removable-media - joystick + - mount-observe + - system-observe + - network-observe + - hardware-observe environment: SDL_VIDEODRIVER: wayland - LD_LIBRARY_PATH: "$LD_LIBRARY_PATH:$SNAP/usr/lib/${SNAPCRAFT_ARCH_TRIPLET}/:$SNAP/usr/lib/${SNAPCRAFT_ARCH_TRIPLET}/libunity/:$SNAP/usr/lib/${SNAPCRAFT_ARCH_TRIPLET}/pulseaudio/:$SNAP/usr/lib/${SNAPCRAFT_ARCH_TRIPLET}/speech-dispatcher/" + LD_LIBRARY_PATH: "$SNAP/usr/lib/${SNAPCRAFT_ARCH_TRIPLET}/:$SNAP/usr/lib/${SNAPCRAFT_ARCH_TRIPLET}/libunity/:$SNAP/usr/lib/${SNAPCRAFT_ARCH_TRIPLET}/pulseaudio/:$SNAP/usr/lib/${SNAPCRAFT_ARCH_TRIPLET}/speech-dispatcher/" ESPEAK_DATA_PATH: "$SNAP/usr/lib/${SNAPCRAFT_ARCH_TRIPLET}/espeak-ng-data" PULSE_SYSTEM: 1 PULSE_RUNTIME_PATH: /var/run/pulse @@ -125,6 +131,7 @@ parts: - libfluidsynth-dev - libfreetype6-dev - libfribidi-dev + - libgif-dev - libglew-dev - libgtk-3-dev - libieee1284-3-dev @@ -153,6 +160,7 @@ parts: - libflac8 - libfluidsynth1 - libfribidi0 + - libgif7 - libgl1-mesa-dri - libgl1-mesa-glx - libglew2.0 @@ -240,14 +248,15 @@ parts: stage-packages: - libasound2 - libasound2-plugins - + - inotify-tools + scripts: plugin: dump source: scripts games: plugin: dump - source: https://www.scummvm.org/frs/extras/storefront/games-bundle.zip + source: https://downloads.scummvm.org/frs/extras/storefront/games-bundle.zip source-checksum: sha256/5c16f3db7fda3660d1bddb52e76aa27ada8eb8268872f5e045490f3eabb603e1 organize: games-bundle: usr/share/scummvm/