linutil/core/tabs/system-setup/remove-snaps.sh

34 lines
895 B
Bash
Raw Permalink Normal View History

2024-08-05 21:03:42 +01:00
#!/bin/sh -e
. ../common-script.sh
2024-08-05 21:03:42 +01:00
removeSnaps() {
2024-10-04 11:39:41 +01:00
if command_exists snap; then
case "$PACKAGER" in
pacman)
"$ESCALATION_TOOL" "$PACKAGER" -Rns snapd
;;
apt-get|nala)
"$ESCALATION_TOOL" "$PACKAGER" autoremove --purge snapd
if [ "$ID" = ubuntu ]; then
"$ESCALATION_TOOL" apt-mark hold snapd
fi
;;
dnf|zypper)
"$ESCALATION_TOOL" "$PACKAGER" remove snapd
;;
*)
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
exit 1
;;
esac
printf "%b\n" "${GREEN}Successfully removed snaps.${RC}"
2024-10-04 11:39:41 +01:00
else
printf "%b\n" "${GREEN}Snapd is not installed.${RC}"
2024-10-04 11:39:41 +01:00
fi
2024-08-05 21:03:42 +01:00
}
checkEnv
2024-08-23 14:12:47 +01:00
checkEscalationTool
2024-08-05 21:03:42 +01:00
removeSnaps