Files
nix-config-ryan4yin/.agents/skills/nix-config-umu-game/scripts/templates/uninstall.sh.tpl
T

27 lines
698 B
Smarty

#!/usr/bin/env bash
# Generated by the nix-config-umu-game skill.
set -euo pipefail
GAMES_DIR_PATH=@GAMES_DIR@
if [[ -L "$GAMES_DIR_PATH" ]]; then
echo "refusing symlinked Games directory: $GAMES_DIR_PATH" >&2
exit 1
fi
GAMES_DIR="$(cd "$GAMES_DIR_PATH" && pwd -P)"
NAME=@NAME@
HERE="$(cd "$(dirname "$(readlink -f "$0")")" && pwd -P)"
if [[ "$HERE" != "$GAMES_DIR/$NAME" ]]; then
echo "refusing to remove path outside $GAMES_DIR/$NAME: $HERE" >&2
exit 1
fi
rm -f @DESKTOP_FILE@
echo "desktop entry removed"
printf "Delete %s and all its files? [y/N] " "$HERE"
read -r ans
if [ "$ans" = y ] || [ "$ans" = Y ]; then
cd /
rm -rf "$HERE"
echo "removed $HERE"
else
echo "kept $HERE"
fi