Add command_exists for snap

This commit is contained in:
JEEVITHA KANNAN K S 2024-10-04 16:09:41 +05:30
parent 26d0adc829
commit 0e14d3a9db
No known key found for this signature in database
GPG Key ID: 5904C34A2F7CE333

View File

@ -3,27 +3,29 @@
. ../common-script.sh
removeSnaps() {
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)
"$ESCALATION_TOOL" "$PACKAGER" remove snapd
;;
zypper)
"$ESCALATION_TOOL" "$PACKAGER" remove snapd
;;
*)
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
exit 1
;;
esac
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}"
else
printf "%b\n" "${GREEN}Snap is not installed...${RC}"
fi
}
checkEnv