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 / puppyinstaller < prev    next >
Encoding:
Text File  |  2006-07-04  |  50.0 KB  |  1,046 lines

  1. #!/bin/sh
  2. #(c) Copyright Barry Kauler 2006 www.puppylinux.com
  3.  
  4. NEWVER="`cat /etc/puppyversion`"
  5. mount > /etc/mtab
  6.  
  7. #USBINFO="`lspci -i /usr/share/pci-usb-pcmcia.ids`"
  8.  
  9. fsfunc() #f.s. type param passed in
  10. {
  11.  FSTYPE="$1"
  12.  [ "$FSTYPE" = "Ext2" ] && FSTYPE="ext2"
  13.  [ "$FSTYPE" = "ReiserFS" ] && FSTYPE="reiserfs"
  14.  [ "$FSTYPE" = "Ext3" ] && FSTYPE="ext3"
  15.  [ "$FSTYPE" = "FAT16" ] && FSTYPE="vfat"
  16.  [ "$FSTYPE" = "FAT32" ] && FSTYPE="vfat"
  17.  [ "$FSTYPE" = "NTFS" ] && FSTYPE="ntfs"
  18.  [ "$FSTYPE" = "ISO9660" ] && FSTYPE="iso9660"
  19. }
  20.  
  21.  
  22. ispupfunc() #fstype partition
  23. {
  24.  PUPSFS=""
  25.  PUPVEROLD=0
  26.  [ ! $2 ] && return 0
  27.  mkdir /tmp/ispupmntpt 2> /dev/null
  28.  ISPUPMNTPT="`mount | grep "/dev/$2" | tr -s " " | cut -f 3 -d " "`"
  29.  if [ "$ISPUPMNTPT" = "" ];then
  30.   ISPUPMNTPT="/tmp/ispupmntpt"
  31.   mount -t $1 /dev/$2 /tmp/ispupmntpt
  32.  fi
  33.   if [ $? -eq 0 ];then
  34.    ISFILE="`ls -1 $ISPUPMNTPT/pup_[0-9][0-9][0-9].sfs | head -n 1`"
  35.    [ ! "$ISFILE" = "" ] && PUPVEROLD=`basename $ISFILE | cut -f 2 -d '_' | cut -f 1 -d '.'`
  36.    if [ -f $ISPUPMNTPT/etc/puppyversion ];then
  37.     PUPVEROLD=`cat $ISPUPMNTPT/etc/puppyversion`
  38.     #there is a bug in prev installer, put 0 into puppyversion...
  39.     PREVVER=`expr $NEWVER \- 1`
  40.     [ $PUPVEROLD -eq 0 ] && PUPVEROLD=$PREVVER
  41.    fi
  42.    [ -f $ISPUPMNTPT/usr_cram.fs ] && PUPVEROLD=108
  43.    umount /dev/$2
  44.   fi
  45.  return $PUPVEROLD
  46. }
  47.  
  48. gpartedfixusbfunc() { #params: $DESTPART $DESTFS
  49.  GPDRV="`echo -n "$1" | sed -e 's/[0-9]//g'`"
  50.  gparted /dev/$GPDRV &
  51.  sleep 2
  52.  xmessage -bg '#ba55d3' -center -title "Puppy Universal Installer" "GParted is a partition manager, available in Puppy2, though a 'barebones'
  53. release of Puppy2 may not have it, in which case you have to use the 
  54. PupGet package manager to install it. If it is installed, GParted is a
  55. very simple tool for deleting, creating and resizing partitions.
  56.  
  57. If you have a USB Flash 'key' drive that you have installed Puppy to but
  58. it will not boot, it may be that the partition(s) is confusing the PC's
  59. BIOS or Syslinux. Personally, I was able to fix such a USB drive by 
  60. wiping the existing partition and then create it again using GParted.
  61. The steps to do this are very simple: when GParted is running,
  62.  1. delete all partitions on the USB device. 
  63.  2. Create a new primary FAT16 partition, to fill the entire drive.
  64.  3. Click the 'Apply' button to write changes to the USB drive.
  65.  4. Set the 'boot' configuration flag (right-click on partition, 
  66.     choose 'manage flags'). 
  67.  
  68. If GParted is installed, it is now running and you can do the above.
  69. Quiting GParted will return you to the Puppy Universal Installer..." &
  70.  MSGID=$!
  71.  while [ 1 ];do
  72.   [ "`pidof gparted | tr "\n" '|'`" = "|" ] && break
  73.   sleep 1
  74.  done
  75.  [ ! "`which gparted`" = "" ] && kill $MSGID 2>/dev/null
  76. }
  77.  
  78. fixusbfunc() { #params: $DESTPART $DESTFS
  79.  echo '#!/bin/sh
  80. DESTPART="$1" #partition being installed to
  81. DESTFS="$2"   #filesystem of destination partition
  82. echo "This little section of the Puppy Universal Installer is currently only"
  83. echo "for fixing USB Flash or CF-card-in-IDE-adaptor, after you have gone thru"
  84. echo "all the steps but it still will not boot."
  85. echo
  86. echo "You are trying to install to $DESTPART, but it is not booting..."
  87. echo "Well, I am assuming that the BIOS in your PC is able to boot from USB."
  88. echo "-- for CF-IDE the drive looks like an ordinary hard drive, so that should"
  89. echo "   be okay for any BIOS."
  90. echo
  91. echo "This is the first release of this script, and it is a bit limited..."
  92. echo "and only handles a partition with a msdos/vfat filesystem."
  93. if [ "$DESTFS" = "vfat" ];then
  94.  echo "...which is okay, $DESTPART does have a $DESTFS filesystem."
  95.  echo "   But, we will now wipe it and recreate it."
  96. else
  97.  echo "...currently $DESTPART has a $DESTFS filesystem."
  98.  echo "   This script is not yet designed for that, so cannot continue."
  99.  echo
  100.  echo -n "Press ENTER key to exit: "
  101.  read nogo
  102.  exit
  103. fi
  104. echo
  105. echo "Please be sure that you are wiping the right partition!!!"
  106. echo "Everything in $DESTPART is going to be wiped. If you do not want that,"
  107. echo "press any letter on the keyboard then ENTER key, or"
  108. echo -n "Press ENTER key only to continue script: "
  109. read querygo
  110. echo
  111. echo "Recreating msdos filesystem on $DESTPART..."
  112. mkdosfs /dev/$DESTPART
  113. sync
  114. echo "Fixing the Master Boot Record (MBR)..."
  115. DESTDRV="`echo -n "$DESTPART" | cut -b 1-3`"
  116. dd if=/usr/lib/syslinux/mbrfat.bin of=/dev/$DESTDRV
  117. sync
  118. echo "...done"
  119. echo
  120. echo "Okay, we can now go back to the main part of the Puppy Universal"
  121. echo "Installer and install Puppy to the $DESTPART partition."
  122. echo -n "Press ENTER key to continue: "
  123. read yesgo
  124. ' > /tmp/fixusb.sh
  125.  chmod 755 /tmp/fixusb.sh
  126.  rxvt -bg "pink" -title "Puppy Universal Installer" -geometry 80x25 -e /tmp/fixusb.sh
  127. }
  128.  
  129. unmountcdfunc() {
  130.  if [ ! "$CDDRIVE" = "" ];then
  131.   if [ ! "`mount | grep "/dev/$CDDRIVE"`" = "" ];then
  132.    rox -D "`mount | grep "/dev/$CDDRIVE" | tr -s " " | cut -f 3 -d " "`"
  133.    #do not kill any processes
  134.    sync
  135.    umount /dev/$CDDRIVE 2> /dev/null
  136.    mount > /etc/mtab
  137.    [ "`mount | grep "/dev/$CDDRIVE"`" = "" ] && eject /dev/$CDDRIVE
  138.   fi
  139.  fi
  140. }
  141.  
  142. PMEDIA="`Xdialog --left --title "Puppy Universal Installer" --no-tags --stdout --menubox "Welcome to the Puppy Universal Installer!\nIf you wish to install Puppy to a removable media, such\nas a USB Flash or hard drive, CD/DVD disc, floppy disk,\nZip disk, LS-120 disk, please insert it right now,\nbefore proceeding.\n\nINSERT MEDIA NOW\nThen, choose the media that you want to install Puppy to:" 0 0 8 usbflash "USB Flash drive" usbhd "USB hard drive" usb2ideflash "USB CF Flash drive, later move CF to IDE adaptor" ideflash "IDE Flash drive (CF card in IDE adaptor)" idehd "IDE (ATA) internal hard drive" idezip "Internal (IDE) ZIP or LS120 drive" satahd "SATA internal hard drive" scsihd "SCSI internal hard drive"`"
  143. [ ! $? -eq 0 ] && exit
  144. [ "$PMEDIA" = "" ] && exit
  145.  
  146. FINALPMEDIA="$PMEDIA"
  147. if [ "$PMEDIA" = "usb2ideflash" ];then
  148.  PMEDIA="usbflash"
  149.  FINALPMEDIA="ideflash"
  150. fi
  151.  
  152. case $PMEDIA in
  153.  usbflash)
  154.   if [ "`lsmod | grep --extended-regexp '^usb\-storage|^usb_storage'`" = "" ];then
  155.    echo "Loading usb-storage module (needs several seconds)..."
  156.    USBDELAY=6
  157.    [ "`lsmod | grep '^ehci\-hcd'`" = "" ] && USBDELAY=26
  158.    modprobe usb-storage &
  159.    sleep $USBDELAY
  160.   fi
  161.   #find usb drives...
  162.   #USBDRIVES="`cat /proc/partitions | grep "sd[a-z]$" | tr -s " " | cut -f 5 -d " "`"
  163.   PROBEDISK="`probedisk 2> /tmp/probediskerr.txt`"
  164.   USBDRIVES="`echo "$PROBEDISK" | grep 'Direct\-Access' | cut -f 3 -d '/' | cut -f 1 -d '|' | tr "\n" " "`"
  165.   SELECTIONS=""
  166.   for ONEUSB in $USBDRIVES
  167.   do
  168.    USBINFO="`echo "$PROBEDISK" | grep "/dev/$ONEUSB" | head -n 1 | cut -f 3 -d '|' | tr '$' " " | tr -s " " | sed -e 's/ $//g'`"
  169.    USBSIZE="`disktype /dev/$ONEUSB | grep "Block device" | cut -f 2 -d ',' | tr -s " " | cut -f 1-4 -d " "`"
  170.    SELECTIONS="${SELECTIONS} $ONEUSB \"${USBINFO}, ${USBSIZE}\""
  171.   done
  172.   ;;
  173.  usbhd) #TODO
  174.   xmessage "Not yet implemented"
  175.   exit
  176.   ;;
  177.  ideflash)
  178.   #find ide hard drives...
  179.   PROBEDISK="`probedisk 2> /tmp/probediskerr.txt`"
  180.   HDDRIVES="`echo "$PROBEDISK" | grep '|disk|' | grep '/dev/hd' | cut -f 3 -d '/' | cut -f 1 -d '|' | tr "\n" " "`"
  181.   SELECTIONS=""
  182.   for ONEHD in $HDDRIVES
  183.   do
  184.    HDINFO="`echo "$PROBEDISK" | grep "/dev/$ONEHD" | head -n 1 | cut -f 3 -d '|' | tr '$' " " | tr -s " " | sed -e 's/ $//g'`"
  185.    HDSIZE="`disktype /dev/$ONEHD | grep "Block device" | cut -f 2 -d ',' | tr -s " " | cut -f 1-4 -d " "`"
  186.    SELECTIONS="${SELECTIONS} $ONEHD \"${HDINFO}, ${HDSIZE}\""
  187.   done
  188.   ;;
  189.  idehd)
  190.   #find ide hard drives...
  191.   PROBEDISK="`probedisk 2> /tmp/probediskerr.txt`"
  192.   HDDRIVES="`echo "$PROBEDISK" | grep '|disk|' | grep '/dev/hd' | cut -f 3 -d '/' | cut -f 1 -d '|' | tr "\n" " "`"
  193.   SELECTIONS=""
  194.   for ONEHD in $HDDRIVES
  195.   do
  196.    HDINFO="`echo "$PROBEDISK" | grep "/dev/$ONEHD" | head -n 1 | cut -f 3 -d '|' | tr '$' " " | tr -s " " | sed -e 's/ $//g'`"
  197.    HDSIZE="`disktype /dev/$ONEHD | grep "Block device" | cut -f 2 -d ',' | tr -s " " | cut -f 1-4 -d " "`"
  198.    SELECTIONS="${SELECTIONS} $ONEHD \"${HDINFO}, ${HDSIZE}\""
  199.   done
  200.   ;;
  201.  idecd)
  202.   #find ide cd drives...
  203.   PROBEDISK="`probedisk 2> /tmp/probediskerr.txt`"
  204.   HDDRIVES="`echo "$PROBEDISK" | grep '|cdrom|' | grep '/dev/hd' | cut -f 3 -d '/' | cut -f 1 -d '|' | tr "\n" " "`"
  205.   SELECTIONS=""
  206.   for ONEHD in $HDDRIVES
  207.   do
  208.    HDINFO="`echo "$PROBEDISK" | grep "/dev/$ONEHD" | head -n 1 | cut -f 3 -d '|' | tr '$' " " | tr -s " " | sed -e 's/ $//g'`"
  209.    HDSIZE="`disktype /dev/$ONEHD | grep "Block device" | cut -f 2 -d ',' | tr -s " " | cut -f 1-4 -d " "`"
  210.    SELECTIONS="${SELECTIONS} $ONEHD \"${HDINFO}, ${HDSIZE}\""
  211.   done
  212.   Xdialog --left --title "Puppy Universal Installer" --ok-label "QUIT" --msgbox "Your computer has these IDE (ATAPI) CD/DVD drives:\n$SELECTIONS \n\nHowever, you cannot install Puppy to a CD/DVD in the same way as a\nhard drive, USB Flash drive or Zip drive, as the CD/DVD is not\ndirectly writable. For the CD/DVD, you need to do what is called\n'remastering' and Puppy has a program for this, called 'Remaster\nPuppy live-CD', found in the Setup menu. This program enables\nyou to create your own custom live-CD/DVD.\nNote, you will need a new blank CD-R or DVD-R (not +R).\n\nClick button to quit..." 0 0
  213.   exit
  214.   ;;
  215.  idezip)
  216.   PROBEDISK="`probedisk 2> /tmp/probediskerr.txt`"
  217.   HDDRIVES="`echo "$PROBEDISK" | grep '|floppy|' | grep '/dev/hd' | cut -f 3 -d '/' | cut -f 1 -d '|' | tr "\n" " "`"
  218.   SELECTIONS=""
  219.   for ONEHD in $HDDRIVES
  220.   do
  221.    HDINFO="`echo "$PROBEDISK" | grep "/dev/$ONEHD" | head -n 1 | cut -f 3 -d '|' | tr '$' " " | tr -s " " | sed -e 's/ $//g'`"
  222.    HDSIZE="`disktype /dev/$ONEHD | grep "Block device" | cut -f 2 -d ',' | tr -s " " | cut -f 1-4 -d " "`"
  223.    SELECTIONS="${SELECTIONS} $ONEHD \"${HDINFO}, ${HDSIZE}\""
  224.   done
  225.   ;;
  226.  *)
  227.   xmessage "Not yet implemented"
  228.   exit
  229.   ;;
  230. esac
  231.  
  232.  
  233. echo "$SELECTIONS"
  234.  
  235. echo '#!/bin/sh' > /tmp/dlg1
  236. echo -n 'Xdialog --title "Puppy Universal Installer" --no-cancel --stdout --menubox "Choose which drive to install to:" 0 0 4' >> /tmp/dlg1
  237. echo -n "$SELECTIONS" >> /tmp/dlg1
  238. echo ' > /tmp/retval'  >> /tmp/dlg1
  239. echo 'exit $?' >> /tmp/dlg1
  240.  
  241. chmod 755 /tmp/dlg1
  242.  
  243. while [ 1 ];do #BIG LOOP
  244.  
  245. /tmp/dlg1
  246. [ ! $? -eq 0 ] && exit
  247.  
  248. DRVSEL="`cat /tmp/retval`"
  249. [ "$DRVSEL" = "" ] && exit
  250. echo "$DRVSEL"
  251.  
  252. DRVINFO="`disktype /dev/$DRVSEL`"
  253. SUPERFS="`echo "$DRVINFO" | grep "file system" | grep "^[a-zA-Z]" | tr -s " " | cut -f 1 -d " "`"
  254. DRVSIZE="`echo "$DRVINFO" | grep "Block device" | cut -f 2 -d ',' | tr -s " " | cut -f 1-4 -d " "`"
  255. DRVSIZM="`echo "$DRVSIZE" | cut -f 3 -d " "`"
  256. if [ ! "`echo "$DRVSIZE" | grep "GiB"`" = "" ];then
  257.  DRVSIZM="`dc $DRVSIZM 1000 \* p`"
  258. fi
  259. IDRVSIZM="`echo -n "$DRVSIZM" | cut -f 1 -d '.'`" #truncate to integer.
  260.  
  261. DRVMSG=""
  262. PUPINST=""
  263. if [ "$SUPERFS" ];then
  264.  fsfunc $SUPERFS #returns FSTYPE
  265.  ispupfunc $FSTYPE $DRVSEL #returns PUPVEROLD
  266.  [ ! $? -eq 0 ] && PUPINST=", Puppy version $PUPVEROLD installed"
  267.  DRVMSG="${DRVSEL}:  ${FSTYPE}, ${DRVSIZE}${PUPINST}
  268. "
  269. else
  270.  #has mbr and partitions...
  271.  echo -n "" > /tmp/pidrvmsg.txt
  272.  echo "$DRVINFO" |
  273.  while read ONELINE
  274.  do
  275.   xPARTNUM="`echo "$ONELINE" | grep '^Partition ' | tr -s " " | cut -f 1 -d ':' | cut -f 2 -d " "`"
  276.   [ ! "$xPARTNUM" = "" ] && PARTNUM="$xPARTNUM"
  277.   [ ! "$xPARTNUM" = "" ] && PARTSIZE="`echo "$ONELINE" | cut -f 2 -d ':' | tr -s " " | cut -f 2-3 -d " "`"
  278.   PARTITIONFS="`echo "$ONELINE" | grep "file system" | cut -f 1 -d " "`"
  279.   if [ "$PARTITIONFS" ];then
  280.    fsfunc $PARTITIONFS #sets FSTYPE.
  281.    #find out if partition has puppy, or has pup_xxx.sfs file...
  282.    ispupfunc $FSTYPE ${DRVSEL}${PARTNUM} #returns PUPVEROLD
  283.    [ ! $? -eq 0 ] && PUPINST=", Puppy version $PUPVEROLD installed"
  284. #   DRVMSG="${DRVMSG}${DRVSEL}${PARTNUM}: ${FSTYPE}, size ${PARTSIZE}${PUPINST}
  285. #"
  286.    echo "${DRVSEL}${PARTNUM}: ${FSTYPE}, size ${PARTSIZE}${PUPINST}" >> /tmp/pidrvmsg.txt
  287.   fi
  288.  done
  289.  
  290.  DRVMSG="`cat /tmp/pidrvmsg.txt`"
  291.  
  292. # NUMPARTS=`echo "$DRVINFO" | grep "file system" | grep "^ " | wc -l | tr -s " " | cut -f 2 -d " "`
  293. # TRYPARTS="`echo "$DRVINFO" | grep 'Partition ' | cut -f 1 -d ':' | sed -e 's/Partition//g' | tr -s " " | cut -f 2 -d " " | tr "\n" " "`"
  294. # for PARTNUM in $TRYPARTS
  295. # do
  296. #  PARTITIONFS="`echo "$DRVINFO" | grep "file system" | grep "^ " | head -n $PARTNUM | tail -n 1 | tr -s " " | cut -f 2 -d " "`"
  297. #  if [ "$PARTITIONFS" ];then
  298. #   PARTSIZE="`echo "$DRVINFO" | grep "Partition ${PARTNUM}:" | tr -s " " | cut -f 3-4 -d " "`"
  299. #   fsfunc $PARTITIONFS #sets FSTYPE.
  300. #   #find out if partition has puppy, or has pup_xxx.sfs file...
  301. #   ispupfunc $FSTYPE ${DRVSEL}${PARTNUM} #returns PUPVEROLD
  302. #   [ ! $? -eq 0 ] && PUPINST=", Puppy version $PUPVEROLD installed"
  303. #   DRVMSG="${DRVMSG}${DRVSEL}${PARTNUM}: ${FSTYPE}, size ${PARTSIZE}${PUPINST}
  304. #"
  305. #  fi
  306. # done
  307.  
  308. fi
  309.  
  310. echo "$DRVMSG"
  311.  
  312. DLGTXT=""
  313. CHOICES="`echo "$DRVMSG" | grep ':' | cut -f 1 -d ':' | tr "\n" " "`"
  314. for ONECHOICE in $CHOICES
  315. do
  316.  DLGTXT="$DLGTXT
  317.    <hbox>
  318.     <text><label>Install Puppy to ${ONECHOICE}:</label></text>
  319.     <button>
  320.      <input file>/usr/local/lib/X11/mini-icons/mini-dog.xpm</input>
  321.      <action>Exit:${ONECHOICE}</action>
  322.     </button>
  323.    </hbox>
  324. "
  325. done
  326.  
  327. DLGEXT=""
  328. if [ "`echo "$DRVMSG" | cut -f 1 -d ':' | grep "[a-zA-Z]$"`" = "" ];then
  329.  #ask if want superfloppy install...
  330.  DLGEXT="
  331.    <frame Superfloppy>
  332.    <hbox>
  333.     <text><label>WARNING: NOT NORMALLY RECOMMENDED. Do you want to install Puppy in Superfloppy mode, that is, no MBR and no partitions? ...in that case, the drive will be accessed as /dev/$DRVSEL, without a partition number. This may be a good choice for booting USB Flash drive from PC with a quirky BIOS. Click button if yes:</label></text>
  334.     <vbox>
  335.      <button>
  336.       <input file>/usr/local/lib/X11/mini-icons/mini-dog.xpm</input>
  337.       <action>Exit:REFORMAT_${DRVSEL}</action>
  338.      </button>
  339.     </vbox>
  340.    </hbox>
  341.    </frame>
  342. "
  343. else
  344.  DLGEXT="
  345.    <frame Superfloppy>
  346.    <hbox>
  347.     <text><label>The drive is currently in Superfloppy mode and has no MBR and no partitions. It is accessed as /dev/$DRVSEL, without a partition number (this may be a good choice for booting USB Flash drive from PC with a quirky BIOS). Do you want to partition the drive so that it has a /dev/${DRVSEL}1 partition, in which Puppy can be installed? If so, click button:</label></text>
  348.     <vbox>
  349.      <button>
  350.       <input file>/usr/local/lib/X11/mini-icons/mini-dog.xpm</input>
  351.       <action>Exit:REFORMAT_${DRVSEL}1</action>
  352.      </button>
  353.     </vbox>
  354.    </hbox>
  355.    </frame>
  356. "
  357. fi
  358.  
  359. DLG2="
  360.  <wtitle>Puppy Universal Installer</wtitle>
  361.  <vbox>
  362.   <text><label>Here is what Puppy has found out about the chosen drive:</label></text>
  363.   <text><label>\"${DRVMSG}\"</label></text>
  364. $DLGTXT
  365. $DLGEXT
  366.    <button>
  367.     <label>Go back and choose a different drive</label>
  368.     <action>Exit:GOBACK</action>
  369.    </button>
  370.  </vbox>
  371. "
  372.  
  373. RETTXT="`echo "$DLG2" | gtkdialog2 --stdin`"
  374.  
  375. [ ! "`echo "$RETTXT" | grep 'abort'`" = "" ] && exit
  376. [ "`echo "$RETTXT" | grep 'EXIT:GOBACK'`" = "" ] && break
  377.  
  378. done #BIG LOOP
  379.  
  380. #when arrive here, have
  381. #RETTXT="EXIT:sda1", DRVMSG="sda1: vfat, size 122.1 MiB, Puppy version 108 installed" (has all parts fnd)
  382.  
  383. #sanity check...
  384. #SANITYPART="`echo -n "$DRVMSG" | cut -f 1 -d ':'`"
  385. SANITYPART="`echo -n "$RETTXT" | grep 'EXIT' | cut -f 2 -d ':' | cut -f 2 -d '_'`"
  386. if [ ! "`mount | grep "/dev/$SANITYPART"`" = "" ];then
  387.  SANITYMSG1="$SANITYPART currently mounted, need to unmount it!!!"
  388.  SANITYMSG2="$SANITYPART currently mounted read-write."
  389.  SANITYMSG3="$SANITYPART does not have pup_save.3fs file in it."
  390.  SANITYMNTPT="`mount | grep "/dev/$SANITYPART" | tr -s " " | cut -f 3 -d " "`"
  391.  SANITYRORW="`mount | grep "/dev/$SANITYPART" | tr -s " " | cut -f 6 -d " "`"
  392.  [ ! "`echo -n "$SANITYMNTPT" | grep "/initrd/"`" = "" ] && SANITYMSG1="$SANITYPART cannot be unmounted!"
  393.  [ "$SANITYRORW" = "(ro)" ] && SANITYMSG2="$SANITYPART is mounted read-only!"
  394.  [ -f $SANITYMNTPT/pup_save.3fs ] && SANITYMSG3="$SANITYPART has personal file pup_save.3fs in it!"
  395.  Xdialog --left --title "Puppy universal installer: SANITY CHECK" --ok-label "CONTINUE" --cancel-label "QUIT" --yesno "A partition sanity check before continuing:\n$SANITYMSG1 \n$SANITYMSG2 \n$SANITYMSG3 \n\nIf the above report is that the partition is mounted, you need to unmount it\nright now, but if report is it cannot be unmounted, then there may be install\ndifficulties -- certainly, in the case of install to hard drive you will only\nbe able to do an \"option1\" install (explained further on).\nIf the partition has pup_save.3fs in it, that is the reason it cannot be\nunmounted -- it is currently in use by Puppy. If booting Puppy from live-CD,\nif pup_save.3fs does not exist then Puppy will run totally in RAM, which will\nsolve the problem -- but you should not delete or rename pup_save.3fs right\nnow as it is in use. Instead, boot some other OS then rename the file, then\nboot Puppy live-CD.\n\nBottom-line, unmount the partition now, if you can, otherwise CONTINUE script\nwith the restricted install choice, or QUIT script now and try to fix the\nproblem of the partition getting mounted..." 0 0
  396.  [ ! $? -eq 0 ] && exit
  397. fi
  398.  
  399. if [ ! "`echo "$RETTXT" | grep 'EXIT:REFORMAT'`" = "" ];then
  400.  #RETTXT will have "EXIT:REFORMAT_sda" or "EXIT:REFORMAT_sda1", depending whether
  401.  #we want to format in superfloppy mode or with a MBR and a partition...
  402.  DESTPART="`echo "$RETTXT" | grep 'EXIT:REFORMAT' | cut -f 2 -d ':' | cut -f 2 -d '_'`"
  403.  if [ "`echo "$DESTPART" | grep "[0-9]$"`" = "" ];then
  404.   #want superfloppy...
  405.   DLG3="
  406.  <wtitle>Puppy Universal Installer</wtitle>
  407.  <vbox>
  408.    <text><label>You have chosen to format /dev/${DESTPART} as a Superfloppy. You now need to choose whether to create a vfat or a ext3 filesystem on the drive. Ext3 is the most flexible (and recommended) choice, however if you need to be able to read the drive from Windows then choose vfat. Note, however, there are tools for accessing ext2/3 drives in Windows.</label></text>
  409.    <text><label>A further clarification: if you choose ext3, then the entire drive will be immediately available for personal data storage, whereas if you choose vfat this installer will have to create a file with a ext3 filesystem inside it (pup_save.3fs) -- that file will contain all your personal files. Press FORMAT_ext3 or FORMAT_vfat button to commence formatting...</label></text>
  410.   <hbox>
  411.    <button>
  412.     <label>FORMAT_ext3</label>
  413.     <action>Exit:ext3</action>
  414.    </button>
  415.    <button>
  416.     <label>FORMAT_vfat</label>
  417.     <action>Exit:vfat</action>
  418.    </button>
  419.   </hbox>
  420.  </vbox>
  421. "
  422.   RETTXT="`echo "$DLG3" | gtkdialog2 --stdin`"
  423.  
  424.   [ ! "`echo "$RETTXT" | grep 'abort'`" = "" ] && exit
  425.   DESTFS="`echo "$RETTXT" | grep 'EXIT:' | cut -f 2 -d ':'`"
  426.   echo '#!/bin/sh' > /tmp/formatsuper.sh
  427.   echo -e "echo -n \"SANITY CHECK: formatting /dev/${DRVSEL}, ENTER to continue or CTRL-C to quit: \""  >> /tmp/formatsuper.sh
  428.   echo 'read mooo'  >> /tmp/formatsuper.sh
  429.   #echo 'echo "Zeroising the entire drive..."'  >> /tmp/formatsuper.sh
  430.   #echo 'echo "(please be very patient, this could take awhile)"'  >> /tmp/formatsuper.sh
  431.   ##echo "dd if=/dev/zero bs=1024 | $BAR -of /dev/$DRVSEL -s ${IDRVSIZM}m" >> /tmp/formatsuper.sh
  432.   #echo "dd if=/dev/zero of=/dev/$DRVSEL" >> /tmp/formatsuper.sh
  433.   #no, will just zeroise the mbr section...
  434.   echo "dd if=/dev/zero of=/dev/$DRVSEL bs=512 count=1" >> /tmp/formatsuper.sh
  435.   echo 'sync'  >> /tmp/formatsuper.sh
  436.   if [ "$DESTFS" = "ext3" ];then
  437.    echo 'echo "Creating an ext3 filesystem on the drive..."'   >> /tmp/formatsuper.sh
  438.    echo -e "echo \"y\" | mke2fs -j -m 0 /dev/$DRVSEL"   >> /tmp/formatsuper.sh
  439.   else #vfat
  440.    echo 'echo "Creating a vfat filesystem on the drive..."'   >> /tmp/formatsuper.sh
  441.    echo "mkdosfs -I /dev/$DRVSEL" >> /tmp/formatsuper.sh
  442.   fi
  443.   echo 'sync'  >> /tmp/formatsuper.sh
  444.   echo 'echo -n "Press ENTER key to continue: "'   >> /tmp/formatsuper.sh
  445.   echo 'read moo'   >> /tmp/formatsuper.sh
  446.   chmod 755 /tmp/formatsuper.sh
  447.   rxvt -bg "orange" -title "Puppy Universal Installer" -geometry 80x10 -e /tmp/formatsuper.sh
  448.   DESTSIZM="$DRVSIZM"
  449.   IDESTSIZM="$IDRVSIZM"
  450.   DESTVER="" #previous version, n.a.
  451.  else
  452.   #want to partition with partition 1...
  453.   DLG3="
  454.  <wtitle>Puppy Universal Installer</wtitle>
  455.  <vbox>
  456.    <text><label>You have chosen to format /dev/${DRVSEL} with a MBR and a partition. You now need to choose whether to create a vfat or a ext3 filesystem on the partition. Ext3 is the most flexible (and recommended) choice, however if you need to be able to read the drive from Windows then choose vfat. Note, however, there are tools for accessing ext2/3 drives in Windows.</label></text>
  457.    <text><label>A further clarification: if you choose ext3, then the entire partition will be immediately available for personal data storage, whereas if you choose vfat this installer will have to create a file with a ext3 filesystem inside it (pup_save.3fs) -- that file will contain all your personal files. Press FORMAT_ext3 or FORMAT_vfat button to commence formatting...</label></text>
  458.   <hbox>
  459.    <button>
  460.     <label>FORMAT_ext3</label>
  461.     <action>Exit:ext3</action>
  462.    </button>
  463.    <button>
  464.     <label>FORMAT_vfat</label>
  465.     <action>Exit:vfat</action>
  466.    </button>
  467.   </hbox>
  468.  </vbox>
  469. "
  470.   RETTXT="`echo "$DLG3" | gtkdialog2 --stdin`"
  471.   DESTFS="`echo "$RETTXT" | grep 'EXIT:' | cut -f 2 -d ':'`"
  472.  
  473.  
  474.   echo '#!/bin/sh' > /tmp/formatmbr.sh
  475.   echo -e "echo -n \"SANITY CHECK: formatting /dev/${DRVSEL}, ENTER to continue or CTRL-C to quit: \""  >> /tmp/formatmbr.sh
  476.   echo 'read mooo'  >> /tmp/formatmbr.sh
  477.   #echo 'echo "Zeroising the entire drive..."'  >> /tmp/formatmbr.sh
  478.   #echo 'echo "(please be very patient, this could take awhile)"'  >> /tmp/formatmbr.sh
  479.   ##echo "dd if=/dev/zero bs=1024 | $BAR -of /dev/$DRVSEL -s ${IDRVSIZM}m" >> /tmp/formatmbr.sh
  480.   #echo "dd if=/dev/zero of=/dev/$DRVSEL" >> /tmp/formatmbr.sh
  481.   #no, just do the mbr...
  482.   echo 'echo "Creating the MBR (Master Boot Record)..."'  >> /tmp/formatmbr.sh
  483.   echo "dd if=/usr/lib/syslinux/mbr.bin of=/dev/$DRVSEL bs=512 count=1" >> /tmp/formatmbr.sh
  484.   echo 'sync'  >> /tmp/formatmbr.sh
  485.   #create a bootable partition...
  486.   echo 'echo "Creating a partition..."'  >> /tmp/formatmbr.sh
  487.   echo 'echo "n'  >> /tmp/formatmbr.sh
  488.   echo 'p'  >> /tmp/formatmbr.sh
  489.   echo '1'  >> /tmp/formatmbr.sh
  490.   echo  >> /tmp/formatmbr.sh
  491.   echo  >> /tmp/formatmbr.sh
  492.   #make partition bootable...
  493.   echo 'a'  >> /tmp/formatmbr.sh
  494.   echo '1'  >> /tmp/formatmbr.sh
  495.   #write and exit...
  496.   echo -n 'w"'  >> /tmp/formatmbr.sh
  497.   echo " | fdisk /dev/$DRVSEL"  >> /tmp/formatmbr.sh
  498.   echo 'echo "Copying MBR..."'  >> /tmp/formatmbr.sh
  499.   echo "dd if=/usr/lib/syslinux/mbr.bin of=/dev/$DRVSEL bs=512 count=1"  >> /tmp/formatmbr.sh
  500.   echo 'sync'  >> /tmp/formatmbr.sh
  501.   echo -e "echo \"Creating a FAT filesystem in /dev/${DRVSEL}1...\""  >> /tmp/formatmbr.sh
  502.   echo "mkdosfs /dev/${DRVSEL}1" >> /tmp/formatmbr.sh
  503.   #...this auto creates most appropriate fat f.s., so really should run fdisk set f.s. id now.
  504.   echo 'sync'  >> /tmp/formatmbr.sh
  505.   echo 'echo -n "Press ENTER key to continue: "'   >> /tmp/formatmbr.sh
  506.   echo 'read moo'   >> /tmp/formatmbr.sh
  507.  
  508.   chmod 755 /tmp/formatmbr.sh
  509.   rxvt -bg "orange" -title "Puppy Universal Installer" -geometry 80x10 -e /tmp/formatmbr.sh
  510.  
  511.   REALFS="`disktype /dev/${DRVSEL}1 | grep "file system" | cut -f 1 -d " "`"
  512.   FSID="c" #FAT32(LBA)
  513.   [ "$REALFS" = "FAT16" ] && FSID="6"
  514.   [ "$REALFS" = "FAT32" ] && FSID="b"
  515.   #f.s. id for partition... 6=FAT16 e=FAT16(LBA) c=FAT32(LBA) 83=Linux 4=FAT16<32M
  516.   echo "t
  517. $FSID
  518. w" | fdisk /dev/$DRVSEL
  519.  
  520.  fi
  521. else
  522.  DESTPART="`echo "$RETTXT" | grep 'EXIT:' | cut -f 2 -d ':'`"
  523.  DESTFS="`echo "$DRVMSG" | grep "$DESTPART" | cut -f 1 -d ',' | tr -s " " | cut -f 2 -d " "`"
  524.  DESTSIZE="`echo "$DRVMSG" | grep "$DESTPART" | tr -s " " | cut -f 4-5 -d " "`"
  525.  DESTSIZM="`echo -n "$DESTSIZE" | cut -f 1 -d " "`"
  526.  if [ ! "`echo "$DESTSIZE" | grep "GiB"`" = "" ];then
  527.   DESTSIZM="`dc $DESTSIZM 1000 \* p`"
  528.  fi
  529.  IDESTSIZM="`echo -n "$DESTSIZM" | cut -f 1 -d '.'`" #truncate to integer.
  530.  DESTVER="`echo "$DRVMSG" | grep "$DESTPART" | tr -s " " | grep "installed" | cut -f 8 -d " "`"
  531. fi
  532.  
  533.  
  534. if [ "`echo "$DESTPART" | grep "[0-9]$"`" = "" ];then
  535.  #superfloppy
  536.  DLG4="
  537.  <wtitle>Puppy Universal Installer</wtitle>
  538.  <vbox>
  539.   <text><label>You have chosen to install Puppy to the entire drive, which is what we call Superfloppy mode, in which there is no MBR (Master Boot Record) and no partitions. This may be a good choice for Flash memory, especially USB Flash, that the PC BIOS has trouble booting from.</label></text>
  540.   <text><label>The target drive is ${DESTPART}, which has a ${DESTFS}, of size ${DESTSIZM}M. Press OK button to install Puppy to the drive...</label></text>
  541.   <hbox><button ok></button><button cancel></button></hbox>
  542.  </vbox>
  543. "
  544.  RETTXT="`echo "$DLG4" | gtkdialog2 --stdin`"
  545. else
  546.  DLG4="
  547.  <wtitle>Puppy Universal Installer</wtitle>
  548.  <vbox>
  549.   <text><label>You have chosen to install Puppy to partition /dev/${DESTPART}, which has a ${DESTFS} filesystem and the size is ${DESTSIZM}M.</label></text>
  550.   <text><label>Press OK button to install Puppy (note, there will be one or two more dialog windows before you have to commit to the actual install)...</label></text>
  551.   <hbox><button ok></button><button cancel></button></hbox>
  552.  </vbox>
  553. "
  554.  RETTXT="`echo "$DLG4" | gtkdialog2 --stdin`"
  555. fi
  556.  
  557. [ ! $? -eq 0 ] && exit
  558. [ "`echo "$RETTXT" | grep 'OK'`" = "" ] && exit
  559.  
  560.  
  561.  
  562. #get latest Puppy files....
  563. SRCPATH=""
  564. CDDRIVE=""
  565. rm -f /tmp/srcpath.txt
  566. mount | tr -s " " | cut -f 3 -d " " |
  567. while read ONEDIR
  568. do
  569.  INCYES=0
  570.  [ -f $ONEDIR/pup_$NEWVER.sfs ] && INCYES=`expr $INCYES + 1`
  571.  [ -f $ONEDIR/vmlinuz ] && INCYES=`expr $INCYES + 1`
  572.  [ -f $ONEDIR/initrd.gz ] && INCYES=`expr $INCYES + 1`
  573.  if [ $INCYES -eq 3 ];then
  574.   echo -n "$ONEDIR" > /tmp/srcpath.txt
  575.   break
  576.  fi
  577. done
  578. [ -f /tmp/srcpath.txt ] && SRCPATH="`cat /tmp/srcpath.txt`"
  579. if [ "$SRCPATH" = "" ];then
  580.  Xdialog --left --buttons-style text --title "Puppy universal installer" --ok-label "CD" --cancel-label "DIRECTORY" --yesno "Puppy consists of three files:\nvmlinuz      The Linux kernel\ninitrd.gz    The initial ramdisk.\npup_$NEWVER.sfs  This has all the Puppy files.\nIf you booted Puppy from a live-CD, those three files will be on it.\nOtherwise, they are in the .iso file and can be extracted -- in that\ncase, you will need to select the directory where you have extracted\nthem to.\nPlease do NOT use a path with any spaces!!!\n\n\nWhere are the Puppy files?..." 0 0
  581.  RETVAL=$?
  582.  if [ $RETVAL -eq 0 ];then #CD
  583.   CDDRIVE="`readlink /dev/cdrom`"
  584.   CDDRIVE="`basename $CDDRIVE`"
  585.   CDDRVINFO="`probedisk | grep "/dev/$CDDRIVE" | cut -f 3 -d '|'`"
  586.   Xdialog --left --title "Puppy universal installer" --msgbox "Please insert the Puppy live-CD (if not already) into the drive.\nNote, in case your PC has two CD/DVD drives, Puppy is expecting\nthe live-CD to be inserted into $CDDRIVE, which is described as:\n $CDDRVINFO \n\nAfter inserting live-CD, click OK button..." 0 0
  587.   mkdir /mnt/$CDDRIVE 2> /dev/null
  588.   mount -t iso9660 /dev/$CDDRIVE /mnt/$CDDRIVE
  589.   if [ -f /mnt/$CDDRIVE/initrd.gz ];then
  590.    SRCPATH="/mnt/$CDDRIVE"
  591.   else
  592.    Xdialog --left --title "Puppy universal installer: ERROR" --msgbox "Sorry, Puppy is not on the CD.\nPlease mount the CD using one of the mount programs\n(see File Managers menu) then click OK button..." 0 0
  593.    RETVAL=1
  594.   fi 
  595.  fi
  596.  if [ ! $RETVAL -eq 0 ];then #DIRECTORY
  597.   SRCFPATH="`Xdialog --left --backtitle "Please find the latest Puppy files\nvmlinuz, initrd.gz and pup_$NEWVER.sfs,\nTHEN HIGHLIGHT ANY ONE OF THEM\nand click the OK button" --title "Puppy universal installer" --stdout --no-buttons --no-cancel --fselect "*" 0 0`"
  598.   [ ! $? -eq 0 ] && exit
  599.   SRCPATH="`dirname $SRCFPATH`"
  600.  fi
  601. fi
  602. #sanity check...
  603. if [ ! -f $SRCPATH/pup_$NEWVER.sfs ];then
  604.  Xdialog --left --title "Puppy universal installer: ERROR" --msgbox "Oh dear, a \"sanity check\" has failed.\nThis file: $SRCPATH/pup_$NEWVER.sfs\ndoes not exist.\nThe above is supposed to be path-to-where-puppy-files-are/pup_xxx.sfs\nwhere \"xxx\" is the latest version number.\nClick OK button to quit..." 0 0
  605.  exit
  606. fi
  607.  
  608. #find out if puppy already on dest...
  609. ispupfunc $DESTFS $DESTPART
  610. #...sets PUPVEROLD.
  611.  
  612. #now to do the actual install...
  613. case $FINALPMEDIA in
  614.  usbflash|usbhd|ideflash|idezip) #removable media, install with syslinux/extlinux
  615.  
  616.   #26mar06 JustGreg fix mbr...
  617.   if [ ! "`echo "$DESTPART" | grep '[0-9]$'`" = "" ];then #superfloppy mode has no mbr.
  618.    DESTDRV="`echo -n "$DESTPART" | cut -b 1-3`"
  619.    dd if=/dev/$DESTDRV of=/tmp/mbr446.bin bs=446 count=1
  620.    sync
  621.    if [ "`hexdump -x /tmp/mbr446.bin | tr -s " " | cut -f 2-9 -d " " | grep '[1-9a-zA-Z]'`" = "" ];then
  622.     MBRCHOICE="`Xdialog --left --title "Puppy Universal Installer" --no-cancel --stdout --menubox "The bootstrap loader code is missing from the MBR (Master Boot Record),\nmeaning that the USB drive will not boot. Please choose one of the\nfollowing to fix this. Personally, I have had success with mbr.bin." 0 0 4 sys-nopart.mbr "Bootstrap loader code, created by JustGreg" mbr.bin "From the Syslinux package" mbrfat.bin "From the makebootfat package" spb2_mbr.bin "From spblinux, created by Christian Ostheimer" `"
  623.    else
  624.     MBRCHOICE="`Xdialog --left --title "Puppy Universal Installer" --no-cancel --stdout --menubox "The MBR (Master Boot Record) in the USB drive is probably okay as-is, so choose\nthe first option. However, if you cannot get the drive to boot, and you are\nsure that the BIOS settings are not to blame and the PC is capable of booting\nfrom USB, then try one of these alternative MBRs.\nNote, if you choose to change the MBR, the old first 446 bytes (the\nbootstrap loader part) of the MBR will be backed up to /tmp/oldmbr.bin\nNote, you can install these MBRs directly, without running this\nInstaller program again: they are located in /usr/lib/syslinux,\nand you can use the dd program to copy them.\nExample: dd if=spb2_mbr.bin of=/dev/${DESTDRV}\nNote, personally I have had success with mbr.bin." 0 0 5 default "DO NOTHING, leave current MBR alone" sys-nopart.mbr "Bootstrap loader code, created by JustGreg" mbr.bin "From the Syslinux package" mbrfat.bin "From the makebootfat package" spb2_mbr.bin "From spblinux, created by Christian Ostheimer" `"
  625.    fi
  626.    rm /tmp/mbr446.bin
  627.    if [ ! "$MBRCHOICE" = "" ];then
  628.     if [ ! "$MBRCHOICE" = "default" ];then
  629.      dd if=/dev/$DESTDRV of=/tmp/oldmbr.bin bs=446 count=1
  630.      sync
  631.      dd if=/usr/lib/syslinux/$MBRCHOICE of=/dev/$DESTDRV
  632.      sync
  633.     fi
  634.    fi
  635.   fi
  636.  
  637.   case $DESTFS in
  638.    vfat)
  639.      if [ ! "`echo "$DESTPART" | grep '[0-9]$'`" = "" ];then
  640.       PARTCHOICE="`Xdialog --left --title "Puppy Universal Installer" --no-cancel --stdout --menubox "Please just accept the default here, 'JUST KEEP GOING'.\nPLEASE MAKE SURE TOP ENTRY HIGHLIGHTED THEN CLICK OK BUTTON\n\nHowever, if you have tried this Puppy Universal Installer\nbut Puppy will not boot, you can try one of the other choices here.\n\nPersonally, I have had success with using GParted to wipe and\nrecreate the partition..." 0 0 4 default "JUST KEEP GOING" GParted "Wipe and recreate USB/IDE-CF partition using GParted" syslinux "Make USB or IDE-CF msdos/vfat partition bootable"`"
  641.       [ "$PARTCHOICE" = "syslinux" ] && fixusbfunc $DESTPART $DESTFS
  642.       [ "$PARTCHOICE" = "GParted" ] && gpartedfixusbfunc $DESTPART $DESTFS
  643.      fi
  644.     #params passed in: $DESTPART "$SRCPATH" $FINALPMEDIA
  645.     echo '#!/bin/sh
  646. DESTPART="$1"
  647. SRCPATH="$2"
  648. FINALPMEDIA="$3"
  649. echo "ABSOLUTE FINAL SANITY CHECK!"
  650. echo "You are about to install Puppy to /dev/$DESTPART, with boot parameter"
  651. echo "PMEDIA=$FINALPMEDIA. The files vmlinuz, initrd.gz, pup_xxx.sfs, syslinux.cfg"
  652. echo "will be written to /dev/$DESTPART and Syslinux will be used to make it bootable."
  653. echo
  654. echo -n "Press ENTER key to continue, CTRL-C to abort: "
  655. read goforit
  656. echo "Making $DESTPART bootable..."
  657. syslinux  /dev/$DESTPART
  658. sync
  659. #remove old puppy1 files...
  660. mount -t vfat /dev/$DESTPART /mnt/data
  661. if [ -f /mnt/data/pup100 ];then
  662.  echo "Whoa, $DESTPART has pup100 file on it. This has to be erased."
  663.  echo "Press ENTER key only to continue, else any other letter then"
  664.  echo -n "press ENTER to abort installation of Puppy: "
  665.  read isnogo
  666.  if [ ! "$isnogo" = "" ];then
  667.   sync
  668.   umount /dev/$DESTPART
  669.   exit
  670.  fi
  671.  rm -f /mnt/data/pup100
  672. fi
  673. rm -f /mnt/data/image.gz 2> /dev/null
  674. rm -f /mnt/data/usr_cram.fs 2> /dev/null
  675. sync
  676. echo "Copying vmlinuz..."
  677. cp -f $SRCPATH/vmlinuz /mnt/data/
  678. sync
  679. echo "Creating syslinux.cfg..."
  680. if [ "$FINALPMEDIA" = "ideflash" ];then
  681.  echo "default vmlinuz root=/dev/ram0 initrd=initrd.gz ide=nodma PMEDIA=$FINALPMEDIA" > /mnt/data/syslinux.cfg
  682. else
  683.  echo "default vmlinuz root=/dev/ram0 initrd=initrd.gz PMEDIA=$FINALPMEDIA" > /mnt/data/syslinux.cfg
  684. fi
  685. sync
  686. echo "Creating marker file for wakepup boot floppy..."
  687. [ "$FINALPMEDIA" = "usbflash" ] && touch /mnt/data/USBFLASH
  688. [ "$FINALPMEDIA" = "ideflash" ] && touch /mnt/data/IDEFLASH
  689. [ "$FINALPMEDIA" = "usbhd" ] && touch /mnt/data/USBHD
  690. [ "$FINALPMEDIA" = "idezip" ] && touch /mnt/data/IDEZIP
  691. sync
  692. echo "Copying initrd.gz..."
  693. cp -f $SRCPATH/initrd.gz /mnt/data/
  694. sync
  695. echo "Copying .sfs files..."
  696. cp -f $SRCPATH/*.sfs /mnt/data/
  697. sync
  698. umount /mnt/data
  699. echo -n "Finished, press ENTER key to continue: "
  700. read moo
  701. ' > /tmp/installpup.sh
  702.     chmod 755 /tmp/installpup.sh
  703.     rxvt -bg "orange" -title "Puppy Universal Installer" -geometry 80x10 -e /tmp/installpup.sh $DESTPART $SRCPATH $FINALPMEDIA
  704.     ;;
  705.    ext3)
  706.     #params passed in: $DESTPART "$SRCPATH" $FINALPMEDIA
  707.     echo '#!/bin/sh
  708. DESTPART="$1"
  709. SRCPATH="$2"
  710. FINALPMEDIA="$3"
  711. echo "ABSOLUTE FINAL SANITY CHECK!"
  712. echo "You are about to install Puppy to /dev/$DESTPART, with boot parameter"
  713. echo "PMEDIA=$FINALPMEDIA. The files vmlinuz, initrd.gz, pup_xxx.sfs, extlinux.conf"
  714. echo "will be written to /dev/$DESTPART and Extlinux will be used to make it bootable."
  715. echo
  716. echo -n "Press ENTER key to continue, CTRL-C to abort: "
  717. read goforit
  718. mount -t ext3 /dev/$DESTPART /mnt/data
  719. echo "Making $DESTPART bootable..."
  720. #extlinux -z /mnt/data 
  721. extlinux /mnt/data #i think only use -z for superfloppy.
  722. sync
  723. echo "Copying vmlinuz..."
  724. cp -f $SRCPATH/vmlinuz /mnt/data
  725. sync
  726. echo "Creating extlinux.conf..."
  727. if [ "$FINALPMEDIA" = "ideflash" ];then
  728.  echo "default vmlinuz root=/dev/ram0 initrd=initrd.gz ide=nodma PMEDIA=$FINALPMEDIA" > /mnt/data/extlinux.conf
  729. else
  730.  echo "default vmlinuz root=/dev/ram0 initrd=initrd.gz PMEDIA=$FINALPMEDIA" > /mnt/data/extlinux.conf
  731. fi
  732. sync
  733. #note do not create wakepup marker file as it only boots msdsos/vfat.
  734. echo "Copying initrd.gz..."
  735. cp -f $SRCPATH/initrd.gz /mnt/data
  736. sync
  737. echo "Copying .sfs files..."
  738. cp -f $SRCPATH/*.sfs /mnt/data
  739. sync
  740. umount /mnt/data
  741. echo -n "Finished, press ENTER key to continue: "
  742. read moo
  743. ' > /tmp/installpup.sh
  744.     chmod 755 /tmp/installpup.sh
  745.     rxvt -bg "orange" -title "Puppy Universal Installer" -geometry 80x10 -e /tmp/installpup.sh $DESTPART $SRCPATH $FINALPMEDIA
  746.     ;;
  747.    *)
  748.     xmessage "Your $DESTPART has a $DESTFS filesystem. Currently only install
  749. to external vfat (FAT16/32) or ext3 filesystems is supported.
  750. Click OK to quit..."
  751.     exit
  752.     ;;
  753.   esac
  754.   ;;
  755.  scsihd|idehd|satahd) #internal media, boot with boot-disk or grub.
  756.   #arrive here with DESTPART & DESTFS where installing to, PMEDIA boot param FINALPMEDIA,
  757.   #SRCPATH where to get vmlinuz, initrd, pup_xxx.sfs, PUPVEROLD is old puppy version in
  758.   #format 200 (without dots) =0 if no prior installed puppy,
  759.   #NEWVER is new puppy version, DESTSIZM is size of dest partition in Mb (real number),
  760.   DESTMNTPT="`mount | grep "/dev/$DESTPART" | tr -s " " | cut -f 3 -d " "`"
  761.   if [ "$DESTMNTPT" = "" ];then
  762.    mkdir /mnt/$DESTPART 2> /dev/null
  763.    mount -t $DESTFS /dev/$DESTPART /mnt/$DESTPART
  764.    DESTMNTPT="/mnt/$DESTPART"
  765.   fi
  766.  
  767.   #choose option1 or option2 install...
  768.   #option1: files vmlinuz, initrd.gz, pup_xxx.sfs, to dest partition.
  769.   #option2: file vmlinuz to partition, contents of pup_xxx.sfs to partition.
  770.   if [ $PUPVEROLD -eq 0 ];then
  771.    PREVPUPMSG="It appears that this is a new installation."
  772.   else
  773.    PREVPUPMSG="There appears to be an existing installation of Puppy, version $PUPVEROLD,
  774. and you may choose to upgrade or totally replace."
  775.   fi
  776.   INSTOPTION="1"
  777.   if [ ! "$DESTFS" = "vfat" ];then
  778.    Xdialog --left --buttons-style text --title "Puppy Universal Installer" --ok-label "NORMAL" --cancel-label "COEXIST" --yesno "You have chosen to install to /dev/$DESTPART, which appears to be an internal\nhard drive ($FINALPMEDIA).\n$PREVPUPMSG \n\nYou have two ways to install Puppy to the partition, either by what we call\n\"option1\", which means copy the files vmlinuz, initrd.gz, and pup_$NEWVER.sfs to the\npartition, leaving the previous contents of the partition untouched (good\nchoice if there is already another distro installed in the partition -- Puppy\ncan coexist with it, not interfere with it at all.\n\nOr, choose \"option2\" which is a \"normal\" Linux installation, requiring usage\nof the entire partition by Puppy. This choice is recommended by developers\n(anyone who wants to compile or develop/test applications for Puppy).\nIn fact, option2 is the recommended option for everyone, if the $DESTPART\npartition is available for Puppy to take over.\n\nNote, for option2 you can create either or both floppy/usb boot disk and/or\nh.d. Grub bootloader, but option1 only offers a floppy boot disk boot method.\nTHE OPTION1 BOOT DISK WILL ONLY BOOT PUPPY IN A FAT PARTITION!!!\n\nDo you want to install Puppy like a normal Linux distro (option2)?\n\nClick NORMAL button for normal Linux install (option2)...\nClick COEXIST button for coexist type of install (option1)...\nClick window close box to quit..." 0 0
  779.    RET_VAL=$?
  780.    [ $RET_VAL -eq 255 ] && exit
  781.    [ $RET_VAL -eq 0 ] && INSTOPTION="2"
  782.   fi
  783.  
  784.   #INSTOPTION, install puppy to DESTPART...
  785.   if [ "$INSTOPTION" = "1" ];then
  786.    Xdialog --title "Puppy Universal Installer" --msgbox "Please wait, copying files to $DESTPART..." 0 0 &
  787.    XPID=$!
  788.    cp -f $SRCPATH/vmlinuz $DESTMNTPT/
  789.    sync
  790.    cp -f $SRCPATH/initrd.gz $DESTMNTPT/
  791.    sync
  792.    cp -f $SRCPATH/*_$NEWVER.sfs $DESTMNTPT/
  793.    sync
  794.    touch $DESTMNTPT/$FINALPMEDIA #needed by WakePup
  795.    sync
  796.    kill $XPID
  797.    umount /dev/$DESTPART
  798.    if [ ! "`echo -n "$DESTFS" | grep --extended-regexp 'msdos|vfat'`" = "" ];then
  799.    
  800. #    Xdialog --left --title "Puppy Universal Installer" --ok-label "CREATE_BOOT_DISK" --cancel-label "NO_BOOT_DISK" --yesno "
  801. #A floppy disk can be used to boot Puppy.\nPLEASE INSERT THE FLOPPY DISK RIGHT NOW.\n(anything on the floppy disk will be wiped)\nBE SURE THAT THE FLOPPY DISK IS NOT CURRENTLY MOUNTED." 0 0
  802. #    if [ $? -eq 0 ];then
  803. #     echo '#!/bin/sh
  804. #     SRCPATH="$1"
  805. #     FINALPMEDIA="$2"
  806. #     DESTPART="$3"
  807. #     while [ 1 ];do
  808. #      BOOTPART=""
  809. #      [ ! "`disktype /dev/fd0 | grep "file system"`" = "" ] && BOOTPART="fd0"
  810. #      if [ ! "$BOOTPART" = "" ];then
  811. #       echo "Creating $BOOTPART boot disk..."
  812. #       echo "Writing /lib/fdos2pup.img disk image..."
  813. #       gunzip -c /lib/fdos2pup.img.gz | dd of=/dev/fd0
  814. #       sync
  815. #       echo "Creating config.sys on floppy drive..."
  816. #       echo "SHELL=a:tiny.exe c:\vmlinuz c:\initrd.gz root=/dev/ram0 PMEDIA=$FINALPMEDIA" > /tmp/config.sys
  817. #       echo
  818. #       echo "PLEASE NOTE, Puppy now uses 2.6 kernel, which does not fit on a floppy."
  819. #       echo "PLEASE NOTE, this is the content of config.sys:"
  820. #       cat /tmp/config.sys
  821. #       echo
  822. #       echo "It should be okay as it is, however Puppy cannot guess the drive-letters"
  823. #       echo "that Windows/DOS assigns to partitions. You can see above that initrd.gz and"
  824. #       echo "vmlinuz are expected to be in the C: partition, which is normally equivalent"
  825. #       echo "to hda1 in Linux notation. You have chosen to install to $DESTPART, and if this"
  826. #       echo "is something other than hda1 then you have to figure out a suitable drive"
  827. #       echo "letter -- a wild guess is it may be the D: partition -- in such a case,"
  828. #       echo "you will have to edit config.sys."
  829. #       echo "(Note, if choose to edit config.sys here, an editor will pop up, and you"
  830. #       echo " will have to exit from it before this installer program can continue)"
  831. #       echo "Press ENTER key only to accept config.sys as-is,"
  832. #       echo -n "or any letter key then ENTER to edit config.sys: "
  833. #       read nonono
  834. #       if [ ! "$nonono" = "" ];then
  835. #        gtk-shell -t "Editing file config.sys" -ef "/tmp/config.sys"
  836. #       fi
  837. #       sync
  838. #       echo "Copying config.sys to floppy..."
  839. #       mcopy -o /tmp/config.sys a:
  840. ##       echo "Copying vmlinuz to floppy drive..."
  841. ##       mcopy $SRCPATH/vmlinuz a:
  842. #       #cp -f $SRCPATH/vmlinuz $DESTMNTPT/
  843. #       sync
  844. #       rm -f /tmp/config.sys
  845. #       echo "...done"
  846. #       echo
  847. #       echo "If any errors writing to boot disk, or you want to make another boot"
  848. #       echo "disk, insert it RIGHT NOW, then press any letter key then ENTER key,"
  849. #       echo -n "or press ENTER key only when done: "
  850. #       read moodoo
  851. #       [ "$moodoo" = "" ] && break
  852. #      else
  853. #       echo -n "Please insert floppy disk now, then press ENTER key: "
  854. #       read moodoo
  855. #      fi
  856. #     done
  857. #' > /tmp/installpup.sh
  858. #     chmod 755 /tmp/installpup.sh
  859. #     rxvt -bg "orange" -title "Puppy Universal Installer" -geometry 80x17 -e /tmp/installpup.sh $SRCPATH $FINALPMEDIA $DESTPART
  860.  
  861.     Xdialog --left --title "Puppy Universal Installer" --ok-label "CREATE_BOOT_DISK" --cancel-label "NO_BOOT_DISK" --yesno "A floppy disk can be used to boot Puppy.\nCurrently we are offering WakePup2, a generic boot floppy\nthat scans the PC and finds where Puppy is installed." 0 0
  862.     if [ $? -eq 0 ];then
  863.      /usr/sbin/wakepup2
  864.     fi
  865.    else
  866.     Xdialog --left --title "Puppy Universal Installer" --msgbox "NOTICE: As you have installed to a partition with a $DESTFS filesystem,\nwhich is non-FAT, you cannot create a boot floppy disk. The only option\nleft is to manually setup your Grub or Lilo or other boot system. Note,\nthere are other boot floppy systems that can boot a non-FAT partition.\nNote, partition $DESTPART has the files vmlinuz, initrd.gz and\npup_$NEWVER.sfs on it, where vmlinuz is the kernel and initrd.gz is the\ninitial ramdisk. You should provide the boot parameter 'PMEDIA=idehd' if\n$DESTPART is an ide drive." 0 0
  867.    fi
  868.    #finished. could put up a final dlg here, then quit script.
  869.    Xdialog --title "Puppy Universal Installer" --msgbox "Okay, all done!" 0 0
  870.   else
  871.    #upgrade, ask if want delete partition...
  872.    if [ ! $PUPVEROLD -eq 0 ];then
  873.     Xdialog --left --buttons-style text --title "Puppy Universal Installer" --ok-label "UPGRADE" --cancel-label "WIPE" --yesno "There is already a version of Puppy installed in $DESTPART.\nDo you want to upgrade, or totally wipe the partition?\n\nFINAL SANITY CHECK: ARE YOU SURE $DESTPART IS THE RIGHT PARTITION?\n(note, $DESTPART is currently mounted on $DESTMNTPT -- okay?)\n\nSelect UPGRADE button to upgrade...\nSelect WIPE button to wipe partition...\nClick window Close box to quit..." 0 0
  874.     RET_VAL=$?
  875.     if [ $RET_VAL -eq 255 ];then
  876.      rox -D "$DESTMNTPT"
  877.      sync
  878.      umount $DESTMNTPT 2>/dev/null
  879.      exit
  880.     fi
  881.     if [ $RET_VAL -eq 1 ];then #no
  882.      Xdialog --title "Puppy Universal Installer" --no-buttons --infobox "Please wait, wiping all files in $DESTPART..." 0 0 50000 &
  883.      XPID=$!
  884.      sleep 3
  885.      rm -rf $DESTMNTPT/*
  886.      sync
  887.      kill $XPID
  888.     fi
  889.    fi
  890.    Xdialog --title "Puppy Universal Installer" --no-buttons --infobox "Please wait, copying Puppy files to $DESTPART..." 0 0 120000 &
  891.    XPID=$!
  892.    sleep 1
  893.    #loop-device mount pup_xxx.sfs in DESTPART, copy contents of pup_xxx.sfs to DESTPART...
  894.    losetup-FULL /dev/loop2 $SRCPATH/pup_$NEWVER.sfs
  895.    mkdir $DESTMNTPT/srcmntpt
  896.    mount -r -t squashfs /dev/loop2 $DESTMNTPT/srcmntpt
  897.    cp -a -u --remove-destination $DESTMNTPT/srcmntpt/bin $DESTMNTPT/
  898.    cp -a -u --remove-destination $DESTMNTPT/srcmntpt/dev $DESTMNTPT/
  899.    cp -a -u --remove-destination $DESTMNTPT/srcmntpt/etc $DESTMNTPT/
  900.    cp -a -u --remove-destination $DESTMNTPT/srcmntpt/lib $DESTMNTPT/
  901.    cp -a -u --remove-destination $DESTMNTPT/srcmntpt/mnt $DESTMNTPT/
  902.    cp -a -u --remove-destination $DESTMNTPT/srcmntpt/proc $DESTMNTPT/
  903.    cp -a -u --remove-destination $DESTMNTPT/srcmntpt/root $DESTMNTPT/
  904.    cp -a -u --remove-destination $DESTMNTPT/srcmntpt/sbin $DESTMNTPT/
  905.    cp -a -u --remove-destination $DESTMNTPT/srcmntpt/tmp $DESTMNTPT/
  906.    cp -a -u --remove-destination $DESTMNTPT/srcmntpt/usr $DESTMNTPT/
  907.    cp -a -u --remove-destination $DESTMNTPT/srcmntpt/var $DESTMNTPT/
  908.    mkdir $DESTMNTPT/sys 2>/dev/null
  909.    sync
  910.    kill $XPID
  911.    #fix space optimisation links into initrd...
  912.     #TODO
  913.    #chroot to DESTPART, set /etc/puppyversion back to PUPVEROLD, run rc.update
  914.    Xdialog --title "Puppy Universal Installer" --no-buttons --infobox "Please wait, executing rc.update script..." 0 0 60000 &
  915.    XPID=$!
  916.    sleep 2
  917.    echo -n "$PUPVEROLD" > $DESTMNTPT/etc/puppyversion #set it back to what it was.
  918.    
  919.    #chroot $DESTMNTPT -c /etc/rc.d/rc.update option2hdinstall
  920.    #busybox chroot does not have -c ...
  921.    chroot $DESTMNTPT /etc/rc.d/rc.update option2hdinstall
  922.    #(need to tell rc.update where src files are, as passed param)
  923.    sync
  924.     mv -f $DESTMNTPT/etc/fstab $DESTMNTPT/etc/fstab.bak
  925.     echo "/dev/$DESTPART     /            $DESTFS     defaults               0 1" > $DESTMNTPT/etc/fstab
  926.     echo "none          /proc        proc     defaults               0 0" >> $DESTMNTPT/etc/fstab
  927.     echo "none          /sys         sysfs    defaults               0 0" >> $DESTMNTPT/etc/fstab
  928.     echo "none          /dev/pts     devpts   gid=2,mode=620         0 0" >> $DESTMNTPT/etc/fstab
  929.     echo "/dev/fd0      /mnt/floppy  auto     noauto,rw              0 0" >> $DESTMNTPT/etc/fstab
  930.     echo "/dev/cdrom    /mnt/cdrom   iso9660  noauto,ro              0 0" >> $DESTMNTPT/etc/fstab
  931.     sync
  932.    kill $XPID
  933.    umount $DESTMNTPT/srcmntpt
  934.    rmdir $DESTMNTPT/srcmntpt
  935.   fi
  936.  
  937.   #make bootable...
  938.   #usb/floppy boot disk, or grub.
  939.   while [ "$INSTOPTION" = "2" ];do
  940. #TODO needs work, as could have usb hd, that cannot unplug and do not want it to be turned
  941. #     into a boot disk!...
  942.    Xdialog --left --buttons-style text --title "Puppy Universal Installer" --ok-label "Boot from USB" --cancel-label "Install GRUB" --yesno "If all went well, Puppy has been installed to $DESTPART.\n\
  943. But, now we have the sometimes-difficult part, how to make Puppy bootable.\n\
  944. You can do one, or both, of these:\n\
  945. \n\
  946. Boot disk: Use a floppy disk or USB pen drive to boot Puppy.\n\
  947. GRUB:      Install GRUB in the hard drive.\n\
  948. \n\
  949. If you already have GRUB installed in the hard drive, you can choose the\n\
  950. GRUB option here and reinstall it with Puppy added to the boot menu.\n\
  951. \n\
  952. Click 'Boot from USB' if you want to sacrifice a usb Flash pen drive as a\n\
  953. 'boot disk'. This Universal Installer script will return to this dialog\n\
  954. window after creating the USB 'boot disk'.\n\
  955. Note, you would probably only choose this if your PC does not have a floppy\n\
  956. drive and you do not want to install GRUB to the hard drive.\n\
  957. \n\
  958. Click 'Install GRUB' to install the GRUB boot manager. You will be given the\n\
  959. opportunity to create a floppy 'boot disk' as well as install GRUB to the\n\
  960. hard drive.\n\
  961. \n\
  962. FOR USB BOOT DISK CHOICE, PLEASE INSERT IT RIGHT NOW BEFORE PROCEEDING!\n\
  963.  (any files in it will be deleted)\n\
  964.  IT MUST ALSO BE UNMOUNTED -- BE SURE BEFORE PROCEEDING" 0 0
  965.    if [ $? -eq 0 ];then #BOOT DISK
  966.     BOOTPART=""
  967.     [ ! "`disktype /dev/sda | grep "file system" | grep "^FAT"`" = "" ] && BOOTPART="sda"
  968.     [ ! "`disktype /dev/sda1 | grep "file system" | grep "^FAT"`" = "" ] && BOOTPART="sda1"
  969.     [ ! "`disktype /dev/sdb | grep "file system" | grep "^FAT"`" = "" ] && BOOTPART="sdb"
  970.     [ ! "`disktype /dev/sdb1 | grep "file system" | grep "^FAT"`" = "" ] && BOOTPART="sdb1"
  971.     [ ! "`disktype /dev/sdc | grep "file system" | grep "^FAT"`" = "" ] && BOOTPART="sdc"
  972.     [ ! "`disktype /dev/sdc1 | grep "file system" | grep "^FAT"`" = "" ] && BOOTPART="sdc1"
  973. #    [ ! "`disktype /dev/fd0 | grep "file system" | grep "^FAT"`" = "" ] && BOOTPART="fd0"
  974.     if [ ! "$BOOTPART" = "" ];then
  975.      Xdialog --left --title "Puppy Universal Installer" --yesno "Please confirm that you want to make '$BOOTPART' into a boot disk for Puppy.\nNote, be extremely careful here if you have a USB hard drive or SATA hard\ndrive, as these have the same 'sd' device notation as a removable Flash pen\ndrive. If Puppy has mis-identified the device, then answer 'No' here...\n\nClick 'Yes' button if correct device..." 0 0
  976.      [ ! $? -eq 0 ] && continue
  977.     fi
  978.     if [ ! "$BOOTPART" = "" ];then
  979.      cp -af $SRCPATH/vmlinuz /mnt/$DESTPART/
  980.      sync
  981.      Xdialog --title "Puppy Universal Installer" --msgbox "Creating $BOOTPART boot disk..." 0 0 &
  982.      XPID=$!
  983.      #passed params $BOOTPART $DESTPART $SRCPATH $FINALPMEDIA
  984.      echo '#!/bin/sh
  985.      BOOTPART="$1"
  986.      DESTPART="$2"
  987.      SRCPATH="$3"
  988.      FINALPMEDIA="$4"
  989.       echo "Making the /dev/$BOOTPART bootable using Syslinux..."
  990.       syslinux /dev/$BOOTPART
  991.       mkdir /tmp/bootdiskmntpt 2> /dev/null
  992.       mount -t msdos /dev/$BOOTPART /tmp/bootdiskmntpt
  993.       rm -rf /tmp/bootdiskmntpt/*
  994.       echo "Creating syslinux.cfg on /dev/$BOOTPART..."
  995.       echo "default vmlinuz root=/dev/$DESTPART PMEDIA=$FINALPMEDIA" > /tmp/bootdiskmntpt/syslinux.cfg
  996.       echo "Writing the Linux kernel, vmlinuz, to /dev/$BOOTPART..."
  997.       cp -f $SRCPATH/vmlinuz /tmp/bootdiskmntpt/
  998.       sync
  999.       umount /dev/$BOOTPART
  1000.       rmdir /tmp/bootdiskmntpt
  1001.      sync
  1002.      echo -n "Done. Press ENTER key: "
  1003.      read allisdone
  1004. ' > /tmp/installpup.sh
  1005.      chmod 755 /tmp/installpup.sh
  1006.      rxvt -bg "orange" -title "Puppy Universal Installer" -geometry 80x10 -e /tmp/installpup.sh $BOOTPART $DESTPART $SRCPATH $FINALPMEDIA
  1007.  
  1008.      kill $XPID
  1009.     fi
  1010.    else #Grub
  1011.     mkdir -p /mnt/$DESTPART/boot/grub
  1012.     cp -af $SRCPATH/vmlinuz /mnt/$DESTPART/boot/
  1013.     sync
  1014.     umount /mnt/$DESTPART
  1015.     Xdialog --left --title "Puppy Universal Installer" --msgbox "The \"grubconfig\" script is about to be executed.\nJust accept the defaults. The very first question will ask if you\nwant to do a simple installation, and you accept that option, which\nis the default. The only place where I suggest you deviate from the\ndefault, is when it asks where to install Grub, choose \"MBR\"." 0 0
  1016.     unmountcdfunc
  1017.     while [ 1 ];do
  1018.      grubconfig /dev/$DESTPART
  1019.      #...if choose to create a boot floppy, writes 'no' to /tmp/loopbrk.txt.
  1020.      Xdialog --title "Universal Installer" --yesno "If you have already run grubconfig to create a boot floppy or installed\n\
  1021. to h.d., click 'Yes' button to rerun grubconfig script to either create\n\
  1022. another boot floppy or install or reinstall GRUB to the hard drive.\n\
  1023. If choose 'Yes', just accept all the defaults as before.\n\
  1024. \n\
  1025. Click 'Yes' to rerun grubconfig...\n\
  1026. Click 'No' if installation finished..." 0 0
  1027.      [ ! $? -eq 0 ] && break
  1028.     done
  1029.     rm -f /tmp/loopbrk.txt
  1030.     exit
  1031.    fi
  1032.    Xdialog --title "Puppy Universal Installer" --yesno "Do you want to go back and create another boot disk or Grub boot?..." 0 0
  1033.    [ ! $? -eq 0 ] && break
  1034.   done
  1035.   umount /mnt/$DESTPART 2> /dev/null
  1036.   ;;
  1037.  idecd|scsicd|usbcd)
  1038.   xmessage "not yet implemented"
  1039.   #TO DO
  1040.   ;;
  1041. esac
  1042.  
  1043. unmountcdfunc
  1044.  
  1045. ###END###
  1046.