summaryrefslogtreecommitdiff
path: root/tools/linux_packaging/uninstall.sh.in
diff options
context:
space:
mode:
authorTodd Naugle <toddn@glw.com>2011-04-06 19:02:11 +0000
committerTodd Naugle <toddn@glw.com>2011-04-06 19:02:11 +0000
commit72b0911421fbbdcfe4ce5937c9b7758ae085de42 (patch)
tree2a37f803feaa7e25a1b54ba2f0317843bfdc207d /tools/linux_packaging/uninstall.sh.in
parent67d970529ae7a536ab2c3bea761426b8ec9a8f5b (diff)
install and uninstall can now be run as root (ie su -c) although this is not preferred. Also check for free disk space before installing
git-svn-id: svn://localhost/ardour2/branches/3.0@9308 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'tools/linux_packaging/uninstall.sh.in')
-rw-r--r--tools/linux_packaging/uninstall.sh.in56
1 files changed, 47 insertions, 9 deletions
diff --git a/tools/linux_packaging/uninstall.sh.in b/tools/linux_packaging/uninstall.sh.in
index 468a4035fa..7e86b2bc11 100644
--- a/tools/linux_packaging/uninstall.sh.in
+++ b/tools/linux_packaging/uninstall.sh.in
@@ -33,6 +33,44 @@ fi
MENU_FILE_PATH="${PGM_PATH}/share/${MENU_FILE}"
+#############################
+# Check for root privileges
+#############################
+
+SUPER=""
+
+if [ "$(id -u)" != "0" ]; then
+
+ if ! which sudo > /dev/null;
+ then
+ echo ""
+ echo "!!! ERROR !!!"
+ echo ""
+ echo "The uninstaller requires root privileges. It is currently not"
+ echo "running as root AND the program sudo is missing from this system."
+ echo ""
+ echo "Please correct this by running the uninstaller as root or"
+ echo "installing and configuring sudo."
+ echo ""
+ read -p "Press ENTER to exit uninstaller:" BLAH
+ exit 1
+ fi
+
+ if ! sudo date;
+ then
+ echo ""
+ echo "!!! ERROR !!!"
+ echo ""
+ echo "Either you don't know the root password or the user is not allowed to sudo"
+ echo "Please correct this and run the uninstaller again"
+ echo "(hint: use visudo to edit sudoers file or run the installer as root)"
+ echo ""
+ read -p "Press ENTER to exit uninstaller:" BLAH
+ exit 1
+ fi
+ SUPER="sudo"
+fi
+
#######################
# Check for xdg utils
#######################
@@ -65,26 +103,26 @@ then
if [ "T" = ${HAS_XDG} ];
then
- sudo xdg-desktop-menu uninstall ${MENU_FILE_PATH}
- sudo xdg-icon-resource uninstall --size 16 ${ICON_NAME}
- sudo xdg-icon-resource uninstall --size 22 ${ICON_NAME}
- sudo xdg-icon-resource uninstall --size 32 ${ICON_NAME}
- sudo xdg-icon-resource uninstall --size 48 ${ICON_NAME}
+ ${SUPER} xdg-desktop-menu uninstall ${MENU_FILE_PATH}
+ ${SUPER} xdg-icon-resource uninstall --size 16 ${ICON_NAME}
+ ${SUPER} xdg-icon-resource uninstall --size 22 ${ICON_NAME}
+ ${SUPER} xdg-icon-resource uninstall --size 32 ${ICON_NAME}
+ ${SUPER} xdg-icon-resource uninstall --size 48 ${ICON_NAME}
if [ -e /usr/share/icons/hicolor/scalable/apps/${ICON_NAME}.svg ];
then
- sudo rm -f /usr/share/icons/hicolor/scalable/apps/${ICON_NAME}.svg
+ ${SUPER} rm -f /usr/share/icons/hicolor/scalable/apps/${ICON_NAME}.svg
fi
fi
if [ -e ~/Desktop/${DESKTOP_LINK_FILE} ];
then
- sudo rm -f ~/Desktop/${DESKTOP_LINK_FILE}
+ ${SUPER} rm -f ~/Desktop/${DESKTOP_LINK_FILE}
fi
# delete the old package
- sudo rm -rf ${PGM_PATH}
- sudo rm -f $0
+ ${SUPER} rm -rf ${PGM_PATH}
+ ${SUPER} rm -f $0
else
echo ""
echo "!!! FAILURE !!! - install path ${PGM_PATH} does not exist."