summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorTodd Naugle <toddn@glw.com>2011-04-06 17:49:24 +0000
committerTodd Naugle <toddn@glw.com>2011-04-06 17:49:24 +0000
commit4b8274b4d43525a6ef5b22c25fdd099afd513556 (patch)
tree74fbd3679608fe3749403505870988dd6ca03ce8 /tools
parentc34889459c7f04f15ef9f479c742abfb04c035cf (diff)
install and uninstall can now be run as root (ie su -c) although this is not preferred.
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@9305 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'tools')
-rwxr-xr-xtools/linux_packaging/stage2.run96
-rw-r--r--tools/linux_packaging/uninstall.sh.in56
2 files changed, 105 insertions, 47 deletions
diff --git a/tools/linux_packaging/stage2.run b/tools/linux_packaging/stage2.run
index 6278ac4342..7f6eafd0d5 100755
--- a/tools/linux_packaging/stage2.run
+++ b/tools/linux_packaging/stage2.run
@@ -59,7 +59,7 @@ SystemInstall ()
if which yum > /dev/null;
then
- sudo yum -y install $1
+ ${SUPER} yum -y install $1
rtrn=$?
if [ $rtrn -ne 0 ];
@@ -72,7 +72,7 @@ SystemInstall ()
elif which apt-get > /dev/null;
then
- sudo apt-get -y install $1
+ ${SUPER} apt-get -y install $1
rtrn=$?
if [ $rtrn -ne 0 ];
@@ -108,33 +108,53 @@ echo ""
echo "Welcome to the ${PGM_NAME} installer"
echo ""
-##############
-# Check sudo
-##############
+#############################
+# Check for root privileges
+#############################
-if ! which sudo > /dev/null;
-then
- echo ""
- echo "!!! ERROR !!!"
- echo ""
- echo "The program sudo appears to be missing from the system."
- echo "Please correct this and run the installer again."
- echo "This installer requires root privileges."
- echo ""
- read -p "Press ENTER to exit installer:" BLAH
- exit 1
-fi
+SUPER=""
-if ! sudo date;
-then
+if [ "$(id -u)" != "0" ]; then
+
+ if ! which sudo > /dev/null;
+ then
+ echo ""
+ echo "!!! ERROR !!!"
+ echo ""
+ echo "The installer 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 installing and configuring sudo or running"
+ echo "the installer as root."
+ echo ""
+ read -p "Press ENTER to exit installer:" 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 installer again"
+ echo "(hint: use visudo to edit sudoers file)"
+ echo ""
+ read -p "Press ENTER to exit installer:" BLAH
+ exit 1
+ fi
+ SUPER="sudo"
+else
echo ""
- echo "!!! ERROR !!!"
+ echo "!!! Warning !!!"
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 installer again (hint: use visudo to edit sudoers file)"
+ echo "The installer is running as the root user which is not the prefered method."
+ echo "There are checks run at the end of the installer to help ensure proper operation"
+ echo "of ${PGM_NAME} (realtime priviledges, memory locking, frequency scaling)."
+ echo "Running as root will invalidate these tests."
echo ""
- read -p "Press ENTER to exit installer:" BLAH
- exit 1
+ read -p "Press ENTER to continue:" BLAH
+
fi
############################
@@ -332,7 +352,7 @@ then
echo "Running uninstaller $i"
${i}
- sudo rm -f ${i}
+ ${SUPER} rm -f ${i}
fi
done
fi
@@ -345,8 +365,8 @@ echo "Installing ${PGM_NAME} ${PGM_VERSION} built from ${PGM_BUILD} in ${INSTALL
echo ""
# Copy the new version in the install directory
-sudo mkdir ${INSTALL_DEST_BASE}/${PGM_FULL_NAME}
-sudo cp -Rf ${BUNDLE_DIR}/* ${INSTALL_DEST_BASE}/${PGM_FULL_NAME}/
+${SUPER} mkdir ${INSTALL_DEST_BASE}/${PGM_FULL_NAME}
+${SUPER} cp -Rf ${BUNDLE_DIR}/* ${INSTALL_DEST_BASE}/${PGM_FULL_NAME}/
# write the desktop/menu file
echo "[Desktop Entry]" > /tmp/${MENU_FILE}
@@ -366,24 +386,24 @@ echo "Comment=Digital Audio Workstation" >> /tmp/${MENU_FILE}
echo "Categories=AudioVideo;AudioEditing;Audio;Recorder;" >> /tmp/${MENU_FILE}
chmod ugo+rx /tmp/${MENU_FILE}
-sudo mv /tmp/${MENU_FILE} ${MENU_FILE_PATH}/.
+${SUPER} mv /tmp/${MENU_FILE} ${MENU_FILE_PATH}/.
# install the Menu, Link, and Icon(s)
if [ "T" = ${HAS_XDG} ];
then
echo "Adding ${PGM_NAME} to the applications menu"
- sudo xdg-icon-resource install --context apps --size 16 ${ICON_PATH}/${PGM_NAME_LOWER}_icon_16px.png ${ICON_NAME}
- sudo xdg-icon-resource install --context apps --size 22 ${ICON_PATH}/${PGM_NAME_LOWER}_icon_22px.png ${ICON_NAME}
- sudo xdg-icon-resource install --context apps --size 32 ${ICON_PATH}/${PGM_NAME_LOWER}_icon_32px.png ${ICON_NAME}
- sudo xdg-icon-resource install --context apps --size 48 ${ICON_PATH}/${PGM_NAME_LOWER}_icon_48px.png ${ICON_NAME}
+ ${SUPER} xdg-icon-resource install --context apps --size 16 ${ICON_PATH}/${PGM_NAME_LOWER}_icon_16px.png ${ICON_NAME}
+ ${SUPER} xdg-icon-resource install --context apps --size 22 ${ICON_PATH}/${PGM_NAME_LOWER}_icon_22px.png ${ICON_NAME}
+ ${SUPER} xdg-icon-resource install --context apps --size 32 ${ICON_PATH}/${PGM_NAME_LOWER}_icon_32px.png ${ICON_NAME}
+ ${SUPER} xdg-icon-resource install --context apps --size 48 ${ICON_PATH}/${PGM_NAME_LOWER}_icon_48px.png ${ICON_NAME}
if [ -e ${ICON_PATH}/${PGM_NAME_LOWER}_icon.svg -a -d /usr/share/icons/hicolor/scalable/apps ];
then
- sudo cp -f ${ICON_PATH}/${PGM_NAME_LOWER}_icon.svg /usr/share/icons/hicolor/scalable/apps/${ICON_NAME}.svg
+ ${SUPER} cp -f ${ICON_PATH}/${PGM_NAME_LOWER}_icon.svg /usr/share/icons/hicolor/scalable/apps/${ICON_NAME}.svg
fi
- sudo xdg-desktop-menu install ${MENU_FILE_PATH}/${MENU_FILE}
- sudo xdg-desktop-menu forceupdate --mode system # Some systems need an extra kick
+ ${SUPER} xdg-desktop-menu install ${MENU_FILE_PATH}/${MENU_FILE}
+ ${SUPER} xdg-desktop-menu forceupdate --mode system # Some systems need an extra kick
echo ""
echo "Creating a desktop link for ${PGM_NAME}"
@@ -400,7 +420,7 @@ echo ""
echo "Copying uninstall script to ${INSTALL_DEST_BASE}"
echo ""
-sudo cp -f ${BUNDLE_DIR}/bin/*.uninstall.sh ${INSTALL_DEST_BASE}/.
+${SUPER} cp -f ${BUNDLE_DIR}/bin/*.uninstall.sh ${INSTALL_DEST_BASE}/.
###########################
# Check Jack and qjackctl
@@ -502,7 +522,7 @@ then
read -p "Press ENTER to continue:" BLAH
user=`whoami`
- if sudo usermod -a -G audio $user;
+ if ${SUPER} usermod -a -G audio $user;
then
USER_GROUP_ADJUSTED="t"
else
@@ -524,7 +544,7 @@ then
read -p "Press ENTER to continue:" BLAH
user=`whoami`
- if sudo usermod -a -G jackuser $user;
+ if ${SUPER} usermod -a -G jackuser $user;
then
USER_GROUP_ADJUSTED="t"
else
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."