From 107075e15854c76bd416973f1a8e2c19bafb265d Mon Sep 17 00:00:00 2001 From: theofficialgman <28281419+theofficialgman@users.noreply.github.com> Date: Tue, 19 Sep 2023 20:16:20 -0400 Subject: [PATCH] Snap Store: unmark as hidden and reland updates with corrections follows official instructions https://snapcraft.io/docs/installing-snap-on-debian and removes some entirely unnecessary commands --- apps/Snap Store/install | 20 ++++++++++++++------ apps/Snap Store/uninstall | 2 +- etc/categories | 2 +- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/apps/Snap Store/install b/apps/Snap Store/install index a8064d277e..b2fb13ceba 100755 --- a/apps/Snap Store/install +++ b/apps/Snap Store/install @@ -15,17 +15,25 @@ fi sudo snap refresh sudo systemctl restart snapd.service || error "Unable to restart snapd.service" -sudo modprobe squashfs || exit 1 +enable_module squashfs || exit 1 -sudo snap install core18 || error "Snapd was unable to install core18" +# install the core snap which obtains the latest snapd sudo snap install core || error "Snapd was unable to install core" -sudo snap install snapd || error "Snapd was unable to install snapd" - -sudo ln -s /var/lib/snapd/snap /snap echo "Output of 'snap version':" snap version sudo snap install snap-store || error "Unable to install snap store" + +# correct orphaned directory from older script sudo rm -rf /usr/share/applications/snap -ln -s /var/lib/snapd/desktop/applications /usr/share/applications/snap || sudo ln -s /var/lib/snapd/desktop/applications /usr/share/applications/snap || error "Failed to create symlink for Snap app shortcuts!" +#Pi-Apps tries to avoid unnecessary reboots at all cost. Snap places desktop launchers in /var/lib/snapd/desktop/applications, which is not searched by default. +#This path is added to $XDG_DATA_DIRS on the next reboot, but we don't want to wait for that! +#If there are files in /var/lib/snapd/desktop/applications, and XDG_DATA_DIRS is missing snap paths, then bind-mount to /usr/share/applications +if [[ "$XDG_DATA_DIRS" != */var/lib/snapd/desktop* ]] && [ ! -z "$(ls /var/lib/snapd/desktop/applications)" ] && [ -z "$(ls /usr/share/applications/snapd-temporary)" ];then + sudo mkdir -p /usr/share/applications/snapd-temporary + sudo mount --bind /var/lib/snapd/desktop/applications /usr/share/applications/snapd-temporary +elif [[ "$XDG_DATA_DIRS" == */var/lib/snapd/desktop* ]] ;then + sudo rm -rf /usr/share/applications/snapd-temporary +fi +#Additionally, PiOS Buster had a bug where XDG_DATA_DIRS was missing snap's entries due to PiOS mods. Pi-Apps fixes this with a runonce. diff --git a/apps/Snap Store/uninstall b/apps/Snap Store/uninstall index d12f34c595..3bb9daaa0e 100755 --- a/apps/Snap Store/uninstall +++ b/apps/Snap Store/uninstall @@ -1,5 +1,5 @@ #!/bin/bash -sudo rm -rf /var/snap/snap-store +sudo rm -rf /var/snap/snap-store /usr/share/applications/snapd-temporary if command -v snap >/dev/null ;then sudo snap remove snap-store || error "The snap command failed to uninstall snap-store\nPerhaps running this command would fix it?\nsudo apt install --reinstall snapd" diff --git a/etc/categories b/etc/categories index 351bfb5e33..822ad6f20a 100644 --- a/etc/categories +++ b/etc/categories @@ -165,7 +165,7 @@ Shattered Pixel Dungeon|Games Shotwell|Creative Arts SimpleScreenRecorder|Multimedia Snapdrop|hidden -Snap Store|hidden +Snap Store|Tools Sonic Pi|Multimedia SpeedTest-CLI|Internet Sphero SDK|Programming