diff options
author | Todd Naugle <toddn@glw.com> | 2011-04-01 21:26:02 +0000 |
---|---|---|
committer | Todd Naugle <toddn@glw.com> | 2011-04-01 21:26:02 +0000 |
commit | c34889459c7f04f15ef9f479c742abfb04c035cf (patch) | |
tree | 018186f74c1d6f61a68756a736a5b3b025056674 | |
parent | acf4197cb40c76d643987fa98225607129c8bde1 (diff) |
Added checks to ensure there is enough disk space to install. Also added a check for the sudo command
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@9258 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rwxr-xr-x | tools/linux_packaging/stage2.run | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/tools/linux_packaging/stage2.run b/tools/linux_packaging/stage2.run index a7262bc34b..6278ac4342 100755 --- a/tools/linux_packaging/stage2.run +++ b/tools/linux_packaging/stage2.run @@ -112,6 +112,19 @@ echo "" # Check sudo ############## +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 + if ! sudo date; then echo "" @@ -146,6 +159,47 @@ case `uname -m` in ;; esac +#################### +# Check disk space +#################### + +# We have to check the current folder and the INSTALL_DEST_BASE just +# in case they are on different devices +echo "Checking for required disk space" + +if [ ! -e .${PGM_NAME}_${ARCH}-*.size ]; then + echo "" + echo "!!! ERROR !!! Can't locate .size file for ${ARCH} bundle." + echo "" + exit 1 +else + REQUIRED_BYTES=$(cat .${PGM_NAME}_${ARCH}-*.size) + + #Check space in current folder + FREE_BYTES=$(df -B 1 ${PKG_PATH} | grep / | awk '{print $4}') + + if [ ${FREE_BYTES} -le ${REQUIRED_BYTES} ] ; then + echo "" + echo "!!! ERROR !!! - Insufficient disk space in ${PKG_PATH}" + echo "" + exit 1 + fi + + #Check space in INSTALL_DEST_BASE + FREE_BYTES=$(df -B 1 ${INSTALL_DEST_BASE} | grep / | awk '{print $4}') + + if [ ${FREE_BYTES} -le ${REQUIRED_BYTES} ] ; then + echo "" + echo "!!! ERROR !!! - Insufficient disk space in ${INSTALL_DEST_BASE}" + echo "" + exit 1 + fi +fi + +##################### +# Unpack the bundle +##################### + # untar the correct bundle for us to install echo "Unpacking bundle for $ARCH" |