SHARE
TWEET

/usr/sbin/petget

s243a Aug 18th, 2019 (edited) 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. #set -x
  3. rm /root/petget.log
  4. #exec &> >(tee -a /root/petget.log)
  5. PKG_PATH_sc0ttman="`which pkg`"
  6. PKG_PATH="$(realpath "$1")"
  7. PKG_NAME="$(basename "$PKG_PATH")"
  8.  
  9. confirm_download(){
  10.   #confirm want to install... #Based on: https://github.com/puppylinux-woof-CE/woof-CE/blob/849a9faa7ea8cac74e04d04e4f99f4425652c26b/woof-code/rootfs-skeleton/usr/local/petget/petget#L166
  11.   if [ "$DISPLAY" ]; then
  12.    . /usr/lib/gtkdialog/box_yesno "$(gettext 'Puppy Package Manager')" "$(gettext 'Do you want to install this package:')" "<b>${FULLPKGNAME}</b>"
  13.    if [ "$EXIT" != "yes" ]; then
  14.      exit 0
  15.    fi
  16.   else
  17.     dialog --yesno "$(gettext 'Do you want to install this package:') $FULLPKGNAME" 0 0
  18.     if [ $? -ne 0 ];then
  19.       exit 0
  20.     fi
  21.   fi   
  22. }
  23. echo_commands(){
  24.   echo ". /etc/profile"
  25.   echo "cd \"$(realpath "$PWD")\""
  26.   echo "bash -x $PKG_PATH_sc0ttman i \"$PKG_PATH\"  2>&1 | tee -a /root/petget.log"
  27.   echo ""
  28. }
  29. if [ ! -z "$PKG_PATH_sc0ttman" ]; then
  30.   confirm_download
  31.   #echo_commands > /tmp/bla
  32.   #bash -x <(echo_commands)
  33.   bash -x /tmp/bla 2>&1 | tee /root/petget.log
  34.   #"$PKG_PATH_sc0ttman" -i "$PKG_PATH"  2>&1 | tee -a /root/petget.log
  35. else
  36.   CUR_DIR=dirname "$(readlink -f "$0")" #https://stackoverflow.com/questions/59895/get-the-source-directory-of-a-bash-script-from-within-the-script-itself
  37.   cd "$CUR_DIR"
  38.   PETGET_PATH="../local/petget/petget" #See if a relative path is possible (useful in prefixed systems)
  39.   [ ! -x "$(readlink -f "$PETGET_PATH")" ] && PETGET_PATH="/usr/local/petget/petget" #otherwise use absolute paths
  40.   "$PETGET_PATH" "$@"
  41. fi
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top