home *** CD-ROM | disk | FTP | other *** search
/ PCNET 2006 September - Disc 1 / PCNET_CD_2006_09.iso / linux / puppy-barebones-2.01r2.iso / pup_201.sfs / usr / sbin / dotpuprox.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  2005-09-15  |  2.1 KB  |  110 lines

  1. #!/bin/sh
  2. # dotpup handler 0.0.2 - GuestToo - Sep 15, 2005
  3. ### always, never options
  4. ### removed geometry for gxmessage
  5. ### changed rm -rf $DPDIR to rm -rf /root/DotPupTmpDir (just in case)
  6. ### read DPDIR from $CONFIG ??
  7.  
  8. FNAME=`basename "$1"`
  9. CONFIG=/etc/dotpup
  10. DPDIR=/root/DotPupTmpDir
  11.  
  12. if which gxmessage
  13. then
  14.   ##### MSG='gxmessage -geometry 640x160'
  15.   MSG=gxmessage
  16. else
  17.   MSG=xmessage
  18. fi
  19.  
  20. [ -d $CONFIG ] || mkdir $CONFIG
  21.  
  22. if [ ! -r "$1" ]
  23. then
  24.   $MSG -center -title "DotPup Error" "File not found: $FNAME"
  25.   exit 1
  26. fi
  27.  
  28.  
  29. # ----- test zip integrity
  30.  
  31. if ! unzip -t "$1"
  32. then
  33.   $MSG -center -title "DotPup Error" "File integrity ERROR: $FNAME
  34.  
  35. Suggestion: Download the Pup file again"
  36.   exit 1
  37. fi
  38.  
  39.  
  40. # -----
  41.  
  42. if [ ! -r $CONFIG/always-unzip ]
  43. then
  44.   $MSG -buttons "Unzip the Pup File:21,Always:22,Cancel" -center -title "DotPup" "File integrity is OK: $FNAME"
  45.   case $? in
  46.     21) true ;;
  47.     22) touch $CONFIG/always-unzip ;;
  48.     *) exit ;;
  49.   esac
  50. fi
  51.  
  52.  
  53. # ----- setup clean workspace
  54.  
  55. [ -d "$DPDIR" ] && rm -rf /root/DotPupTmpDir
  56. mkdir "$DPDIR"
  57. cd "$DPDIR"
  58.  
  59.  
  60. # ----- unzip the dotpup
  61.  
  62. if ! unzip -o "$1"
  63. then
  64.   $MSG -center -title "DotPup Error" "ERROR unzipping: $FNAME"
  65.   exit 1
  66. fi
  67.  
  68.  
  69. # ----- run dotpup.sh script
  70.  
  71. if [ -r dotpup.sh ]
  72. then
  73.   if [ ! -r $CONFIG/always-run ]
  74.   then
  75.     $MSG -buttons "Run the Installer:21,Always:22,Cancel" -center -title "DotPup" "DO NOT RUN THE INSTALLER
  76. IF YOU ARE NOT SURE IT IS SAFE"
  77.     case $? in
  78.       21) true ;;
  79.       22) touch $CONFIG/always-run ;;
  80.       *) exit ;;
  81.     esac
  82.   fi
  83.   chmod a+x dotpup.sh
  84.   "$DPDIR/dotpup.sh"
  85.   # popup a message if an error code was returned??
  86. fi
  87.  
  88.  
  89. # ----- cleanup the working space
  90.  
  91. rm -rf /root/DotPupTmpDir
  92.  
  93.  
  94. # ----- delete the dotpup file? (this section is not really necessary)
  95.  
  96. sleep 1
  97. ALWAYS=$CONFIG/always-delete-dotpup
  98. NEVER=$CONFIG/never-delete-dotpup
  99. [ -r $ALWAYS ] && exec rm -f "$1"
  100. [ -r $NEVER ] && exit
  101. $MSG -buttons "Delete the DotPup File:21,Always:22,Never:23,No" -center -title "DotPup" "Delete the file $FNAME ?"
  102. case $? in
  103.   21) rm -f "$1" ;;
  104.   22) touch $ALWAYS
  105.       rm -f $NEVER "$1" ;;
  106.   23) touch $NEVER
  107.       rm -f $ALWAYS ;;
  108.   *) exit ;;
  109. esac
  110.