s243a

installpkg.sh (tahpup) LN# 126-147 - No duplicate Installs

Apr 22nd, 2018
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.18 KB | None | 0 0
  1. #131222 do not allow duplicate installs... #LN# 126 to 147 of /usr/local/petget (tahrpup) - http://www.pearltrees.com/s243a/installpkg-sh-usr-local-petget/id20402080/item224090735
  2. PTN1='^'"$DLPKG_NAME"'|'
  3. if [ "`grep "$PTN1" /root/.packages/user-installed-packages`" != "" ];then
  4.  if [ ! $DISPLAY ];then
  5.   [ -f /tmp/install_quietly ] && DISPTIME1="--timeout 3" || DISPTIME1=''
  6.   LANG=$LANG_USER
  7.   dialog ${DISPTIME1} --msgbox "$(gettext 'This package is already installed. Cannot install it twice:') ${DLPKG_NAME}" 0 0
  8.  else
  9.   LANG=$LANG_USER
  10.   if [ "$(</var/local/petget/ui_choice)" = "Classic" -o -f /tmp/install_classic ]; then
  11.    /usr/lib/gtkdialog/box_ok "$(gettext 'Puppy package manager')" error "$(gettext 'This package is already installed. Cannot install it twice:')" "<i>${DLPKG_NAME}</i>"
  12.    [ -f /tmp/install_classic ] && echo ${DLPKG_NAME} >> /tmp/pgks_failed_to_install_forced
  13.   else
  14.    /usr/lib/gtkdialog/box_ok "$(gettext 'Puppy package manager')" error "$(gettext 'This package is already installed. Cannot install it twice:')" "<i>${DLPKG_NAME}</i>" &
  15.    XPID=$!
  16.    sleep 3
  17.    pkill -P $XPID
  18.    echo ${DLPKG_NAME} >> /tmp/pgks_failed_to_install_forced
  19.   fi
  20.  fi
  21.  exit 1
  22. fi
Advertisement
Add Comment
Please, Sign In to add comment