s243a

installpkg.sh LN# 151-179 Is there enough room in /tmp/

Apr 22nd, 2018
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.37 KB | None | 0 0
  1. if [ "$PUPMODE" = "2" ]; then # from BK's quirky6.1 # LN# 151-179 of /usr/local/petget/installpkg.sh (tahpup) - http://www.pearltrees.com/s243a/installpkg-sh-usr-local-petget/id20402080/item224091068
  2.     #131220  131229 detect if not enough room in /tmp...
  3.     DIRECTSAVEPATH="/tmp/petget/directsavepath"
  4.     SIZEB=`stat --format=%s "${DLPKG_PATH}"/${DLPKG_BASE}`
  5.     SIZEK=`expr $SIZEB \/ 1024`
  6.     EXPK=`expr $SIZEK \* 5` #estimated worst-case expanded size.
  7.     NEEDK=$EXPK
  8.     TMPK=`df -k /tmp | grep '^tmpfs' | tr -s ' ' | cut -f 4 -d ' '` #free space in /tmp
  9.     if [ $EXPK -ge $TMPK ];then
  10.       DIRECTSAVEPATH="/audit/directsavepath"
  11.       NEEDK=`expr $NEEDK \* 2`
  12.     fi
  13.     if [ "$DIRECTSAVEPATH" ];then
  14.      rm -rf $DIRECTSAVEPATH
  15.      mkdir -p $DIRECTSAVEPATH
  16.     fi
  17.     # check enough space to install pkg...
  18.     #as the pkg gets expanded to an intermediate dir, maybe in main f.s...
  19.     PARTK=`df -k / | grep '/$' | tr -s ' ' | cut -f 4 -d ' '` #free space in partition.
  20.     if [ $NEEDK -gt $PARTK ];then
  21.      LANG=$LANG_USER
  22.      if [ $DISPLAY ];then
  23.       /usr/lib/gtkdialog/box_ok "$(gettext 'Puppy package manager')" error "$(gettext 'Not enough free space in the partition to install this package'):" "<i>${DLPKG_BASE}</i>"
  24.      else
  25.       echo -e "$(gettext 'Not enough free space in the partition to install this package'):\n${DLPKG_BASE}"
  26.      fi
  27.      [ "$DLPKG_PATH" != "" ] && rm -f "${DLPKG_PATH}"/${DLPKG_BASE}
  28.      exit 1
  29.     fi
Advertisement
Add Comment
Please, Sign In to add comment