summaryrefslogtreecommitdiff
path: root/tools/linux_packaging/uninstall.sh.in
diff options
context:
space:
mode:
authorTodd Naugle <toddn@glw.com>2012-02-29 17:55:13 +0000
committerTodd Naugle <toddn@glw.com>2012-02-29 17:55:13 +0000
commita3eaff8fa3087a17fa166a5cddcf91f0e6e805e1 (patch)
treec101e124c6e8190a0df51b10497419e9fc8478a6 /tools/linux_packaging/uninstall.sh.in
parent8de887f378b13e558bdd74e88be79dc96df9d7b4 (diff)
The installer will now create a link to the program in /usr/local/bin to allow starting from the command line. If the installer or uninstaller is not running as root, they will now attempt to use both sudo and su to get root access. This means double click install now works on systems that don't have sudo installed or configured.
git-svn-id: svn://localhost/ardour2/branches/3.0@11553 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'tools/linux_packaging/uninstall.sh.in')
-rw-r--r--tools/linux_packaging/uninstall.sh.in68
1 files changed, 52 insertions, 16 deletions
diff --git a/tools/linux_packaging/uninstall.sh.in b/tools/linux_packaging/uninstall.sh.in
index de0bf1ae4f..b1e4f3cec3 100644
--- a/tools/linux_packaging/uninstall.sh.in
+++ b/tools/linux_packaging/uninstall.sh.in
@@ -15,6 +15,9 @@ PGM_BUILD="%REPLACE_BUILD%"
PGM_BUILDTYPE="%REPLACE_TYPE%"
INSTALL_DEST_BASE=/opt
+USER_BIN_DIR="/usr/local/bin"
+
+UNINSTALLER="$(readlink -f "$0")"
USER_NAME=$(logname)
@@ -46,29 +49,49 @@ 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 "Attempting to uninstall using su"
+ echo "Please enter root password below"
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
+
+ if ! su -c "${UNINSTALLER}";
+ then
+ echo ""
+ echo "!!! ERROR !!!"
+ echo ""
+ echo "This uninstaller requires root privileges. It is currently not"
+ echo "running as root AND an attempt to use su failed."
+ echo ""
+ echo "Please correct this by installing and configuring sudo or running"
+ echo "the uninstaller as root (su -c)."
+ echo ""
+ read -p "Press ENTER to exit uninstaller:" BLAH
+ exit 1
+ fi
+ exit
fi
if ! sudo date;
then
echo ""
- echo "!!! ERROR !!!"
+ echo "Attempting to uninstall using su"
+ echo "Please enter root password below"
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
+
+ if ! su -c "${UNINSTALLER}";
+ then
+ echo ""
+ echo "!!! ERROR !!!"
+ echo ""
+ echo "This uninstaller requires root privileges. It is currently not"
+ echo "running as root AND an attempt to use both sudo and su failed."
+ echo ""
+ echo "Please correct this by installing and configuring sudo or running"
+ echo "the uninstaller as root (su -c)."
+ echo ""
+ read -p "Press ENTER to exit uninstaller:" BLAH
+ exit 1
+ fi
+ exit
fi
SUPER="sudo"
fi
@@ -135,6 +158,19 @@ then
${SUPER} rm -f ${USER_DESKTOP_DIR}/${DESKTOP_LINK_FILE}
fi
+ # delete the bin link if it is linked to this version
+ if [ -e "${USER_BIN_DIR}/${PGM_NAME}3" ];
+ then
+ BIN_LINK_TARGET=$(readlink "${USER_BIN_DIR}/${PGM_NAME}3")
+ BIN_LINK_TARGET_DIR=$(dirname "${BIN_LINK_TARGET}")
+
+ if [ "${BIN_LINK_TARGET_DIR}" = "${PGM_PATH}/bin" ];
+ then
+ ${SUPER} rm -f "${USER_BIN_DIR}/${PGM_NAME}3"
+ fi
+ fi
+
+
# delete the old package
${SUPER} rm -rf ${PGM_PATH}
${SUPER} rm -f $0