petget does not check if db entry is same as pkg name

Please post any bugs you have found
Post Reply
Message
Author
User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

petget does not check if db entry is same as pkg name

#1 Post by Karl Godt »

Code: Select all

diff -uraNd /mnt/+JUMP-10+puppy_slacko_5.3.1.sfs/usr/local/petget/installpkg.sh /usr/local/petget/installpkg.sh
--- /mnt/+JUMP-10+puppy_slacko_5.3.1.sfs/usr/local/petget/installpkg.sh	2011-10-21 21:27:33.000000000 +0100
+++ /usr/local/petget/installpkg.sh	2011-12-27 10:07:59.000000000 +0100
@@ -280,6 +280,17 @@
  dlPATTERN='|'"`echo -n "$DLPKG_BASE" | sed -e 's%\\-%\\\\-%'`"'|'
  DB_ENTRY="`cat /tmp/petget_missing_dbentries-Packages-* | grep "$dlPATTERN" | head -n 1`"
 fi
+echo DLPKG_BASE=$DLPKG_BASE
+echo DLPKG_NAME=$DLPKG_NAME
+echo DB_ENTRY=$DB_ENTRY
+##+++2011-12-27 KRG check if $DLPKG_BASE matches DB_ENTRY 1 so uninstallation works :Ooops:
+db_pkg_name=`echo "$DB_ENTRY" |cut -f 1 -d '|'`
+echo db_pkg_name=$db_pkg_name
+if [ "$db_pkg_name" != "$DLPKG_NAME" ];then
+echo not equal sed ing now
+DB_ENTRY=`echo "$DB_ENTRY" |sed "s#$db_pkg_name#$DLPKG_NAME#"`
+fi
+##+++2011-12-27 KRG 
 
 #see if a .desktop file was installed, fix category...
 ONEDOT=""
diff -uraNd /mnt/+JUMP-10+puppy_slacko_5.3.1.sfs/usr/local/petget/removepreview.sh /usr/local/petget/removepreview.sh
--- /mnt/+JUMP-10+puppy_slacko_5.3.1.sfs/usr/local/petget/removepreview.sh	2011-12-10 08:06:12.000000000 +0100
+++ /usr/local/petget/removepreview.sh	2011-12-27 09:44:46.000000000 +0100
@@ -19,7 +19,8 @@
 DB_pkgname="$TREE2"
 
 #v424 info box, nothing yet installed...
-if [ "$DB_pkgname" = "" ];then
+#if [ "$DB_pkgname" = "" ];then
+if [ "$DB_pkgname" = "" -a "`cat /root/.packages/user-installed-packages`" = "" ];then #fix for ziggi
  export REM_DIALOG="<window title=\"Puppy Package Manager\" icon-name=\"gtk-about\">
   <vbox>
    <pixmap><input file>/usr/local/lib/X11/pixmaps/error.xpm</input></pixmap>
@@ -31,8 +32,11 @@
  </window>
 "
  [ "$DISPLAY" != "" ] && gtkdialog3 --program=REM_DIALOG
- exit
+ exit 0
 fi
+if [ "$DB_pkgname" = "" ];then #fix for ziggi moved here problem is  #2011-12-27 KRG
+exit 0                         #clicking an empty line in the gui would have
+fi                             #thrown the above REM_DIALOG even if pkgs are installed
 
 export REM_DIALOG="<window title=\"Puppy Package Manager\" icon-name=\"gtk-about\">
   <vbox>
@@ -48,7 +52,7 @@
 if [ "$DISPLAY" != "" ];then
  RETPARAMS="`gtkdialog3 --program=REM_DIALOG`"
  eval "$RETPARAMS"
- [ "$EXIT" != "OK" ] && exit
+ [ "$EXIT" != "OK" ] && exit 0
 fi
 
 if [ -f /root/.packages/${DB_pkgname}.files ];then
@@ -74,6 +78,39 @@
    [ "`ls -1 $ONESPEC`" = "" ] && rmdir $ONESPEC 2>/dev/null
   fi
  done
+ ###+++2011-12-27 KRG
+ else
+ firstchar=`echo ${DB_pkgname} | cut -c 1`
+ possiblePKGS=`find /root/.packages -type f -iname "$firstchar*.files"`
+ possible5=`echo "$possiblePKGS" | head -n5`
+ count=`echo "$possiblePKGS" | wc -l`
+ [ ! "$count" ] && count=0
+ [ ! "$possiblePKGS" ] && possiblePKGS="No pkgs beginning with $firstchar found"
+ if [ "$count" -le '5' ];then
+ WARNMSG="$possiblePKGS"
+ else
+ WARNMSG="Found more than 5 pkgs starting with $firstchar .
+The first 5 are
+$possible5"
+ fi
+ xmessage -bg red "WARNING :
+No file named ${DB_pkgname}.files found in
+/root/.packages/ folder .
+  
+$0 
+refusing cowardly to remove the package .
+
+Possible suggestions are
+$WARNMSG
+
+Possible solution :
+Edit /root/.packages/user-installed-packages to match the pkgname 
+and start again .
+"
+ rox /root/.packages
+ geany /root/.packages/user-installed-packages
+ exit 101
+ ###+++2011-12-27 KRG
 fi
 
 #fix menu...
@@ -150,5 +187,10 @@
 if [ "$DISPLAY" != "" ];then
  gtkdialog3 --program=REM_DIALOG
 fi
-
+###+++2011-12-27 KRG
+#emitting exitcode for some windowmanager depending on dbus
+#popup a message window saying the program stopped unexpectedly
+#ie (old) enlightenment
+exit 0
+###+++2011-12-27 KRG
 ###END###

NOTE : THE IMPORTANT PART IS
+db_pkg_name=`echo "$DB_ENTRY" |cut -f 1 -d '|'`
+if [ "$db_pkg_name" != "$DLPKG_NAME" ];then
+DB_ENTRY=`echo "$DB_ENTRY" |sed "s#$db_pkg_name#$DLPKG_NAME#"`
+fi


CONVENIENT :
The ui_ziggi at REM_DIALOG will always popup the errormessage "no user installed packages" if one empty line in the gui would've been accidentally clicked .

Also to emit a message if the pkgname.files don't match or are not found .

Post Reply