various fixes to MidiRegionView selection handling, key handling, drawing of ghost...
[ardour2.git] / tools / linux_packaging / uninstall.sh.in
blob7e86b2bc115f4ca8f50eb8eb164b11cd6c796153
1 #!/bin/sh
3 ######################################
5 # Ardour/Mixbus bundle uninstaller
6 # Todd Naugle
8 #####################################
11 PGM_NAME="%REPLACE_PGM%"
12 PGM_VENDOR="%REPLACE_VENDOR%"
13 PGM_VERSION="%REPLACE_VERSION%"
14 PGM_BUILD="%REPLACE_BUILD%"
15 PGM_BUILDTYPE="%REPLACE_TYPE%"
17 INSTALL_DEST_BASE=/opt
20 #### Derived Variables ####
21 if [ -z "${PGM_BUILDTYPE}" ]; then
22 PGM_PATH=${INSTALL_DEST_BASE}/${PGM_NAME}-${PGM_VERSION}_${PGM_BUILD}
23 ICON_NAME="${PGM_VENDOR}-${PGM_NAME}_${PGM_VERSION}" #no dash between name and version since dash seperates vendor from program
24 MENU_FILE="${PGM_VENDOR}-${PGM_NAME}_${PGM_VERSION}.desktop" #no dash between name and version since dash seperates vendor from program
25 DESKTOP_LINK_FILE="${PGM_NAME}_${PGM_VERSION}.desktop"
26 else
27 PGM_PATH=${INSTALL_DEST_BASE}/${PGM_NAME}-${PGM_VERSION}_${PGM_BUILD}-${PGM_BUILDTYPE}
28 ICON_NAME="${PGM_VENDOR}-${PGM_NAME}_${PGM_VERSION}_${PGM_BUILDTYPE}" #no dash between name and version since dash seperates vendor from program
29 MENU_FILE="${PGM_VENDOR}-${PGM_NAME}_${PGM_VERSION}_${PGM_BUILDTYPE}.desktop" #no dash between name and version since dash seperates vendor from program
30 DESKTOP_LINK_FILE="${PGM_NAME}_${PGM_VERSION}_${PGM_BUILDTYPE}.desktop"
33 MENU_FILE_PATH="${PGM_PATH}/share/${MENU_FILE}"
36 #############################
37 # Check for root privileges
38 #############################
40 SUPER=""
42 if [ "$(id -u)" != "0" ]; then
44 if ! which sudo > /dev/null;
45 then
46 echo ""
47 echo "!!! ERROR !!!"
48 echo ""
49 echo "The uninstaller requires root privileges. It is currently not"
50 echo "running as root AND the program sudo is missing from this system."
51 echo ""
52 echo "Please correct this by running the uninstaller as root or"
53 echo "installing and configuring sudo."
54 echo ""
55 read -p "Press ENTER to exit uninstaller:" BLAH
56 exit 1
59 if ! sudo date;
60 then
61 echo ""
62 echo "!!! ERROR !!!"
63 echo ""
64 echo "Either you don't know the root password or the user is not allowed to sudo"
65 echo "Please correct this and run the uninstaller again"
66 echo "(hint: use visudo to edit sudoers file or run the installer as root)"
67 echo ""
68 read -p "Press ENTER to exit uninstaller:" BLAH
69 exit 1
71 SUPER="sudo"
74 #######################
75 # Check for xdg utils
76 #######################
77 HAS_XDG="T"
79 XDG_MENU_VER=$(xdg-desktop-menu --version 2> /dev/null)
80 if [ -z "$XDG_MENU_VER" ];
81 then
82 echo "System does not have xdg-desktop-menu installed"
83 HAS_XDG="F"
86 XDG_ICON_VER=$(xdg-icon-resource --version 2> /dev/null)
87 if [ -z "$XDG_ICON_VER" ];
88 then
89 echo "System does not have xdg-icon-resource installed"
90 HAS_XDG="F"
94 #############
95 # Uninstall
96 #############
98 if [ -d ${PGM_PATH} ];
99 then
100 echo ""
101 echo "Removing existing ${PGM_NAME} installation at ${PGM_PATH}"
102 echo ""
104 if [ "T" = ${HAS_XDG} ];
105 then
106 ${SUPER} xdg-desktop-menu uninstall ${MENU_FILE_PATH}
107 ${SUPER} xdg-icon-resource uninstall --size 16 ${ICON_NAME}
108 ${SUPER} xdg-icon-resource uninstall --size 22 ${ICON_NAME}
109 ${SUPER} xdg-icon-resource uninstall --size 32 ${ICON_NAME}
110 ${SUPER} xdg-icon-resource uninstall --size 48 ${ICON_NAME}
112 if [ -e /usr/share/icons/hicolor/scalable/apps/${ICON_NAME}.svg ];
113 then
114 ${SUPER} rm -f /usr/share/icons/hicolor/scalable/apps/${ICON_NAME}.svg
118 if [ -e ~/Desktop/${DESKTOP_LINK_FILE} ];
119 then
120 ${SUPER} rm -f ~/Desktop/${DESKTOP_LINK_FILE}
123 # delete the old package
124 ${SUPER} rm -rf ${PGM_PATH}
125 ${SUPER} rm -f $0
126 else
127 echo ""
128 echo "!!! FAILURE !!! - install path ${PGM_PATH} does not exist."
129 echo ""