mirror of
https://github.com/gosticks/PaperWM.git
synced 2026-02-12 20:02:44 +00:00
Currently uninstall.sh fails if run on an installation copied or cloned directly into the extensions directory. This change updates it to check whether the install is link-based or direct and handle each case appropriately. Due to the potential danger of a recursive removal, it prompts the user for confirmation before removing direct installs.
31 lines
810 B
Bash
Executable File
31 lines
810 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# NOTE: gnome-extensions uninstall will delete all files in the linked directory
|
|
|
|
REPO="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
|
if [[ -L "$REPO" ]]; then
|
|
REPO=`readlink --canonicalize "$REPO"`
|
|
fi
|
|
UUID=paperwm@hedning:matrix.org
|
|
if type gnome-extensions > /dev/null; then
|
|
gnome-extensions disable "$UUID"
|
|
else
|
|
gnome-shell-extension-tool --disable="$UUID"
|
|
fi
|
|
EXT_DIR=${XDG_DATA_HOME:-$HOME/.local/share}/gnome-shell/extensions
|
|
EXT=$EXT_DIR/$UUID
|
|
LINK=`readlink --canonicalize "$EXT"`
|
|
if [[ "$LINK" != "$REPO" ]]; then
|
|
echo "$EXT" does not link to "$REPO", refusing to remove
|
|
exit 1
|
|
fi
|
|
if [ -L "$EXT" ]; then
|
|
rm "$EXT"
|
|
else
|
|
read -p "Remove $EXT? (y/N): " -n 1 -r
|
|
echo
|
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
rm -rf $EXT
|
|
fi
|
|
fi
|