puppyinstaller 86 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718
  1. #!/bin/sh
  2. #(c) Copyright Barry Kauler 2006 www.puppylinux.com
  3. #2007 Lesser GPL licence v2 (/usr/share/doc/legal/lgpl-2.1.txt)
  4. # BK july 2007:
  5. #/usr/sbin/puppyinstaller-217 is heavily modified by Dougal (based on
  6. # puppyinstaller from v2.14). Was used in 216 and 217.
  7. #/usr/sbin/puppyinstaller-bk is the v2.14 one with minimal mods. for 2.17.1+
  8. #aug 2007 updated for 2.20: 'root=/dev/ram0' removed as using initramfs.
  9. #v3.94 BK dec 2007: no longer any hd* drives.
  10. #v3.95 BK jan 2008: handle Classmate laptop.
  11. #v3.96 BK jan 2008: improvements for full hd install, warning about drive nums.
  12. #v3.97 BK feb 2008: fully support /dev/hd* notation for ide drives.
  13. #v3.97 BK feb 2008: fix mbr recognition error in flash pen drive.
  14. #v3.97 BK feb 2008: new ComboFormat installation for Flash drives.
  15. #v3.98 BK mar 2008: bugfix for install to idehd or satahd.
  16. #v4.02 /lib/modules/firmware.dep.<kern>,DOTconfig-K<kern> moved to /etc/modules. ...um, no mods this script.
  17. #v404 usb install, now have 'pfix=copy'. bugfix extlinux now needs '-i'.
  18. #v412 /etc/DISTRO_SPECS, renamed pup_xxx.sfs, pup_save.2fs etc.
  19. #w013, w015 march 2009: updated for Woof.
  20. #w460 zdrv has new name format, ex zu500269.sfs.
  21. #w464, w478 checking /etc/puppyversion is history.
  22. #w482 fix handling if separate zdrv file.
  23. #w482 copy modules from 'initrd' folder to full hd install.
  24. #v423 kirk: ext4 support.
  25. #v424 coolpup: removed the '*' from ${DISTRO_FILE_PREFIX}-${NEWVER}*.sfs, tidyup pidof.
  26. #v425 tentative support for install to scsi hd.
  27. #v430 full hd install, wipe all, rc.update was not running properly.
  28. #091211 modified to work with GRUB4DOS and shinobar's grub4dosconfig.
  29. #100113 TARGETEXES has files that got copied from initrd. ditto /lib/keymaps, /lib/consolefonts.
  30. #100207 gecko edubook, disktype sees internal sd as both partitions and a superfloppy.
  31. #100321 Now have boot menu for installations that use Syslinux/Extlinux.
  32. #100412 Fix from EdV: prevent display irrelevant partitions.
  33. #100719 warning frugal, do not install to folder if want save session to entire partition.
  34. #100720 removed 'nosmp' kernel boot param.
  35. #100913 new simplified puppy filenames.
  36. #100916 no longer have DISTRO_DEVXSFS in /etc/DISTRO_SPECS.(it was only there briefly)
  37. #100916 a second help screen at bootup, file help2.msg.
  38. #101107 fix frugal install, puppy now searches 2-deep.
  39. #101221 yaf-splash fix.
  40. #110126 no longer using SATADRIVES variable in /etc/rc.d/PUPSTATE. support install to card, /dev/mmcblk*. remove zip/ls120 install.
  41. #110422 DISTRO_VERSION variable now has dotted format. note, also now using full dotted version# in puppy filenames.
  42. #110505 support sudo for non-root user.
  43. #110814 convert script from gtkdialog2 to gtkdialog3+.
  44. #111011 bump to gtkdialog4. small fixes.
  45. #120126 jemimah: clear SELECTIONS variable, add ntfs exclusion.
  46. #120202 rodin.s: internationalized
  47. #120310 npierce: fix some grep operations.
  48. #120323 replace 'xmessage' with 'pupmessage'.
  49. #120329 Xdialog bug --yesno supposed to "yes" "No" buttons, but they are "OK" "Cancel".
  50. #120823 rerwin: preserve user-modified files in full-install upgrade.
  51. #121116 LANG extraction was broken.
  52. #130128 handle 'udf' f.s. (see also pmount, pup_event_frontend_d, drive_all, probepart).
  53. #130203 change probedisk2 to probedisk.
  54. #130216 partial support f2fs.
  55. #130526 npierce: fix for GPT partitions. ref: http://www.murga-linux.com/puppy/viewtopic.php?p=704919#704919
  56. #130613 /run is required by eudev. full-hd-install, always ask wipe partition, may need create /dev/console, /dev/null.
  57. #130722 new method to update desktop drive icons. see also /usr/sbin/gparted_shell, bootflash.
  58. [ "`whoami`" != "root" ] && exec sudo -A ${0} ${@} #110505
  59. export TEXTDOMAIN=puppyinstaller
  60. export OUTPUT_CHARSET=UTF-8
  61. . gettext.sh
  62. export LANGORG="$(locale | grep '^LANG=' | cut -d '=' -f 2)" #121116
  63. Yes_lbl="$(gettext 'Yes')"
  64. No_lbl="$(gettext 'No')"
  65. GTKDIALOGEXE="`which gtkdialog4`"
  66. [ ! "$GTKDIALOGEXE" ] && GTKDIALOGEXE="`which gtkdialog`"
  67. [ ! "$GTKDIALOGEXE" ] && exit 1
  68. KERNELVER="`uname -r`"
  69. . /etc/rc.d/PUPSTATE
  70. . /etc/DISTRO_SPECS
  71. NEWVER="$DISTRO_VERSION"
  72. fsfunc() { #f.s. type param passed in
  73. case $1 in
  74. Ext2) FSTYPE="ext2" ;;
  75. ReiserFS) FSTYPE="reiserfs" ;;
  76. Ext3) FSTYPE="ext3" ;;
  77. Ext4) FSTYPE="ext4" ;;
  78. FAT16) FSTYPE="vfat" ;;
  79. FAT32) FSTYPE="vfat" ;;
  80. NTFS) FSTYPE="ntfs" ;;
  81. ISO9660) FSTYPE="iso9660" ;;
  82. JFS) FSTYPE="jfs" ;;
  83. XFS) FSTYPE="xfs" ;;
  84. UDF) FSTYPE="udf" ;; #130128
  85. *) FSTYPE="" ;; #100412
  86. esac
  87. }
  88. ispupfunc() { #two params: fstype partition
  89. #returns version of already-installed Puppy, if any.
  90. PUPSFS=""
  91. PUPVEROLD='0.0' #110422
  92. [ ! $2 ] && return 0
  93. mkdir -p /mnt/$2
  94. ISPUPMNTPT="`mount | grep "^/dev/$2" | head -n 1 |tr -s " " | cut -f 3 -d " "`"
  95. if [ "$ISPUPMNTPT" = "" ];then
  96. ISPUPMNTPT="/mnt/$2"
  97. mount -t $1 /dev/$2 /mnt/$2
  98. [ $? -ne 0 ] && return 0
  99. fi
  100. #check for ancient puppy...
  101. [ -f $ISPUPMNTPT/usr_cram.fs ] && PUPVEROLD='1.0.8' #110422
  102. #puppy 2,3,4 has format pup_412.sfs ...
  103. ISFILE="`ls -1 ${ISPUPMNTPT}/${DISTRO_FILE_PREFIX}_[0-9][0-9][0-9].sfs 2>/dev/null | head -n 1`"
  104. [ "$ISFILE" != "" ] && PUPVEROLD=`basename $ISFILE | rev | cut -c 5,6,7 | rev`
  105. #puppy built by earlier woof has format distroprefix-500.sfs (ex: upup-500.sfs) ...
  106. ISFILE="`ls -1 ${ISPUPMNTPT}/${DISTRO_FILE_PREFIX}-[0-9][0-9][0-9].sfs 2>/dev/null | head -n 1`"
  107. [ "$ISFILE" != "" ] && PUPVEROLD=`basename $ISFILE | rev | cut -c 5,6,7 | rev`
  108. if [ "$ISFILE" != "" ];then #110422
  109. PUPVEROLD="` echo -n "$PUPVEROLD" | sed -e 's%[0-9]%&.%g' -e 's%\.$%%'`" #ex 512 becomes 5.1.2
  110. fi
  111. if [ "$ISFILE" != "" ];then #110422 new naming is puppy_wary_5.1.2.sfs
  112. ISFILE="`ls -1 ${ISPUPMNTPT}/${DISTRO_PUPPYSFS} 2>/dev/null | head -n 1`"
  113. [ "$ISFILE" != "" ] && PUPVEROLD="`basename $ISFILE | rev | cut -f 1 -d '_' | cut -f 1 -d '-' | rev`"
  114. [ "$PUPVEROLD" = "" ] && PUPVEROLD='0.0'
  115. fi
  116. #100913 new naming scheme...
  117. if [ "$PUPVEROLD" = "0.0" ];then
  118. #should really search subdirs also...
  119. ISFILE="`find ${ISPUPMNTPT} -maxdepth 2 -type f -name ${DISTRO_PUPPYSFS} | head -n 1`"
  120. if [ "$ISFILE" != "" ];then
  121. #version number is contained in the id-string appended to puppy.sfs file...
  122. FULLSIZE=`stat -c %s ${ISFILE}`
  123. #110422 format of idstring, see remasterpup2 line 249 (ex: w110423092024ZZZZ5.1.2XXXXXXXXXX)...
  124. ORIGSIZE=`expr $FULLSIZE - 32`
  125. PUPVEROLD="`dd if=${ISFILE} bs=1 skip=${ORIGSIZE} 2>/dev/null | sed -e 's%[^a-zA-Z0-9\.]%%g' | cut -b 18-32 | tr -s 'X' | sed -e 's%X$%%'`"
  126. fi
  127. fi
  128. #check for a full install to the partition...
  129. [ -f $ISPUPMNTPT/etc/puppyversion ] && PUPVEROLD="`cat $ISPUPMNTPT/etc/puppyversion`" #old pre-w464 install. 110422
  130. [ -f $ISPUPMNTPT/etc/DISTRO_SPECS ] && PUPVEROLD="`grep '^DISTRO_VERSION' ${ISPUPMNTPT}/etc/DISTRO_SPECS | cut -f 2 -d '=' | cut -f 2 -d '"' | cut -f 2 -d "'" | cut -f 1 -d ' '`" #w464 w478 110422
  131. umount /dev/$2 2>/dev/null
  132. #return $PUPVEROLD #110422
  133. }
  134. gpartedfixfunc() { #params: $DRVSEL
  135. GPDRV="$1"
  136. gparted /dev/$GPDRV &
  137. sleep 2
  138. pupmessage -bg '#ba55d3' -center -title "$(gettext 'Puppy Universal Installer')" "$(gettext 'GParted is a partition manager, available in Puppy, a very simple tool
  139. for deleting, creating and resizing partitions.')
  140. `eval_gettext \"Regarding 'ntfs' or 'vfat', of course do not change these to ext2 or ext3 if the
  141. partition has Windows or DOS installed on it! In the case of USB Flash drives,
  142. these normally come with a 'fat16' partition which is okay, but you will be
  143. restricted to saving to a '\\\${DISTRO_FILE_PREFIX}save' file. This is fine and most people opt for
  144. this, particularly as the drive can be used also to save and transfer files with
  145. Windows. However, a Flash drive can be changed to ext2/3 and still boots fine,
  146. with the advantage that the entire partition can be used to save to, rather than
  147. a '\\\${DISTRO_FILE_PREFIX}save' file. If in doubt, stay with 'vfat'.\"`
  148. $(gettext 'WARNING: changing the filesystem will wipe everything in the partition!')
  149. `gettext \"One more thing. When you run GParted, right-click on the partition and you will
  150. see a menu option to 'Manage flags'. Make sure the 'boot' flag is set -- don't
  151. forget that!\"`
  152. `gettext \"If you have a USB Flash 'key' drive that you have installed Puppy to but it will
  153. not boot, it may be that the partition(s) is confusing the PC's BIOS.
  154. Personally, I was able to fix such a USB drive by wiping the existing partition
  155. and then create it again using GParted.
  156. The steps to do this are very simple: when GParted is running,
  157. 1. delete all partitions on the USB device.
  158. 2. Create a new primary FAT16 partition, to fill the entire drive.
  159. 3. Click the 'Apply' button to write changes to the USB drive.
  160. 4. Set the 'boot' configuration flag (right-click on partition,
  161. choose 'manage flags').\"`
  162. $(gettext 'If GParted is installed, it is now running and you can do the above.
  163. Quiting GParted will return you to the Puppy Universal Installer...')
  164. $(gettext 'One final note for USB: after exiting GParted, do a mouse-over the desktop drive
  165. icon(s) -- if it(they) has not updated, unplug then replug the USB drive.')" &
  166. MSGID=$!
  167. while [ 1 ];do
  168. [ "`pidof gparted`" = "" ] && break #v424
  169. sleep 1
  170. done
  171. [ ! "`which gparted`" = "" ] && pupkill $MSGID 2>/dev/null
  172. #w015 need to refresh desktop drive icons(s)...
  173. sync
  174. #130722 ...this file was read by the old /sbin/pup_event_frontend_d big script.
  175. #now have a binary daemon, send this uevent to it, then /usr/local/pup_event/frontend_change will be called...
  176. echo change > /sys/block/${GPDRV}/uevent
  177. }
  178. fixusbfunc() { #params: $DESTPART $DESTFS
  179. echo '#!/bin/sh
  180. DESTPART="$1" #partition being installed to
  181. DESTFS="$2" #filesystem of destination partition
  182. echo "'$(gettext 'This little section of the Puppy Universal Installer is currently only')'"
  183. echo "'$(gettext 'for fixing USB Flash or CF-card-in-IDE-adaptor, after you have gone thru')'"
  184. echo "'$(gettext 'all the steps but it still will not boot.')'"
  185. echo
  186. echo "'$(gettext 'You are trying to install to')' $DESTPART, '$(gettext 'but it is not booting...')'"
  187. echo "'$(gettext 'Well, I am assuming that the BIOS in your PC is able to boot from USB.')'"
  188. echo "'$(gettext '-- for CF-IDE the drive looks like an ordinary hard drive, so that should')'"
  189. echo " '$(gettext 'be okay for any BIOS.')'"
  190. echo
  191. echo "'$(gettext 'This is the first release of this script, and it is a bit limited...')'"
  192. echo "'$(gettext 'and only handles a partition with a msdos/vfat filesystem.')'"
  193. if [ "$DESTFS" = "vfat" ];then
  194. echo "'$(gettext '...which is okay,')' $DESTPART '$(gettext 'does have a')' $DESTFS '$(gettext 'filesystem.')'"
  195. echo " '$(gettext 'But, we will now wipe it and recreate it.')'"
  196. else
  197. echo "'$(gettext '...currently')' $DESTPART '$(gettext 'has a')' $DESTFS '$(gettext 'filesystem.')'"
  198. echo " '$(gettext 'This script is not yet designed for that, so cannot continue.')'"
  199. echo
  200. echo -n "'$(gettext 'Press ENTER key to exit:')' "
  201. read nogo
  202. exit
  203. fi
  204. echo
  205. echo "'$(gettext 'Please be sure that you are wiping the right partition!!!')'"
  206. echo "'$(gettext 'Everything in')' $DESTPART '$(gettext 'is going to be wiped. If you do not want that,')'"
  207. echo "'$(gettext 'press any letter on the keyboard then ENTER key, or')'"
  208. echo -n "'$(gettext 'Press ENTER key only to continue script:')' "
  209. read querygo
  210. echo
  211. echo "'$(gettext 'Recreating msdos filesystem on')' $DESTPART..."
  212. mkdosfs /dev/$DESTPART
  213. sync
  214. echo "'$(gettext 'Fixing the Master Boot Record (MBR)...')'"
  215. #DESTDRV="`echo -n "$DESTPART" | cut -b 1-3`"
  216. DESTDRV="`echo -n "$DESTPART" | sed -e "s/[0-9]*$//" -e "s/p$//"`" #110126 mmcblk0p1 becomes mmcblk0
  217. dd if=/usr/lib/syslinux/mbrfat.bin of=/dev/$DESTDRV
  218. sync
  219. echo "'$(gettext '...done')'"
  220. echo
  221. echo "'$(gettext 'Okay, we can now go back to the main part of the Puppy Universal')'"
  222. echo "'$(gettext 'Installer and install Puppy to the')' $DESTPART '$(gettext 'partition.')'"
  223. echo -n "'$(gettext 'Press ENTER key to continue:')' "
  224. read yesgo
  225. ' > /tmp/fixusb.sh
  226. chmod 755 /tmp/fixusb.sh
  227. rxvt -bg "pink" -title "$(gettext 'Puppy Universal Installer')" -geometry 80x25 -e /tmp/fixusb.sh
  228. }
  229. unmountcdfunc() {
  230. if [ ! "$CDDRIVE" = "" ];then
  231. if [ ! "`mount | grep "/dev/$CDDRIVE"`" = "" ];then
  232. rox -D "`mount | grep "/dev/$CDDRIVE" | tr -s " " | cut -f 3 -d " "`"
  233. #do not kill any processes
  234. sync
  235. umount /dev/$CDDRIVE 2> /dev/null
  236. #mount > /etc/mtab #v2.10 remove.
  237. [ "`mount | grep "/dev/$CDDRIVE"`" = "" ] && eject /dev/$CDDRIVE
  238. fi
  239. fi
  240. }
  241. locate_puppy_src_files() {
  242. SRCPATH=""
  243. CDDRIVE=""
  244. rm -f /tmp/srcpath.txt
  245. mount | tr -s " " | cut -f 3 -d " " |
  246. while read ONEDIR
  247. do
  248. INCYES=0
  249. [ -f ${ONEDIR}/${DISTRO_PUPPYSFS} ] && INCYES=`expr $INCYES + 1` #v3.01 v424 100913
  250. [ -f $ONEDIR/vmlinuz ] && INCYES=`expr $INCYES + 1`
  251. [ -f $ONEDIR/initrd.gz ] && INCYES=`expr $INCYES + 1`
  252. if [ $INCYES -eq 3 ];then
  253. echo -n "$ONEDIR" > /tmp/srcpath.txt
  254. break
  255. fi
  256. done
  257. [ -f /tmp/srcpath.txt ] && SRCPATH="`cat /tmp/srcpath.txt`"
  258. if [ "$SRCPATH" = "" ];then
  259. Xdialog --wmclass "gtkdialog2" --left --buttons-style text --title "$(gettext 'Puppy universal installer')" --ok-label "CD" --cancel-label "$(gettext 'DIRECTORY')" --yesno "`eval_gettext \"Puppy consists of 2 to 6 files:\nvmlinuz The Linux kernel\ninitrd.gz The initial ramdisk.\n\\\${DISTRO_PUPPYSFS} This has all the Puppy files (sometimes inside initrd.gz).\n (if built inside initrd.gz then only initrd.gz is required)\n\\\${DISTRO_ADRVSFS} and \\\${DISTRO_YDRVSFS} if a modular main SFS is used (optional).\n\\\${DISTRO_ZDRVSFS} Extra kernel drivers and firmware (optional).\n (most builds have a usable selection of drivers in \\\${DISTRO_PUPPYSFS})\nIf you booted Puppy from a live-CD, those files will be on it.\nOtherwise, they are in the .iso file and can be extracted -- in that\ncase, just click on the .iso file and it will be mounted (opened) in\na directory (do not forget to click on the file later to unmount it!)\n\nWhere are the Puppy files?...\"`" 0 0
  260. RETVAL=$?
  261. if [ $RETVAL -eq 0 ];then #CD
  262. CDDRIVE="`readlink /dev/cdrom`"
  263. CDDRIVE="`basename $CDDRIVE`"
  264. CDDRVINFO="`probedisk | grep "/dev/$CDDRIVE" | cut -f 3 -d '|'`"
  265. Xdialog --wmclass "gtkdialog2" --left --title "$(gettext 'Puppy universal installer')" --msgbox "`eval_gettext \"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
  266. mkdir /mnt/$CDDRIVE 2> /dev/null
  267. mount -t iso9660 /dev/$CDDRIVE /mnt/$CDDRIVE
  268. if [ -f /mnt/$CDDRIVE/initrd.gz ];then
  269. SRCPATH="/mnt/$CDDRIVE"
  270. else
  271. Xdialog --wmclass "gtkdialog2" --left --title "$(gettext 'Puppy universal installer: ERROR')" --msgbox "$(gettext '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
  272. RETVAL=1
  273. fi
  274. fi
  275. if [ ! $RETVAL -eq 0 ];then #DIRECTORY
  276. SRCFPATH="`Xdialog --wmclass "gtkdialog2" --left --backtitle "$(eval_gettext \"Please find the latest Puppy files\nvmlinuz, initrd.gz and \\\${DISTRO_PUPPYSFS},\nTHEN HIGHLIGHT ANY ONE OF THEM\nand click the OK button\")" --title "$(gettext 'Puppy universal installer')" --stdout --no-buttons --no-cancel --fselect "*" 0 0`"
  277. [ ! $? -eq 0 ] && exit
  278. SRCPATH="`dirname $SRCFPATH`"
  279. fi
  280. fi
  281. #sanity check...
  282. if [ ! -f ${SRCPATH}/${DISTRO_PUPPYSFS} ];then #v3.01 v424 100913
  283. Xdialog --wmclass "gtkdialog2" --left --title "$(gettext 'Puppy universal installer: ERROR')" --msgbox "`eval_gettext \"Oh dear, a 'sanity check' has failed.\nThis file: \\\$SRCPATH/\\\${DISTRO_PUPPYSFS}\ndoes not exist.\nThe above is supposed to be path-to-where-puppy-files-are/\\\${DISTRO_PUPPYSFS}\nClick OK button to quit...\"`" 0 0
  284. exit
  285. fi
  286. } #end locate_puppy_src_files function.
  287. PMEDIA="`Xdialog --wmclass "gtkdialog2" --left --title "$(gettext 'Puppy Universal Installer')" --no-tags --stdout --menubox "$(gettext 'Welcome to the Puppy Universal Installer!\nIf you wish to install Puppy to a removable media, such as a USB Flash\nor hard drive, CD/DVD disc, Zip disk or LS-120 disk, please insert it\nright now, before proceeding.\n\nINSERT MEDIA NOW\nThen, choose the media that you want to install Puppy to:')" 0 0 10 usbflash "$(gettext 'USB Flash drive')" usbhd "$(gettext 'USB hard drive')" usb2ataflash "$(gettext 'USB CF Flash drive, later move CF card to IDE/SATA internal adaptor')" iusbflash "$(gettext 'Internal USB Flash drive (ex: uDiskOnChip)')" ataflash "$(gettext 'Internal IDE/SATA Flash drive (exs: CF card, SD memory card)')" atazip "$(gettext 'Internal ZIP or LS120 drive')" atahd "$(gettext 'Internal (IDE or SATA) hard drive')" scsihd "$(gettext 'Ancient true-SCSI hard drive')" cd "$(gettext 'CD drive')"`"
  288. [ ! $? -eq 0 ] && exit
  289. [ "$PMEDIA" = "" ] && exit
  290. TAGPMEDIA="$PMEDIA" #remember the tag chosen above.
  291. [ "$TAGPMEDIA" = "iusbflash" ] && PMEDIA="usbflash"
  292. FINALPMEDIA="$PMEDIA"
  293. if [ "$PMEDIA" = "usb2ataflash" ];then
  294. PMEDIA="usbflash"
  295. FINALPMEDIA="ataflash"
  296. fi
  297. ############BIG LOOP###############
  298. while [ 1 ];do #BIG LOOP
  299. PROBEDISK="`probedisk 2> /tmp/probediskerr.txt`"
  300. case $PMEDIA in
  301. usbflash)
  302. USBDRIVES="`echo "$PROBEDISK" | grep '|usbdrv|' | cut -f 3 -d '/' | cut -f 1 -d '|' | tr "\n" " "`"
  303. SELECTIONS=""
  304. for ONEUSB in $USBDRIVES
  305. do
  306. [ "$ATADRIVES" != "" ] && [ "`echo "$ATADRIVES" | grep "$ONEUSB"`" != "" ] && continue
  307. [ "$TAGPMEDIA" = "usbflash" ] && [ "`cat /sys/block/$ONEUSB/removable`" != "1" ] && continue
  308. [ "$TAGPMEDIA" = "iusbflash" ] && [ "`cat /sys/block/$ONEUSB/removable`" != "0" ] && continue
  309. USBINFO="`echo "$PROBEDISK" | grep "/dev/$ONEUSB" | head -n 1 | cut -f 3 -d '|' | tr '$' " " | tr ',' ' ' | tr -s " " | sed -e 's/ $//'`"
  310. USBSIZE="`disktype /dev/$ONEUSB | grep "Block device" | cut -f 2 -d ',' | tr -s " " | cut -f 1-4 -d " "`"
  311. SELECTIONS="${SELECTIONS} $ONEUSB \"${USBINFO}, ${USBSIZE}\""
  312. done
  313. ;;
  314. usbhd)
  315. USBDRIVES="`echo "$PROBEDISK" | grep '|usbdrv|' | cut -f 3 -d '/' | cut -f 1 -d '|' | tr "\n" " "`"
  316. SELECTIONS=""
  317. for ONEUSB in $USBDRIVES
  318. do
  319. [ "$ATADRIVES" != "" ] && [ "`echo "$ATADRIVES" | grep "$ONEUSB"`" != "" ] && continue
  320. [ "`cat /sys/block/$ONEUSB/removable`" != "0" ] && continue
  321. USBINFO="`echo "$PROBEDISK" | grep "/dev/$ONEUSB" | head -n 1 | cut -f 3 -d '|' | tr '$' " " | tr -s " " | sed -e 's/ $//g'`"
  322. USBSIZE="`disktype /dev/$ONEUSB | grep "Block device" | cut -f 2 -d ',' | tr -s " " | cut -f 1-4 -d " "`"
  323. SELECTIONS="${SELECTIONS} $ONEUSB \"${USBINFO}, ${USBSIZE}\""
  324. done
  325. ;;
  326. cd)
  327. #find cd drives...
  328. CDDRIVES="`echo "$PROBEDISK" | grep '|optical|' | cut -f 3 -d '/' | cut -f 1 -d '|' | tr "\n" " "`"
  329. SELECTIONS=""
  330. for ONEHD in $CDDRIVES
  331. do
  332. HDINFO="`echo "$PROBEDISK" | grep "/dev/$ONEHD" | head -n 1 | cut -f 3 -d '|' | tr '$' " " | tr -s " " | sed -e 's/ $//'`"
  333. HDSIZE="`disktype /dev/$ONEHD | grep "Block device" | cut -f 2 -d ',' | tr -s " " | cut -f 1-4 -d " "`"
  334. SELECTIONS="${SELECTIONS} $ONEHD \"${HDINFO}, ${HDSIZE}\""
  335. done
  336. Xdialog --wmclass "gtkdialog2" --left --title "$(gettext 'Puppy Universal Installer')" --ok-label "$(gettext 'QUIT')" --msgbox "`eval_gettext \"Your computer has these 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
  337. exit
  338. ;;
  339. atazip)
  340. #110126 remove...
  341. Xdialog --wmclass "gtkdialog2" --left --title "$(gettext 'Puppy Universal Installer')" --ok-label "$(gettext 'QUIT')" --msgbox "$(gettext 'Booting Puppy off a LS120 or Zip drive is such an incredibly slow experience,\nyou are being saved the pain of finding this out for yourself. For example,\nbooting from a Zip disk is typically 20 minutes!\nThis option has been removed from the Universal Installer. If you want to boot\nfrom a plug-in media, it is far far better to boot from CD/DVD, USB Flash or\nhard drive, or other solid-state memory card media.\n\n\nClick button to quit...')" 0 0
  342. exit
  343. HDDRIVES="`echo "$PROBEDISK" | grep '|floppy|' | cut -f 3 -d '/' | cut -f 1 -d '|' | tr "\n" " "`"
  344. SELECTIONS=""
  345. for ONEHD in $HDDRIVES
  346. do
  347. HDINFO="`echo "$PROBEDISK" | grep "/dev/$ONEHD" | head -n 1 | cut -f 3 -d '|' | tr '$' " " | tr -s " " | sed -e 's/ $//'`"
  348. HDSIZE="`disktype /dev/$ONEHD | grep "Block device" | cut -f 2 -d ',' | tr -s " " | cut -f 1-4 -d " "`"
  349. SELECTIONS="${SELECTIONS} $ONEHD \"${HDINFO}, ${HDSIZE}\""
  350. done
  351. ;;
  352. atahd|ataflash|scsihd) #v425 added scsihd
  353. #at bootup, init script creates ATADRIVES='' in /etc/rc.d/PUPSTATE...
  354. HDDRIVES="$ATADRIVES"
  355. #110126 need to include any memory card...
  356. CARDDRIVES="`echo "$PROBEDISK" | grep '|card|' | cut -f 3 -d '/' | cut -f 1 -d '|' | tr '\n' ' '`"
  357. for ONEHD in $HDDRIVES $CARDDRIVES
  358. do
  359. HDINFO="`echo "$PROBEDISK" | grep "/dev/$ONEHD" | head -n 1 | cut -f 3 -d '|' | tr '$' " " | tr -s " " | sed -e 's/ $//'`"
  360. HDSIZE="`disktype /dev/$ONEHD | grep "Block device" | cut -f 2 -d ',' | tr -s " " | cut -f 1-4 -d " "`"
  361. SELECTIONS="${SELECTIONS} $ONEHD \"${HDINFO}, ${HDSIZE}\""
  362. done
  363. ;;
  364. *)
  365. pupmessage -bg '#FF8080' "$(gettext 'Not yet implemented')"
  366. exit
  367. ;;
  368. esac
  369. if [ "$SELECTIONS" = "" ];then
  370. Xdialog --wmclass "gtkdialog2" --left --title "$(gettext 'Puppy Universal Installer')" --ok-label "$(gettext 'QUIT')" --msgbox "$(gettext 'Nothing to choose. If a plugin device, did you plug it in?')" 0 0
  371. exit
  372. fi
  373. echo '#!/bin/sh' > /tmp/dlg1
  374. echo -n 'Xdialog --wmclass "gtkdialog2" --title "'$(gettext 'Puppy Universal Installer')'" --no-cancel --stdout --menubox "'$(gettext 'Choose which drive to install to:')'" 10 60 0' >> /tmp/dlg1
  375. echo -n "$SELECTIONS" >> /tmp/dlg1
  376. echo ' > /tmp/retval' >> /tmp/dlg1
  377. echo 'exit $?' >> /tmp/dlg1
  378. chmod 755 /tmp/dlg1
  379. /tmp/dlg1
  380. [ $? -ne 0 ] && exit
  381. unset SELECTIONS #120126 jemimah: if you choose to run gparted the drive selection window shows your drive twice in the drive selection window after you quit gparted.
  382. DRVSEL="`cat /tmp/retval`"
  383. [ "$DRVSEL" = "" ] && exit
  384. DRVINFO="`disktype /dev/$DRVSEL`"
  385. SUPERFS="" #100207 need extra test on gecko edubook...
  386. if [ "`echo "$DRVINFO" | grep '^Partition 1: '`" = "" ];then
  387. SUPERFS="`echo "$DRVINFO" | grep "file system" | grep "^[a-zA-Z]" | tr -s " " | cut -f 1 -d " "`"
  388. #130128 cd/dvd, the f.s. name does not start on 1st column...
  389. [ "$SUPERFS" = "" ] && SUPERFS="`echo "$DRVINFO" | grep "file system" | head -n 1 | tr -s " " | cut -f 2 -d " "`"
  390. #...hmm, don't think will install to an optical media, but with udf you never know.
  391. fi
  392. DRVSIZE="`echo "$DRVINFO" | grep "Block device" | cut -f 2 -d ',' | tr -s " " | cut -f 1-4 -d " "`"
  393. DRVSIZM="`echo "$DRVSIZE" | cut -f 3 -d " "`"
  394. [ "`echo "$DRVSIZE" | grep "GiB"`" != "" ] && DRVSIZM="`LANG=C dc $DRVSIZM 1000 \* p`" #120202
  395. IDRVSIZM="`echo -n "$DRVSIZM" | cut -f 1 -d '.'`" #truncate to integer.
  396. DRVMSG=""
  397. PUPINST=""
  398. if [ "$SUPERFS" ];then
  399. fsfunc $SUPERFS #returns FSTYPE
  400. ispupfunc $FSTYPE $DRVSEL #sets PUPVEROLD
  401. #[ $? -ne 0 ] && PUPINST=", Puppy version $PUPVEROLD installed"
  402. [ "$PUPVEROLD" != '0.0' ] && PUPINST=", Puppy version $PUPVEROLD installed"
  403. DRVMSG="${DRVSEL}: ${FSTYPE}, ${DRVSIZE}${PUPINST}
  404. "
  405. else
  406. #has mbr and partitions...
  407. echo -n "" > /tmp/pidrvmsg.txt
  408. echo "$DRVINFO" |
  409. while read ONELINE
  410. do
  411. #100207 edubook: after showing partitions, shows a superfloppy, ignore...
  412. if [ "`echo "$ONELINE" | grep 'file system' | grep '^[a-zA-Z]'`" != "" ];then #100207
  413. [ "`echo "$DRVINFO" | grep "$ONELINE" | grep '^[a-zA-Z]'`" != "" ] && break #need any leading spaces.
  414. fi
  415. #130526 npierce: fix for GPT partitions... ref: http://www.murga-linux.com/puppy/viewtopic.php?p=704919#704919
  416. xPARTNUM="`echo "$ONELINE" | grep -E '^Partition ..?:' | tr -s " " | cut -f 1 -d ':' | cut -f 2 -d " "`"
  417. if [ ! "$xPARTNUM" = "" ];then #110126
  418. PARTNUM="$xPARTNUM"
  419. PARTSIZE="`echo "$ONELINE" | cut -f 2 -d ':' | tr -s " " | cut -f 2-3 -d " "`"
  420. [ "`echo -n "$DRVSEL" | grep 'mmcblk'`" != "" ] && PARTNUM="p${PARTNUM}" #ex: mmcblk0p1
  421. fi
  422. PARTITIONFS="`echo "$ONELINE" | grep "file system" | cut -f 1 -d " "`"
  423. if [ "$PARTITIONFS" ];then
  424. fsfunc $PARTITIONFS #sets FSTYPE.
  425. #find out if partition has puppy, or has ${DISTRO_PUPPYSFS} file...
  426. if [ "$FSTYPE" ];then #100412 fix from EdV.
  427. PUPINST=""
  428. ispupfunc $FSTYPE ${DRVSEL}${PARTNUM} #sets PUPVEROLD
  429. #[ $? -ne 0 ] && PUPINST=", Puppy version $PUPVEROLD installed"
  430. [ "$PUPVEROLD" != '0.0' ] && PUPINST=", Puppy version $PUPVEROLD installed" #110422
  431. echo "${DRVSEL}${PARTNUM}: ${FSTYPE}, size ${PARTSIZE}${PUPINST}" >> /tmp/pidrvmsg.txt
  432. fi
  433. fi
  434. done
  435. DRVMSG="`cat /tmp/pidrvmsg.txt`"
  436. fi
  437. DLGTXT=""
  438. CHOICES="`echo "$DRVMSG" | grep ':' | cut -f 1 -d ':' | tr "\n" " "`"
  439. for ONECHOICE in $CHOICES
  440. do
  441. DLGTXT="$DLGTXT
  442. <hbox>
  443. <text><label>$(gettext 'Install Puppy to') ${ONECHOICE}:</label></text>
  444. <button>
  445. <input file>/usr/local/lib/X11/mini-icons/mini-dog.xpm</input>
  446. <action>Exit:${ONECHOICE}</action>
  447. </button>
  448. </hbox>
  449. "
  450. done
  451. if [ "$FINALPMEDIA" = "usbflash" ];then
  452. MSGex1="<text><label>`gettext \"IMPORTANT: If you use GParted, after creating the partition be sure to set the 'boot' flag (right-click: Manage flags). Also, for a USB Flash drive choose fat16 filesystem as easier to boot from (than fat32) -- however a ext2 or ext3 partition will also work.\"`</label></text>
  453. <text><label>`gettext \"Extra note: Gparted may show invalid partitions on the drive, marked with a '!' icon -- delete it/them and recreate a partition (and make it bootable)\"`</label></text>"
  454. else
  455. MSGex1="<text><label>`gettext \"IMPORTANT: If you use GParted, after creating the partition be sure to set the 'boot' flag (right-click: Manage flags).\"`</label></text>
  456. <text><label>`gettext \"Extra note: Gparted may show invalid partitions on the drive, marked with a '!' icon -- delete it/them and recreate a partition (and make it bootable)\"`</label></text>"
  457. fi
  458. if [ "$DLGTXT" = "" ];then
  459. DLGTXT="<hbox>
  460. <text><label>`eval_gettext \"No partitions on drive \\\${DRVSEL}! It is recommended that you run GParted now to create a partition:\"`</label></text>
  461. <button>
  462. <input file>/usr/local/lib/X11/mini-icons/mini-hdisk.xpm</input>
  463. <label>GParted</label>
  464. <action>EXIT:RUNGPARTED</action>
  465. </button>
  466. </hbox>
  467. $MSGex1
  468. <text><label>\" \"</label></text>
  469. "
  470. fi
  471. DLGEXT=""
  472. if [ "`echo "$DRVMSG" | cut -f 1 -d ':' | grep "[a-zA-Z]$"`" = "" ];then
  473. #ask if want superfloppy install...
  474. DLGEXT="$DLGEXT
  475. <frame $(gettext 'Filesystem in partition')>
  476. <hbox>
  477. <text><label>`eval_gettext \"WARNING: Notice the filesystem in the intended destination, is that what you want? In particular, if the f.s. is 'vfat' or 'ntfs' you might want to replace these with a Linux ext2 or ext3 f.s. if the partition can be taken over totally for Puppy's use. If you are installing to an internal drive of a PC, it is highly recommended that the f.s. be a Linux ext2 or ext3. Puppy can install to vfat/ntfs but limited to 'frugal' with '\\\${DISTRO_FILE_PREFIX}save' only. Ntfs is particularly limited, slow and also has severe bootup options, so get rid of it if at all possible. Click the button to run GParted, which will enable you to examine and modify the partitions.\"`</label></text>
  478. <vbox>
  479. <button>
  480. <input file>/usr/local/lib/X11/mini-icons/gparted.xpm</input>
  481. <action>EXIT:RUNGPARTED</action>
  482. </button>
  483. </vbox>
  484. </hbox>
  485. </frame>
  486. <frame Superfloppy>
  487. <hbox>
  488. <text><label>`eval_gettext \"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>
  489. <vbox>
  490. <button>
  491. <input file>/usr/local/lib/X11/mini-icons/mini-dog.xpm</input>
  492. <action>EXIT:REFORMAT_${DRVSEL}</action>
  493. </button>
  494. </vbox>
  495. </hbox>
  496. </frame>
  497. "
  498. else #drive is a superfloppy.
  499. DLGEXT="$DLGEXT
  500. <frame Superfloppy>
  501. <hbox>
  502. <text><label>`eval_gettext \"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>
  503. <vbox>
  504. <button>
  505. <input file>/usr/local/lib/X11/mini-icons/mini-dog.xpm</input>
  506. <action>EXIT:REFORMAT_${DRVSEL}1</action>
  507. </button>
  508. </vbox>
  509. </hbox>
  510. </frame>
  511. "
  512. fi
  513. DLG2="
  514. <window title=\"$(gettext 'Puppy Universal Installer')\">
  515. <vbox>
  516. <text><label>$(gettext 'Here is what Puppy has found out about the chosen drive:')</label></text>
  517. <text><label>\"${DRVMSG}\"</label></text>
  518. $DLGTXT
  519. $DLGEXT
  520. <hbox>
  521. <button>
  522. <label>$(gettext 'Go back and choose a different drive')</label>
  523. <action>EXIT:GOBACK</action>
  524. </button>
  525. <button cancel></button>
  526. </hbox>
  527. </vbox>
  528. </window>
  529. "
  530. RETTXT="`echo "$DLG2" | ${GTKDIALOGEXE} --stdin`"
  531. #returns EXIT="Cancel" or EXIT="abort"...
  532. [ "`echo "$RETTXT" | grep 'EXIT' | grep -E 'Cancel|abort'`" != "" ] && exit
  533. if [ "`echo "$RETTXT" | grep 'RUNGPARTED'`" != "" ];then
  534. gpartedfixfunc $DRVSEL #w015
  535. continue #BIG LOOP
  536. fi
  537. [ "`echo "$RETTXT" | grep 'EXIT:GOBACK'`" != "" ] && continue
  538. #sanity check...
  539. SANITYPART="`echo -n "$RETTXT" | grep '^EXIT' | cut -f 2 -d '"' | cut -f 2 -d '_'`" #'geany
  540. smPTN="^/dev/${SANITYPART} " #111011
  541. SANITYMNTPT="`mount | grep "$smPTN" | head -n 1 | tr -s " " | cut -f 3 -d " "`"
  542. if [ ! "$SANITYMNTPT" = "" ];then
  543. SANITYMSG1="$SANITYPART $(gettext 'currently mounted, need to unmount it!!!')"
  544. SANITYMSG2="$SANITYPART $(gettext 'currently mounted read-write.')"
  545. SANITYMSG3="`eval_gettext \"\\\$SANITYPART does not have \\\${DISTRO_FILE_PREFIX}save.3fs file in it.\"`"
  546. SANITYRORW="`mount | grep "/$SANITYPART" | head -n 1 | tr -s " " | cut -f 6 -d " "`"
  547. [ ! "`echo -n "$SANITYMNTPT" | grep "/initrd/"`" = "" ] && SANITYMSG1="$SANITYPART $(gettext 'cannot be unmounted!')"
  548. [ "$SANITYRORW" = "(ro)" ] && SANITYMSG2="$SANITYPART $(gettext 'is mounted read-only!')"
  549. [ -f $SANITYMNTPT/${DISTRO_FILE_PREFIX}save.3fs ] && SANITYMSG3="`eval_gettext \"\\\$SANITYPART has personal file \\\${DISTRO_FILE_PREFIX}save.3fs in it!\"`"
  550. Xdialog --wmclass "gtkdialog2" --left --title "$(gettext 'Puppy universal installer: SANITY CHECK')" --ok-label "$(gettext 'CONTINUE')" --cancel-label "$(gettext 'QUIT')" --yesno "`eval_gettext \"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 \\\${DISTRO_FILE_PREFIX}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 \\\${DISTRO_FILE_PREFIX}save.3fs does not exist then Puppy will run totally in RAM, which will\nsolve the problem -- but you should not delete or rename \\\${DISTRO_FILE_PREFIX}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
  551. [ ! $? -eq 0 ] && exit
  552. fi
  553. if [ ! "`echo "$RETTXT" | grep 'EXIT:REFORMAT'`" = "" ];then
  554. #RETTXT will have EXIT="REFORMAT_sda" or EXIT="REFORMAT_sda1", depending whether
  555. #we want to format in superfloppy mode or with a MBR and a partition...
  556. DESTPART="`echo "$RETTXT" | grep '^EXIT' | grep 'REFORMAT' | cut -f 2 -d '"' | cut -f 2 -d '_'`" #'geany
  557. if [ "`echo "$DESTPART" | grep "[0-9]$"`" = "" ];then
  558. #want superfloppy...
  559. DLG3="
  560. <window title=\"$(gettext 'Puppy Universal Installer')\">
  561. <vbox>
  562. <text><label>`eval_gettext \"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>
  563. <text><label>`eval_gettext \"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 (\\\${DISTRO_FILE_PREFIX}save.3fs) -- that file will contain all your personal files. Press FORMAT_ext3 or FORMAT_vfat button to commence formatting...\"`</label></text>
  564. <hbox>
  565. <button>
  566. <label>$(gettext 'FORMAT_ext3')</label>
  567. <action>EXIT:ext3</action>
  568. </button>
  569. <button>
  570. <label>$(gettext 'FORMAT_vfat')</label>
  571. <action>EXIT:vfat</action>
  572. </button>
  573. </hbox>
  574. </vbox>
  575. </window>
  576. "
  577. RETTXT="`echo "$DLG3" | ${GTKDIALOGEXE} --stdin`"
  578. [ ! "`echo "$RETTXT" | grep 'abort'`" = "" ] && exit
  579. DESTFS="`echo "$RETTXT" | grep 'EXIT:' | cut -f 2 -d ':'`"
  580. echo '#!/bin/sh' > /tmp/formatsuper.sh
  581. echo -e "echo -n \"$(gettext 'SANITY CHECK: formatting /dev/')${DRVSEL}, $(gettext 'ENTER to continue or CTRL-C to quit:') \"" >> /tmp/formatsuper.sh # $(gettext 'SANITY CHECK: formatting /dev/') $(gettext 'ENTER to continue or CTRL-C to quit:') for xgettext to detect lines
  582. echo 'read mooo' >> /tmp/formatsuper.sh
  583. echo "dd if=/dev/zero of=/dev/$DRVSEL bs=512 count=1" >> /tmp/formatsuper.sh
  584. echo 'sync' >> /tmp/formatsuper.sh
  585. if [ "$DESTFS" = "ext3" ];then
  586. echo 'echo "'$(gettext 'Creating an ext3 filesystem on the drive...')'"' >> /tmp/formatsuper.sh
  587. echo -e "echo \"y\" | mke2fs -j -m 0 /dev/$DRVSEL" >> /tmp/formatsuper.sh
  588. else #vfat
  589. echo 'echo "'$(gettext 'Creating a vfat filesystem on the drive...')'"' >> /tmp/formatsuper.sh
  590. echo "mkdosfs -I /dev/$DRVSEL" >> /tmp/formatsuper.sh
  591. fi
  592. echo 'sync' >> /tmp/formatsuper.sh
  593. echo 'echo -n "'$(gettext 'Press ENTER key to continue:')' "' >> /tmp/formatsuper.sh
  594. echo 'read moo' >> /tmp/formatsuper.sh
  595. chmod 755 /tmp/formatsuper.sh
  596. rxvt -bg "orange" -title "$(gettext 'Puppy Universal Installer')" -geometry 80x10 -e /tmp/formatsuper.sh
  597. DESTSIZM="$DRVSIZM"
  598. IDESTSIZM="$IDRVSIZM"
  599. DESTVER="" #previous version, n.a.
  600. #w015 need to refresh desktop drive icons(s)...
  601. #/tmp/pup_event_frontend_block_request is used in /sbin/pup_event_frontend_d to refresh drv...
  602. sync
  603. #130722 ...this file was read by the old /sbin/pup_event_frontend_d big script.
  604. #now have a binary daemon, send this uevent to it, then /usr/local/pup_event/frontend_change will be called...
  605. echo change > /sys/block/${DRVSEL}/uevent
  606. else
  607. #want to partition with partition 1...
  608. DLG3="
  609. <window title=\"$(gettext 'Puppy Universal Installer')\">
  610. <vbox>
  611. <text><label>`eval_gettext \"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>
  612. <text><label>`eval_gettext \"A further clarification: if you choose ext3, then the entire partition will be immediately available for personal data storage, whereas if you choose vfat then Puppy will have to create a file with a ext2 filesystem inside it (\\\${DISTRO_FILE_PREFIX}save.2fs) -- that file will contain all your personal files.\"`</label></text>
  613. <text><label>$(gettext 'USB Flash drives: it is most common to create a vfat (fat16) partition on these, for Windows interchangeability and some older BIOSes boot only if see a fat16 f.s.')</label></text>
  614. <text><label>\" \"</label></text>
  615. <text><label>$(gettext 'Click button to run GParted...')</label></text>
  616. <hbox>
  617. <button>
  618. <label>$(gettext 'Run GParted')</label>
  619. <action>EXIT:gparted</action>
  620. </button>
  621. <button cancel>
  622. </button>
  623. </hbox>
  624. </vbox>
  625. </window>
  626. "
  627. RETTXT="`echo "$DLG3" | ${GTKDIALOGEXE} --stdin`"
  628. MYACTION="`echo "$RETTXT" | grep 'EXIT:' | cut -f 2 -d ':'`"
  629. if [ "$MYACTION" = "gparted" ];then
  630. #w015 if a superfloppy, first need to create a disk label, else gparted is upset...
  631. if [ "`echo "$DRVMSG" | cut -f 1 -d ':' | grep "[a-zA-Z]$"`" != "" ];then
  632. dd if=/dev/zero of=/dev/$DRVSEL bs=512 count=1
  633. parted --script /dev/sdb mklabel msdos
  634. sync
  635. fi
  636. #exec gparted /dev/$DRVSEL
  637. gpartedfixfunc $DRVSEL #w015
  638. continue #BIG LOOP
  639. fi
  640. #exit
  641. fi
  642. else
  643. DESTPART="`echo "$RETTXT" | grep '^EXIT' | cut -f 2 -d '"'`" #'geany
  644. DESTFS="`echo "$DRVMSG" | grep "${DESTPART}:" | cut -f 1 -d ',' | tr -s " " | cut -f 2 -d " "`" #120310
  645. DESTSIZE="`echo "$DRVMSG" | grep "${DESTPART}:" | tr -s " " | cut -f 4-5 -d " "`" #120310
  646. DESTSIZM="`echo -n "$DESTSIZE" | cut -f 1 -d " "`"
  647. if [ ! "`echo "$DESTSIZE" | grep "GiB"`" = "" ];then
  648. DESTSIZM="`LANG=C; dc $DESTSIZM 1000 \* p`" #LANG=C; rodin.s for i18n
  649. fi
  650. IDESTSIZM="`echo -n "$DESTSIZM" | cut -f 1 -d '.'`" #truncate to integer.
  651. DESTVER="`echo "$DRVMSG" | grep "${DESTPART}:" | tr -s " " | grep "installed" | cut -f 8 -d " "`" #120310
  652. fi
  653. break
  654. done #BIG LOOP
  655. ###########END BIG LOOP###############
  656. if [ "`echo "$DESTPART" | grep "[0-9]$"`" = "" ];then
  657. #superfloppy
  658. DLG4="
  659. <window title=\"$(gettext 'Puppy Universal Installer')\">
  660. <vbox>
  661. <text><label>$(gettext '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>
  662. <text><label>`eval_gettext \"The target drive is \\\${DESTPART}, which has a \\\${DESTFS}, of size \\\${DESTSIZM}M. Press OK button to install Puppy to the drive...\"`</label></text>
  663. <hbox><button ok></button><button cancel></button></hbox>
  664. </vbox>
  665. </window>
  666. "
  667. RETTXT="`echo "$DLG4" | ${GTKDIALOGEXE} --stdin`"
  668. else
  669. DLG4="
  670. <window title=\"$(gettext 'Puppy Universal Installer')\">
  671. <vbox>
  672. <text><label>`eval_gettext \"You have chosen to install Puppy to partition /dev/\\\${DESTPART}, which has a \\\${DESTFS} filesystem and the size is \\\${DESTSIZM}M.\"`</label></text>
  673. <text><label>$(gettext '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>
  674. <hbox><button ok></button><button cancel></button></hbox>
  675. </vbox>
  676. </window>
  677. "
  678. RETTXT="`echo "$DLG4" | ${GTKDIALOGEXE} --stdin`"
  679. fi
  680. [ ! $? -eq 0 ] && exit
  681. [ "`echo "$RETTXT" | grep 'OK'`" = "" ] && exit
  682. #get latest Puppy files....
  683. locate_puppy_src_files
  684. #find out if puppy already on dest...
  685. ispupfunc $DESTFS $DESTPART
  686. #...sets PUPVEROLD.
  687. #now to do the actual install...
  688. case $FINALPMEDIA in
  689. usbflash|usbhd|ataflash|atazip) #removable media, install with syslinux/extlinux
  690. #26mar06 JustGreg fix mbr...
  691. if [ "`echo "$DESTPART" | grep '[0-9]$'`" != "" ];then #superfloppy mode has no mbr.
  692. #DESTPART is a partition (not superfloppy).
  693. DESTDRV="`echo -n "$DESTPART" | sed -e 's/[0-9]*$//' -e 's/p$//'`" #110126 mmcblk0p1 becomes mmcblk0
  694. DESTNUM="`echo -n "$DESTPART" | cut -c 4-5`"
  695. [ "`echo -n "$DESTPART" | grep 'mmc'`" != "" ] && DESTNUM="`echo -n "$DESTPART" | rev | cut -c 1 | rev`" #110126 mmcblk0p1 becomes 1 -- note, left off the p.
  696. dd if=/dev/$DESTDRV of=/tmp/mbr446.bin bs=446 count=1
  697. sync
  698. #v3.95
  699. ALPHADUMP="`hexdump -C /tmp/mbr446.bin | cut -f 2 -d '|' | tr '\n' ' ' | tr -d ' '`"
  700. #this will be =1 if mbr has 'GRUB' in it, else =0...
  701. FLAGGRUB="`echo "$ALPHADUMP" | grep 'GRUB' | wc -l`"
  702. #v3.97 have a case where normal bootable flash vfat pen drive has the
  703. #string 'GRUB.Geom.HardDisk.Read.Error' in the mbr...
  704. [ "$FLAGGRUB" = "1" ] && [ "`echo "$ALPHADUMP" | grep 'GRUB.Geom.HardDisk.Read.Error'`" != "" ] && FLAGGRUB="0"
  705. if [ "`hexdump -x /tmp/mbr446.bin | tr -s " " | cut -f 2-9 -d " " | grep '[1-9a-zA-Z]'`" = "" -o "$FLAGGRUB" = "1" ];then
  706. MBRCHOICE="`Xdialog --wmclass "gtkdialog2" --left --title "$(gettext 'Puppy Universal Installer')" --no-cancel --stdout --menubox "$(gettext 'The bootstrap loader code is missing from the MBR (Master Boot Record),\nmeaning that the 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 "$(gettext 'Bootstrap loader code, created by JustGreg')" mbr.bin "$(gettext 'From the Syslinux package')" mbrfat.bin "$(gettext 'From the makebootfat package')" spb2_mbr.bin "$(gettext 'From spblinux, created by Christian Ostheimer')" `"
  707. else
  708. MBRCHOICE="`Xdialog --wmclass "gtkdialog2" --left --title "$(gettext 'Puppy Universal Installer')" --no-cancel --stdout --menubox "$(eval_gettext \"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 "$(gettext 'DO NOTHING, leave current MBR alone')" sys-nopart.mbr "$(gettext 'Bootstrap loader code, created by JustGreg')" mbr.bin "$(gettext 'From the Syslinux package')" mbrfat.bin "$(gettext 'From the makebootfat package')" spb2_mbr.bin "$(gettext 'From spblinux, created by Christian Ostheimer')" `"
  709. fi
  710. rm /tmp/mbr446.bin
  711. if [ ! "$MBRCHOICE" = "" ];then
  712. if [ ! "$MBRCHOICE" = "default" ];then
  713. dd if=/dev/$DESTDRV of=/tmp/oldmbr.bin bs=446 count=1
  714. sync
  715. dd if=/usr/lib/syslinux/$MBRCHOICE of=/dev/$DESTDRV
  716. sync
  717. fi
  718. fi
  719. #check that partition has 'boot' flag set...
  720. QPATTERN="^Partition ${DESTNUM}:"
  721. if [ "`disktype /dev/$DESTDRV | grep "$QPATTERN" | grep 'bootable'`" = "" ];then
  722. Xdialog --wmclass "gtkdialog2" --left --title "$(gettext 'Puppy Universal Installer')" --no-cancel --stdout --ok-label "GParted" --cancel-label "$(gettext 'bypass')" --yesno "`eval_gettext \"Slight problem. It seems that partition \\\${DESTPART} does not have it's 'boot'\"`
  723. $(gettext 'flag set, which is required to make it bootable. Recommended to click the')
  724. `gettext \"'GParted' button now to run GParted, then right-click on the partition and\"`
  725. `gettext \"choose 'Manage flags' then set 'boot' flag.\"`
  726. $(gettext 'After exiting from GParted, this Puppy Universal Installer will continue.')
  727. `gettext \"Click 'GParted' (recommended) to run GParted...\"`
  728. `gettext \"Click 'bypass' to bypass GParted...\"`" 0 0
  729. [ $? -eq 0 ] && gparted /dev/$DESTDRV
  730. fi
  731. fi
  732. case $DESTFS in
  733. vfat)
  734. if [ ! "`echo "$DESTPART" | grep '[0-9]$'`" = "" ];then
  735. PARTCHOICE="`Xdialog --wmclass "gtkdialog2" --left --title "$(gettext 'Puppy Universal Installer')" --no-cancel --stdout --menubox "$(gettext \"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 "$(gettext 'JUST KEEP GOING')" GParted "$(gettext 'Wipe and recreate USB/IDE-CF partition using GParted')" syslinux "$(gettext 'Make USB or IDE-CF msdos/vfat partition bootable')"`"
  736. [ "$PARTCHOICE" = "syslinux" ] && fixusbfunc $DESTPART $DESTFS
  737. [ "$PARTCHOICE" = "GParted" ] && gpartedfixfunc $DRVSEL
  738. fi
  739. #params passed in: $DESTPART "$SRCPATH" $FINALPMEDIA
  740. echo '#!/bin/sh
  741. DESTPART="$1"
  742. SRCPATH="$2"
  743. FINALPMEDIA="$3"
  744. DISTRO_FILE_PREFIX="$4"
  745. DISTRO_PUPPYSFS="$5"
  746. DISTRO_ADRVSFS="$6"
  747. DISTRO_YDRVSFS="$7"
  748. DISTRO_ZDRVSFS="$8"
  749. #DISTRO_DEVXSFS="$7"
  750. PREFIX1CHAR="`echo -n "$DISTRO_FILE_PREFIX" | cut -c 1`"
  751. echo "'$(gettext 'ABSOLUTE FINAL SANITY CHECK!')'"
  752. echo "'$(gettext 'You are about to install Puppy to /dev/')'$DESTPART, '$(gettext 'with boot parameter')'"
  753. echo "pmedia=$FINALPMEDIA. '$(gettext 'The files vmlinuz, initrd.gz,')' ${DISTRO_PUPPYSFS}, syslinux.cfg"
  754. echo "('$(gettext 'and maybe the')' ${DISTRO_ZDRVSFS} ${DISTRO_ZDRVSFS} '$(gettext 'and')' ${DISTRO_ZDRVSFS} '$(gettext 'if they exist.')' ${DISTRO_PUPPYSFS} '$(gettext 'may be inside')' initrd.gz)"
  755. echo "'$(gettext 'will be written to /dev/')'$DESTPART '$(gettext 'and Syslinux will be used to make it bootable.')'"
  756. echo
  757. echo -n "'$(gettext 'Press ENTER key to continue, CTRL-C to abort:')' "
  758. read goforit
  759. #v3.95...
  760. mount -t vfat /dev/$DESTPART /mnt/data
  761. echo
  762. echo "'$(gettext 'Do you want to wipe all files in /dev/')'$DESTPART? '$(gettext 'This is currently mounted')'"
  763. echo "'$(gettext 'on /mnt/data so you can look at what is there before answering. You would')'"
  764. echo "'$(gettext 'normally answer no if upgrading Puppy, or yes for a fresh install and')'"
  765. echo "'$(gettext 'you want to get rid of old files that are just taking up space.')'"
  766. echo "'$(gettext 'Note, you can also manually prune files in /mnt/data then choose no here.')'"
  767. echo "'$(gettext 'Note, if you choose no here, this script will still do some basic deleting')'"
  768. echo "'$(gettext 'of any files of an earlier Puppy installation')' ('$(gettext 'not the')' ${DISTRO_FILE_PREFIX}save '$(gettext 'though!')')."
  769. echo
  770. echo "'$(gettext 'No, press ENTER only to not wipe all files, or')'"
  771. echo -n "'$(gettext 'Yes, press any alpha or numeric char then ENTER to wipe all files:')' "
  772. read WIPEALL
  773. if [ "$WIPEALL" != "" ];then
  774. echo
  775. echo "'$(gettext 'Deleting everything in /mnt/data...')'"
  776. rm -rf /mnt/data/*
  777. else
  778. #well, minimum to get rid of...
  779. rm -f /mnt/data/image.gz 2> /dev/null
  780. rm -f /mnt/data/usr_cram.fs 2> /dev/null #old name.
  781. rm -f /mnt/data/pup_[0-9]*.sfs 2>/dev/null #old name.
  782. rm -f /mnt/data/${DISTRO_FILE_PREFIX}-*.sfs 2>/dev/null
  783. rm -f /mnt/data/devx_*.sfs 2>/dev/null
  784. rm -f /mnt/data/${DISTRO_FILE_PREFIX}z*.sfs 2>/dev/null #old name.
  785. rm -f /mnt/data/z${PREFIX1CHAR}*.sfs 2>/dev/null
  786. rm -f /mnt/data/${DISTRO_PUPPYSFS} 2>/dev/null #100913
  787. rm -f /mnt/data/${DISTRO_ZDRVSFS} 2>/dev/null #100913
  788. rm -f /mnt/data/${DISTRO_ADRVSFS} 2>/dev/null
  789. rm -f /mnt/data/${DISTRO_YDRVSFS} 2>/dev/null
  790. #rm -f /mnt/data/${DISTRO_DEVXSFS} 2>/dev/null #100913
  791. fi
  792. sync
  793. umount /mnt/data
  794. echo
  795. echo "'$(gettext 'Making')' $DESTPART '$(gettext 'bootable...')'"
  796. syslinux /dev/$DESTPART
  797. sync
  798. mount -t vfat /dev/$DESTPART /mnt/data
  799. echo
  800. echo "'$(gettext 'Copying vmlinuz...')'"
  801. cp -f $SRCPATH/vmlinuz /mnt/data/
  802. sync
  803. echo "'$(gettext 'Creating syslinux.cfg...')'"
  804. FCOPY=""
  805. echo "'$(gettext 'Would you like syslinux.cfg to have')' 'pfix=copy' '$(gettext 'boot parameter?')'"
  806. echo "'$(gettext 'this will cause')' ${DISTRO_PUPPYSFS} '$(gettext 'to be copied into RAM at bootup, which slows')'"
  807. echo "'$(gettext 'bootup but speeds application startup slightly.')'"
  808. echo "'$(gettext 'Probably good to answer yes here if PC has 256MB or more RAM.')'"
  809. echo "'$(gettext '(you can edit syslinux.cfg later to change the choice made here)')'"
  810. echo "('$(gettext 'note, Puppy will override this and not copy if there is insufficient RAM')')"
  811. echo -n "'$(gettext 'ENTER key only for no, else any char then ENTER for yes:')' "
  812. read FCOPY
  813. [ "$FCOPY" != "" ] && FCOPY=" pfix=copy"
  814. #100321 big assumption here, that current running kernel matches one being installed...
  815. if [ -e /proc/ide ];then
  816. NODMA="ide=nodma" #old kernel
  817. else
  818. #old 'ide=nodma' does not work, need 'libata.dma=3' this enables DMA for Disk and CD/DVD but NOT for CF.
  819. NODMA="libata.dma=3"
  820. fi
  821. if [ ! -f $SRCPATH/boot.msg ];then #100321
  822. if [ "$FINALPMEDIA" = "ataflash" ];then
  823. echo "default vmlinuz initrd=initrd.gz ${NODMA} pmedia=${FINALPMEDIA}${FCOPY}" > /mnt/data/syslinux.cfg
  824. else
  825. echo "default vmlinuz initrd=initrd.gz pmedia=$FINALPMEDIA$FCOPY" > /mnt/data/syslinux.cfg
  826. fi
  827. else
  828. #100321 want a boot menu...
  829. if [ "$FINALPMEDIA" = "ataflash" ];then
  830. echo "default puppy
  831. display boot.msg
  832. prompt 1
  833. timeout 50
  834. F1 boot.msg
  835. F2 help.msg
  836. F3 help2.msg
  837. label puppy
  838. kernel vmlinuz
  839. append initrd=initrd.gz ${NODMA} pmedia=${FINALPMEDIA}${FCOPY}" > /mnt/data/syslinux.cfg
  840. else
  841. echo "default puppy
  842. display boot.msg
  843. prompt 1
  844. timeout 50
  845. F1 boot.msg
  846. F2 help.msg
  847. F3 help2.msg
  848. label puppy
  849. kernel vmlinuz
  850. append initrd=initrd.gz pmedia=${FINALPMEDIA}${FCOPY}" > /mnt/data/syslinux.cfg
  851. fi
  852. cp -f $SRCPATH/boot.msg /mnt/data/
  853. cp -f $SRCPATH/help*.msg /mnt/data/
  854. cp -f $SRCPATH/logo.16 /mnt/data/
  855. sync
  856. fi
  857. echo ""
  858. echo "'$(gettext 'Creating marker file for wakepup boot floppy...')'"
  859. [ "$FINALPMEDIA" = "usbflash" ] && touch /mnt/data/USBFLASH
  860. [ "$FINALPMEDIA" = "ataflash" ] && touch /mnt/data/IDEFLASH
  861. [ "$FINALPMEDIA" = "usbhd" ] && touch /mnt/data/USBHD
  862. [ "$FINALPMEDIA" = "atazip" ] && touch /mnt/data/IDEZIP
  863. sync
  864. echo "'$(gettext 'Copying initrd.gz...')'"
  865. cp -f $SRCPATH/initrd.gz /mnt/data/
  866. sync
  867. echo "'$(gettext 'Copying .sfs files...')'"
  868. cp -f $SRCPATH/${DISTRO_PUPPYSFS} /mnt/data/ 2>/dev/null
  869. sync
  870. cp -f $SRCPATH/${DISTRO_ADRVSFS} /mnt/data/ 2>/dev/null
  871. sync
  872. cp -f $SRCPATH/${DISTRO_YDRVSFS} /mnt/data/ 2>/dev/null
  873. sync
  874. cp -f $SRCPATH/${DISTRO_ZDRVSFS} /mnt/data/ 2>/dev/null
  875. sync
  876. #cp -f $SRCPATH/${DISTRO_DEVXSFS} /mnt/data/ 2>/dev/null
  877. #sync
  878. umount /mnt/data
  879. echo -n "'$(gettext 'Finished, press ENTER key to continue:')' "
  880. read moo
  881. ' > /tmp/installpup.sh
  882. chmod 755 /tmp/installpup.sh
  883. rxvt -bg "orange" -title "$(gettext 'Puppy Universal Installer')" -geometry 80x10 -e /tmp/installpup.sh $DESTPART $SRCPATH $FINALPMEDIA $DISTRO_FILE_PREFIX $DISTRO_PUPPYSFS $DISTRO_ADRVSFS $DISTRO_YDRVSFS $DISTRO_ZDRVSFS #$DISTRO_DEVXSFS
  884. ;;
  885. ext2|ext3|ext4)
  886. #params passed in: $DESTPART "$SRCPATH" $FINALPMEDIA
  887. echo '#!/bin/sh
  888. DESTPART="$1"
  889. SRCPATH="$2"
  890. FINALPMEDIA="$3"
  891. DESTFS="$4"
  892. DISTRO_FILE_PREFIX="$5"
  893. DISTRO_PUPPYSFS="$6"
  894. DISTRO_ADRVSFS="$7"
  895. DISTRO_YDRVSFS="$8"
  896. DISTRO_ZDRVSFS="$9"
  897. #DISTRO_DEVXSFS="$8"
  898. PREFIX1CHAR="`echo -n "$DISTRO_FILE_PREFIX" | cut -c 1`"
  899. echo "'$(gettext 'ABSOLUTE FINAL SANITY CHECK!')'"
  900. echo "'$(gettext 'You are about to install Puppy to /dev/')'$DESTPART, '$(gettext 'with boot parameter')'"
  901. echo "pmedia=$FINALPMEDIA. '$(gettext 'The files vmlinuz, initrd.gz,')' ${DISTRO_PUPPYSFS}, extlinux.conf"
  902. echo "('$(gettext 'and maybe')' ${DISTRO_ADRVSFS} ${DISTRO_YDRVSFS} '$(gettext 'and')' ${DISTRO_ZDRVSFS} '$(gettext 'if they exist.')' ${DISTRO_PUPPYSFS} '$(gettext 'may be inside initrd.gz')')"
  903. echo "'$(gettext 'will be written to /dev/')'$DESTPART '$(gettext 'and Extlinux will be used to make it bootable.')'"
  904. echo
  905. echo -n "'$(gettext 'Press ENTER key to continue, CTRL-C to abort:')' "
  906. read goforit
  907. mount -t $DESTFS /dev/$DESTPART /mnt/data
  908. if [ ! $? -eq 0 ];then #v3.95
  909. dpPATTERN="^/dev/$DESTPART "
  910. if [ "`mount | grep "$dpPATTERN"`" = "" ];then
  911. echo
  912. echo "/dev/$DESTPART '$(gettext 'failed to mount on /mnt/data ...nothing else mounted on')'"
  913. echo "/mnt/data? '$(gettext 'One known case for this failure is when installing to the')'"
  914. echo "'$(gettext 'internal Flash drive of a Intel Classmate laptop. Well, you can attempt')'"
  915. echo "'$(gettext 'to fix this problem by creating a new')' $DESTFS '$(gettext 'filesystem in')' $DESTPART ('$(gettext 'which')'"
  916. echo "'$(gettext 'will of course wipe anything previously there -- which will not matter')'"
  917. echo "'$(gettext 'if you have already backed up the previous operating system')')."
  918. echo "'$(gettext 'Press ENTER only to abort installation, or')'"
  919. echo "'$(gettext 'press any char then ENTER to create a new f.s. then proceed with install:')' "
  920. read NEWFS
  921. [ "$NEWFS" = "" ] && exit
  922. DFPARAM=""
  923. [ "$DESTFS" = "ext3" ] && DFPARAM="-j"
  924. echo "y" | mke2fs $DFPARAM -m 0 /dev/$DESTPART
  925. sync
  926. mount -t $DESTFS /dev/$DESTPART /mnt/data
  927. if [ ! $? -eq 0 ];then
  928. echo -n "'$(gettext 'Sorry, still cannot mount')' $DESTPART '$(gettext 'partition. Press ENTER to quit:')' "
  929. read NOWQUIT
  930. exit
  931. fi
  932. fi
  933. fi
  934. echo
  935. echo "'$(gettext 'Do you want to wipe all files in /dev/')'$DESTPART? '$(gettext 'This is currently mounted')'"
  936. echo "'$(gettext 'on /mnt/data so you can look at what is there before answering. You would')'"
  937. echo "'$(gettext 'normally answer no if upgrading Puppy, or yes for a fresh install and')'"
  938. echo "'$(gettext 'you want to get rid of old files that are just taking up space.')'"
  939. echo "'$(gettext 'Note, you can also manually prune files in /mnt/data then choose no here.')'"
  940. echo "'$(gettext 'Note, if you choose no here, this script will still do some basic deleting')'"
  941. echo "'$(gettext 'of any files of an earlier Puppy installation')' ('$(gettext 'not the')' ${DISTRO_FILE_PREFIX}save '$(gettext 'though!')')."
  942. echo
  943. echo "'$(gettext 'No, press ENTER only to not wipe all files, or')'"
  944. echo -n "'$(gettext 'Yes, press any alpha or numeric char then ENTER to wipe all files:')' "
  945. read WIPEALL
  946. if [ "$WIPEALL" != "" ];then
  947. echo
  948. echo "'$(gettext 'Deleting everything in /mnt/data...')'"
  949. rm -rf /mnt/data/*
  950. else
  951. #well, minimum to get rid of...
  952. rm -f /mnt/data/image.gz 2> /dev/null
  953. rm -f /mnt/data/usr_cram.fs 2> /dev/null
  954. rm -f /mnt/data/pup_[0-9]*.sfs 2>/dev/null
  955. rm -f /mnt/data/${DISTRO_FILE_PREFIX}-*.sfs 2>/dev/null
  956. rm -f /mnt/data/devx_*.sfs 2>/dev/null
  957. rm -f /mnt/data/z${PREFIX1CHAR}*.sfs 2>/dev/null
  958. rm -f /mnt/data/${DISTRO_PUPPYSFS} 2>/dev/null #100913
  959. rm -f /mnt/data/${DISTRO_ZDRVSFS} 2>/dev/null #100913
  960. rm -f /mnt/data/${DISTRO_ADRVSFS} 2>/dev/null
  961. rm -f /mnt/data/${DISTRO_YDRVSFS} 2>/dev/null
  962. #rm -f /mnt/data/${DISTRO_DEVXSFS} 2>/dev/null #100913
  963. fi
  964. sync
  965. echo
  966. echo "'$(gettext 'Making')' $DESTPART '$(gettext 'bootable...')'"
  967. if [ ! "`echo "$DESTPART" | grep '[0-9]$'`" = "" ];then
  968. extlinux -i /mnt/data #i think only use -z for superfloppy.
  969. else
  970. extlinux -i -z /mnt/data
  971. fi
  972. sync
  973. echo "'$(gettext 'Copying vmlinuz...')'"
  974. cp -f $SRCPATH/vmlinuz /mnt/data/
  975. sync
  976. echo "'$(gettext 'Creating extlinux.conf...')'"
  977. FCOPY=""
  978. echo "'$(gettext 'Would you like extlinux.cfg to have')' 'pfix=copy' '$(gettext 'boot parameter?')'"
  979. echo "'$(gettext 'this will cause')' ${DISTRO_PUPPYSFS} '$(gettext 'to be copied into RAM at bootup, which slows')'"
  980. echo "'$(gettext 'bootup but speeds application startup slightly.')'"
  981. echo "'$(gettext 'Probably good to answer yes here if PC has 256MB or more RAM.')'"
  982. echo "('$(gettext 'you can edit extlinux.conf later to change the choice made here')')"
  983. echo "('$(gettext 'note, Puppy will override this and not copy if there is insufficient RAM')')"
  984. echo -n "'$(gettext 'ENTER key only for no, else any char then ENTER for yes:')' "
  985. read FCOPY
  986. [ "$FCOPY" != "" ] && FCOPY=" pfix=copy"
  987. #100321 big assumption here, that current running kernel matches one being installed...
  988. if [ -e /proc/ide ];then
  989. NODMA="ide=nodma" #old kernel
  990. else
  991. #old 'ide=nodma' does not work, need 'libata.dma=3' this enables DMA for Disk and CD/DVD but NOT for CF.
  992. NODMA="libata.dma=3"
  993. fi
  994. if [ ! -f $SRCPATH/boot.msg ];then #100321
  995. if [ "$FINALPMEDIA" = "ataflash" ];then
  996. echo "default vmlinuz initrd=initrd.gz ${NODMA} pmedia=${FINALPMEDIA}${FCOPY}" > /mnt/data/extlinux.conf
  997. else
  998. echo "default vmlinuz initrd=initrd.gz pmedia=$FINALPMEDIA$FCOPY" > /mnt/data/extlinux.conf
  999. fi
  1000. else
  1001. #100321 want a boot menu...
  1002. if [ "$FINALPMEDIA" = "ataflash" ];then
  1003. echo "default puppy
  1004. display boot.msg
  1005. prompt 1
  1006. timeout 50
  1007. F1 boot.msg
  1008. F2 help.msg
  1009. F3 help2.msg
  1010. label puppy
  1011. kernel vmlinuz
  1012. append initrd=initrd.gz ${NODMA} pmedia=${FINALPMEDIA}${FCOPY}" > /mnt/data/extlinux.conf
  1013. else
  1014. echo "default puppy
  1015. display boot.msg
  1016. prompt 1
  1017. timeout 50
  1018. F1 boot.msg
  1019. F2 help.msg
  1020. F3 help2.msg
  1021. label puppy
  1022. kernel vmlinuz
  1023. append initrd=initrd.gz pmedia=${FINALPMEDIA}${FCOPY}" > /mnt/data/extlinux.conf
  1024. fi
  1025. cp -f $SRCPATH/boot.msg /mnt/data/
  1026. cp -f $SRCPATH/help*.msg /mnt/data/
  1027. cp -f $SRCPATH/logo.16 /mnt/data/
  1028. sync
  1029. fi
  1030. #note do not create wakepup marker file as it only boots msdsos/vfat.
  1031. echo "Copying initrd.gz..."
  1032. cp -f $SRCPATH/initrd.gz /mnt/data/
  1033. sync
  1034. echo "Copying .sfs files..."
  1035. cp -f $SRCPATH/${DISTRO_PUPPYSFS} /mnt/data/ 2>/dev/null
  1036. sync
  1037. cp -f $SRCPATH/${DISTRO_ADRVSFS} /mnt/data/ 2>/dev/null
  1038. sync
  1039. cp -f $SRCPATH/${DISTRO_YDRVSFS} /mnt/data/ 2>/dev/null
  1040. sync
  1041. cp -f $SRCPATH/${DISTRO_ZDRVSFS} /mnt/data/ 2>/dev/null
  1042. sync
  1043. #cp -f $SRCPATH/${DISTRO_DEVXSFS} /mnt/data/ 2>/dev/null
  1044. #sync
  1045. umount /mnt/data
  1046. echo -n "'$(gettext 'Finished, press ENTER key to continue:')' "
  1047. read moo
  1048. ' > /tmp/installpup.sh
  1049. chmod 755 /tmp/installpup.sh
  1050. rxvt -bg "orange" -title "$(gettext 'Puppy Universal Installer')" -geometry 80x10 -e /tmp/installpup.sh $DESTPART $SRCPATH $FINALPMEDIA $DESTFS $DISTRO_FILE_PREFIX $DISTRO_PUPPYSFS $DISTRO_ADRVSFS $DISTRO_YDRVSFS $DISTRO_ZDRVSFS #$DISTRO_DEVXSFS
  1051. ;;
  1052. *)
  1053. pupmessage -bg '#FF8080' "`eval_gettext \"Your \\\$DESTPART has a \\\$DESTFS filesystem. Currently only install
  1054. to external vfat (FAT16/32) or ext2/ext3 filesystems is supported.
  1055. Click OK to quit...\"`"
  1056. exit
  1057. ;;
  1058. esac
  1059. ;;
  1060. scsihd|atahd|idehd|satahd) #internal media, boot with boot-disk or grub. #v3.98
  1061. #arrive here with DESTPART & DESTFS where installing to, PMEDIA boot param FINALPMEDIA,
  1062. #SRCPATH where to get vmlinuz, initrd, ${DISTRO_PUPPYSFS}, PUPVEROLD is old puppy version in
  1063. #format 200 (without dots) =0 if no prior installed puppy,
  1064. #NEWVER is new puppy version, DESTSIZM is size of dest partition in Mb (real number),
  1065. DESTMNTPT="`mount | grep "/dev/${DESTPART} " | head -n 1 | tr -s " " | cut -f 3 -d " "`" #120310
  1066. #120310 er, i think this only needed for older version of ntfs-3g. harmless with latest ntfs-3g...
  1067. [ "$DESTMNTPT" = "" ] && DESTMNTPT="`ps -e | grep -o 'ntfs\-3g.*' | grep "/dev/${DESTPART} " | tr '\t' ' ' | tr -s ' ' | tr ' ' "\n" | grep '^/mnt/'`" #120310
  1068. if [ "$DESTMNTPT" = "" ];then
  1069. mkdir /mnt/$DESTPART 2> /dev/null
  1070. mount -t $DESTFS /dev/$DESTPART /mnt/$DESTPART
  1071. DESTMNTPT="/mnt/$DESTPART"
  1072. fi
  1073. #choose option1 or option2 install...
  1074. #option1: files vmlinuz, initrd.gz, ${DISTRO_PUPPYSFS}, to dest partition.
  1075. #option2: file vmlinuz to partition, contents of ${DISTRO_PUPPYSFS} to partition.
  1076. if [ "$PUPVEROLD" = "0.0" ];then #110422
  1077. PREVPUPMSG="$(gettext 'It appears that this is a new installation.')"
  1078. else
  1079. PREVPUPMSG="`eval_gettext \"There appears to be an existing installation of Puppy, version \\\$PUPVEROLD,
  1080. and you may choose to upgrade or totally replace.\"`"
  1081. fi
  1082. INSTOPTION="1"
  1083. if [ "$DESTFS" != "vfat" -a "$DESTFS" != "ntfs" ];then #120126 jemimah: add ntfs exclusion.
  1084. Xdialog --wmclass "gtkdialog2" --left --buttons-style text --title "$(gettext 'Puppy Universal Installer')" --ok-label "$(gettext 'FRUGAL')" --cancel-label "$(gettext 'FULL')" --yesno "`eval_gettext \"You have chosen to install to /dev/\\\$DESTPART, which appears to be an internal
  1085. hard drive\"` ($FINALPMEDIA).
  1086. $PREVPUPMSG
  1087. $(gettext 'There are two ways to install Puppy to the partition:')
  1088. $(gettext '1. FRUGAL (recommended)')
  1089. `eval_gettext \"Copies the files vmlinuz, initrd.gz, \\\${DISTRO_PUPPYSFS}, \\\${DISTRO_ADRVSFS}, \\\${DISTRO_YDRVSFS} and \\\${DISTRO_ZDRVSFS} to the\"`
  1090. `eval_gettext \"partition, saving your personal settings inside a \\\${DISTRO_FILE_PREFIX}save file (like when\"`
  1091. $(gettext 'running from CD) and leaving the previous contents of the partition')
  1092. $(gettext 'untouched. PROS:')
  1093. - $(gettext 'Can coexist with another distro installed to the same partition.')
  1094. - $(gettext 'Can install to a non-Linux FAT or NTFS partition (former preferred).')
  1095. - $(gettext 'Easier to upgrade: just download the new .iso file and replace the above')
  1096. $(gettext 'files with their newer versions (mount the .iso to access the files).')
  1097. $(gettext '(Note: A .iso can easily be mounted in puppy just by clicking on it)')
  1098. - $(gettext 'Enables the use of .sfs addons (application combo-packs)').
  1099. - $(gettext 'Can save to entire partition if Linux f.s. and no need to coexist.')
  1100. $(gettext '2. FULL')
  1101. $(gettext 'A "normal" Linux installation, requiring usage of the entire partition by Puppy.')
  1102. $(gettext 'Note: FRUGAL option, if install to a FAT or NTFS partition, there is an')
  1103. $(gettext 'extra boot option: "WakePup2", using a floppy disk. Otherwise, GRUB is')
  1104. $(gettext 'the normal method, booting from floppy, USB or internal hard drive.')
  1105. $(gettext 'Click FRUGAL for coexist install (recommended)...')
  1106. $(gettext 'Click FULL for conventional install...')
  1107. $(gettext 'Click window close box to quit...')" 0 0
  1108. RET_VAL=$?
  1109. [ $RET_VAL -eq 255 ] && exit
  1110. [ $RET_VAL -eq 1 ] && INSTOPTION="2"
  1111. fi
  1112. #info for creating a grub entry...
  1113. DRV_TYPE="`echo -n "$DESTPART" | cut -b 1-3`" #ex: hda
  1114. GRUB_DRVN=0
  1115. for ONE_TYPE in `fdisk -l | grep "^Disk /dev/" | cut -d' ' -f2 | cut -d':' -f1 | tr '\n' ' '`
  1116. do
  1117. [ "/dev/$DRV_TYPE" = "$ONE_TYPE" ] && break
  1118. GRUB_DRVN=`expr $GRUB_DRVN + 1`
  1119. done
  1120. GRUB_PARTN=`echo -n "$DESTPART" | cut -b 4-5`
  1121. if [ $GRUB_PARTN ];then
  1122. GRUB_PARTN=`expr $GRUB_PARTN - 1`
  1123. GRUB_PARTN=",$GRUB_PARTN"
  1124. fi
  1125. #INSTOPTION, install puppy to DESTPART...
  1126. if [ "$INSTOPTION" = "1" ];then #frugal.
  1127. case $DESTFS in #100719
  1128. ext2|ext3|ext4|reiserfs|minix|btrfs|f2fs) #130216 add f2fs.
  1129. Xdialog --stdout --wmclass "gtkdialog2" --left --title "$(gettext 'Puppy Universal Installer')" --msgbox "$(gettext 'You have chosen a frugal installation. As you are installing Puppy to a')
  1130. `eval_gettext \"partition with a Linux filesystem (\\\${DESTFS}), the first time that you run\"`
  1131. $(gettext 'Puppy and shutdown you will be offered to save the session to either a single')
  1132. $(gettext 'file or to the entire partition.')
  1133. $(gettext 'A single file has convenience for backup and there can be multiple session')
  1134. $(gettext 'files, both for this installation of Puppy and for other installations of')
  1135. $(gettext 'Puppy. Saving the session to the entire partition has the advantage of all')
  1136. $(gettext 'the space available in that partition, however this is a warning for the')
  1137. $(gettext 'next dialog in this Puppy Universal Installer...')
  1138. $(gettext 'The next dialog will ask if you want to install Puppy into a sub-directory.')
  1139. $(gettext 'If you intend to, or might want to, save the session to entire partition, do')
  1140. $(gettext 'NOT install to a sub-directory, leave the folder field empty...')" 0 0
  1141. ;;
  1142. esac
  1143. #101107 fix msg, puppy now searches 2-deep...
  1144. Xdialog --stdout --wmclass "gtkdialog2" --left --title "$(gettext 'Puppy Universal Installer')" --fixed-font --no-cancel --inputbox "`eval_gettext \"Puppy is going to be installed to partition \\\${DESTPART}, which is currently\"`
  1145. `eval_gettext \"mounted on path \\\${DESTMNTPT}. As this will be a frugal install, you can\"`
  1146. $(gettext 'choose to place the Puppy files in a folder. This is very convenient if you')
  1147. $(gettext 'want to have more than one installation of Puppy. Even if you only have one')
  1148. $(gettext 'installation, it may be good to have all the Puppy files in their own folder')
  1149. $(gettext 'and so not causing any potential conflicts with other files at the top') '/'
  1150. `gettext \"level (ex: a pre-existing full Linux install may have 'initrd.gz' at '/')\"`.
  1151. $(gettext 'Enter a unique name for the folder. Note, Puppy will search 2-deep, so this')
  1152. `eval_gettext \"(for example) 'puppyfiles/pup\\\${NEWVER}' is okay. Or, a folder at the top\"`
  1153. `eval_gettext \"level, 'pup\\\${NEWVER}' is okay (of course, do not type the '). Type a string\"`
  1154. `gettext \"without any spaces, or leave blank if you want to install Puppy at '/'.\"`
  1155. `gettext \"The folders will be created if don't exist...\"`" 0 0 "${DISTRO_FILE_PREFIX}${NEWVER}frugal" >/tmp/NEWPSUBDIR #111011
  1156. [ $? -ne 0 ] && exit
  1157. NEWPSUBDIR="`cat /tmp/NEWPSUBDIR | sed -e 's%^/%%' -e 's%/$%%' -e 's%[^/a-zA-Z0-9.]%%g'`" #101107 111011
  1158. NEWPSUBCNT=`echo -n "$NEWPSUBDIR" | sed -e 's%[^/]%%g' | wc -c` #101107
  1159. [ $NEWPSUBCNT -gt 2 ] && NEWPSUBDIR="`echo -n "$NEWPSUBDIR" | sed -e 's%/%%g'`" #101107 too many '/' chars.
  1160. /usr/lib/gtkdialog/box_splash -text "`eval_gettext \"Please wait, copying files to \\\$DESTPART, in folder \\\$NEWPSUBDIR...\"`" &
  1161. XPID=$!
  1162. mkdir -p $DESTMNTPT/$NEWPSUBDIR
  1163. cp -f $SRCPATH/vmlinuz $DESTMNTPT/$NEWPSUBDIR/
  1164. sync
  1165. cp -f $SRCPATH/initrd.gz $DESTMNTPT/$NEWPSUBDIR/
  1166. sync
  1167. cp -f ${SRCPATH}/${DISTRO_PUPPYSFS} $DESTMNTPT/$NEWPSUBDIR/ #v424
  1168. sync
  1169. [ -f $SRCPATH/${DISTRO_ADRVSFS} ] && cp -f $SRCPATH/${DISTRO_ADRVSFS} $DESTMNTPT/$NEWPSUBDIR/
  1170. sync
  1171. [ -f $SRCPATH/${DISTRO_YDRVSFS} ] && cp -f $SRCPATH/${DISTRO_YDRVSFS} $DESTMNTPT/$NEWPSUBDIR/
  1172. sync
  1173. [ -f $SRCPATH/${DISTRO_ZDRVSFS} ] && cp -f $SRCPATH/${DISTRO_ZDRVSFS} $DESTMNTPT/$NEWPSUBDIR/
  1174. sync
  1175. sync
  1176. FPCAPS="`echo -n "$FINALPMEDIA" | tr [a-z] [A-Z]`"
  1177. touch $DESTMNTPT/$NEWPSUBDIR/$FPCAPS #needed by WakePup
  1178. sync
  1179. kill $XPID
  1180. umount /dev/$DESTPART
  1181. if [ "`echo -n "$DESTFS" | grep -E 'msdos|vfat'`" != "" ];then
  1182. Xdialog --wmclass "gtkdialog2" --left --title "$(gettext 'Puppy Universal Installer')" --ok-label "$(gettext 'CREATE_BOOT_DISK')" --cancel-label "$(gettext 'NO_BOOT_DISK')" --yesno "
  1183. $(gettext 'A floppy disk can be used to boot Puppy.')
  1184. $(gettext 'Currently we are offering WakePup2, a generic boot floppy')
  1185. $(gettext 'that scans the PC and finds where Puppy is installed.')
  1186. $(gettext 'Note, after this, you will be informed how to configure the')
  1187. $(gettext 'Grub bootloader.')" 0 0
  1188. if [ $? -eq 0 ];then
  1189. /usr/sbin/wakepup2
  1190. fi
  1191. fi
  1192. xNEWPSUBDIR=""
  1193. OPTIONPSUBDIR=""
  1194. if [ "$NEWPSUBDIR" != "" ];then
  1195. xNEWPSUBDIR="/$NEWPSUBDIR"
  1196. OPTIONPSUBDIR=" psubdir=${NEWPSUBDIR}"
  1197. fi
  1198. if [ -e /proc/ide ];then #v3.97
  1199. grubEXTRAMSG=""
  1200. else
  1201. grubEXTRAMSG="
  1202. `eval_gettext \"WARNING: If your PC has a mix of IDE and SATA hard drives, then (hd\\\${GRUB_DRVN}\\\${GRUB_PARTN})\"`
  1203. $(gettext 'may be wrong. GRUB numbers drives as hd<drive>,<partition> where')
  1204. $(gettext '<drive> and <partition> numbering starts from zero. The problem is')
  1205. $(gettext 'that GRUB sees IDE drives first (hd0,), whereas if you look at Pmount')
  1206. $(gettext 'you may see it listed second (hd1,). The Uni. Installer uses the')
  1207. $(gettext 'ordering as reported by Pmount, which may be wrong for GRUB!')
  1208. $(gettext '(EX: if an IDE drive is hd1,0 (sdb1), may need to be changed to hd0,0)')"
  1209. fi
  1210. #091211...
  1211. echo "`gettext \"If you have GRUB installed, find the 'menu.lst' file (usually in /boot
  1212. in the partition in which GRUB is installed) and insert this:\"`
  1213. " > /tmp/NEWGRUBTEXT
  1214. echo "title Puppy Linux ${NEWVER} frugal in ${DESTPART} dir ${NEWPSUBDIR}
  1215. rootnoverify (hd${GRUB_DRVN}${GRUB_PARTN})
  1216. kernel ${xNEWPSUBDIR}/vmlinuz pmedia=${FINALPMEDIA}${OPTIONPSUBDIR}
  1217. initrd ${xNEWPSUBDIR}/initrd.gz
  1218. " >> /tmp/NEWGRUBTEXT
  1219. echo "`gettext \"If you have GRUB4DOS installed, find the 'menu.lst' file (usually in /
  1220. in the partition in which GRUB4DOS is installed) and insert this:\"`
  1221. " >> /tmp/NEWGRUBTEXT
  1222. echo "title Puppy Linux ${NEWVER} frugal in ${DESTPART} dir ${NEWPSUBDIR}
  1223. find --set-root --ignore-floppies ${xNEWPSUBDIR}/initrd.gz
  1224. kernel ${xNEWPSUBDIR}/vmlinuz pmedia=${FINALPMEDIA}${OPTIONPSUBDIR}
  1225. initrd ${xNEWPSUBDIR}/initrd.gz" >> /tmp/NEWGRUBTEXT
  1226. nohup defaulttextviewer /tmp/NEWGRUBTEXT &
  1227. sleep 3
  1228. Xdialog --wmclass "gtkdialog2" --left --title "$(gettext 'Puppy Universal Installer')" --msgbox "$(gettext 'Now you can manually setup your GRUB, GRUB4DOS, LILO or other boot system.')
  1229. `eval_gettext \"Partition \\\$DESTPART has the files vmlinuz, initrd.gz and \\\${DISTRO_PUPPYSFS}\"`
  1230. $(gettext 'on it, where vmlinuz is the kernel, initrd.gz is the initial ramdisk and')
  1231. ${DISTRO_PUPPYSFS} $(gettext 'is all the Puppy-files.')
  1232. $(gettext 'If you already have GRUB or GRUB4DOS installed, see the text editor')
  1233. $(gettext 'window for text that can be inserted into') 'menu.lst'.
  1234. $(gettext 'If you do NOT have GRUB or GRUB4DOS (or any other boot manager) installed,')
  1235. `gettext \"just click the 'OK' button to finish the installation, then go to the\"`
  1236. `gettext \"'System' menu and run the GRUB or GRUB4DOS installer (you probably will\"`
  1237. $(gettext 'not need the text in the text editor window, as the installers will probe')
  1238. $(gettext 'your PC for all installations of Puppy and other operating systems)').
  1239. ${grubEXTRAMSG}" 0 0
  1240. #finished. could put up a final dlg here, then quit script.
  1241. Xdialog --wmclass "gtkdialog2" --title "$(gettext 'Puppy Universal Installer')" --msgbox "$(gettext 'Okay, all done!')" 0 0
  1242. exit
  1243. else #h.d. install option2
  1244. #upgrade, ask if want delete partition...
  1245. Xdialog --wmclass "gtkdialog2" --left --buttons-style text --title "$(gettext 'Puppy Universal Installer')" --ok-label "$(gettext 'UPGRADE')" --cancel-label "$(gettext 'WIPE')" --yesno "$(eval_gettext "There is already a version of Puppy installed in \${DESTPART}.")\n$(gettext 'Do you want to upgrade, or totally wipe the partition?')\n\n$(eval_gettext "FINAL SANITY CHECK: ARE YOU SURE \${DESTPART} IS THE RIGHT PARTITION?")\n$(eval_gettext "(note, \${DESTPART} is currently mounted on \${DESTMNTPT} -- okay?)")\n\n$(gettext 'Select UPGRADE button to upgrade...')\n$(gettext 'Select WIPE button to wipe partition...')\n$(gettext 'Click window Close box to quit...')" 0 0
  1246. RET_VAL=$?
  1247. if [ $RET_VAL -eq 255 ];then
  1248. rox -D "$DESTMNTPT"
  1249. sync
  1250. umount $DESTMNTPT 2>/dev/null
  1251. exit
  1252. fi
  1253. if [ $RET_VAL -eq 1 ];then #no
  1254. Xdialog --wmclass "gtkdialog2" --title "$(gettext 'Puppy Universal Installer')" --no-buttons --infobox "$(gettext 'Please wait, wiping all files in') $DESTPART..." 0 0 200000 &
  1255. XPID=$!
  1256. sleep 3
  1257. rm -rf $DESTMNTPT/*
  1258. sync
  1259. kill $XPID
  1260. #PUPVEROLD=`expr $DISTRO_VERSION - 1` #v430
  1261. PUPVEROLD='0.0' #110422
  1262. fi
  1263. #fi
  1264. Xdialog --wmclass "gtkdialog2" --title "$(gettext 'Puppy Universal Installer')" --no-buttons --infobox "$(gettext 'Please wait, copying Puppy files to') $DESTPART..." 0 0 120000 &
  1265. XPID=$!
  1266. sleep 1
  1267. cp -f /etc/profile /tmp/profile-before_upgrade #120823 rerwin: preserve user-modified files in full-install upgrade.
  1268. #loop-device mount ${DISTRO_PUPPYSFS} in DESTPART, copy contents of ${DISTRO_PUPPYSFS} to DESTPART...
  1269. losetup-FULL /dev/loop2 $SRCPATH/$DISTRO_PUPPYSFS #100913
  1270. mkdir $DESTMNTPT/srcmntpt
  1271. mount -r -t squashfs /dev/loop2 $DESTMNTPT/srcmntpt
  1272. cp -a -u --remove-destination $DESTMNTPT/srcmntpt/bin $DESTMNTPT/
  1273. cp -a -u --remove-destination $DESTMNTPT/srcmntpt/dev $DESTMNTPT/
  1274. cp -a -u --remove-destination $DESTMNTPT/srcmntpt/etc $DESTMNTPT/
  1275. cp -a -u --remove-destination $DESTMNTPT/srcmntpt/lib $DESTMNTPT/
  1276. cp -a -u --remove-destination $DESTMNTPT/srcmntpt/mnt $DESTMNTPT/
  1277. cp -a -u --remove-destination $DESTMNTPT/srcmntpt/proc $DESTMNTPT/
  1278. cp -a -u --remove-destination $DESTMNTPT/srcmntpt/root $DESTMNTPT/
  1279. cp -a -u --remove-destination $DESTMNTPT/srcmntpt/sbin $DESTMNTPT/
  1280. cp -a -u --remove-destination $DESTMNTPT/srcmntpt/tmp $DESTMNTPT/
  1281. cp -a -u --remove-destination $DESTMNTPT/srcmntpt/usr $DESTMNTPT/
  1282. cp -a -u --remove-destination $DESTMNTPT/srcmntpt/var $DESTMNTPT/
  1283. [ -d $DESTMNTPT/srcmntpt/opt ] && cp -a -u --remove-destination $DESTMNTPT/srcmntpt/opt $DESTMNTPT/ #v2.11
  1284. #130613 puppy currently has /run a symlink to /tmp, but don't assume this always. create as-is...
  1285. cp -a -f --remove-destination $DESTMNTPT/srcmntpt/run $DESTMNTPT/
  1286. #v2.12 external modules file...
  1287. #w482 fix handling if separate zdrv file...
  1288. [ -f $SRCPATH/${DISTRO_ADRVSFS} ] && cp -af $SRCPATH/${DISTRO_ADRVSFS} $DESTMNTPT/
  1289. [ -f /${DISTRO_ADRVSFS} ] && cp -af /${DISTRO_ADRVSFS} $DESTMNTPT/
  1290. if [ -f $DESTMNTPT/${DISTRO_ADRVSFS} ];then #w482
  1291. mkdir -p $DESTMNTPT/data
  1292. mount -t squashfs -o loop $DESTMNTPT/${DISTRO_ADRVSFS} $DESTMNTPT/data
  1293. cp -a -f --remove-destination $DESTMNTPT/data/* $DESTMNTPT/
  1294. depmod -b $DESTMNTPT
  1295. sync
  1296. umount $DESTMNTPT/data
  1297. rm -f $DESTMNTPT/${DISTRO_ADRVSFS}
  1298. fi
  1299. [ -f $SRCPATH/${DISTRO_YDRVSFS} ] && cp -af $SRCPATH/${DISTRO_YDRVSFS} $DESTMNTPT/
  1300. [ -f /${DISTRO_YDRVSFS} ] && cp -af /${DISTRO_YDRVSFS} $DESTMNTPT/
  1301. if [ -f $DESTMNTPT/${DISTRO_YDRVSFS} ];then #w482
  1302. mkdir -p $DESTMNTPT/data
  1303. mount -t squashfs -o loop $DESTMNTPT/${DISTRO_YDRVSFS} $DESTMNTPT/data
  1304. cp -a -f --remove-destination $DESTMNTPT/data/* $DESTMNTPT/
  1305. depmod -b $DESTMNTPT
  1306. sync
  1307. umount $DESTMNTPT/data
  1308. rm -f $DESTMNTPT/${DISTRO_YDRVSFS}
  1309. fi
  1310. [ -f $SRCPATH/${DISTRO_ZDRVSFS} ] && cp -af $SRCPATH/${DISTRO_ZDRVSFS} $DESTMNTPT/
  1311. [ -f /${DISTRO_ZDRVSFS} ] && cp -af /${DISTRO_ZDRVSFS} $DESTMNTPT/
  1312. if [ -f $DESTMNTPT/${DISTRO_ZDRVSFS} ];then #w482
  1313. mkdir -p $DESTMNTPT/data
  1314. mount -t squashfs -o loop $DESTMNTPT/${DISTRO_ZDRVSFS} $DESTMNTPT/data
  1315. cp -a -f --remove-destination $DESTMNTPT/data/* $DESTMNTPT/
  1316. depmod -b $DESTMNTPT
  1317. sync
  1318. umount $DESTMNTPT/data
  1319. rm -f $DESTMNTPT/${DISTRO_ZDRVSFS}
  1320. fi
  1321. #w482 put these modules back into the normal places...
  1322. if [ -d /lib/modules/$KERNELVER/initrd ];then
  1323. #note, important to not have 'initrd' folder in full hd installation, messes up rc.sysinit.
  1324. cp -af /lib/modules/$KERNELVER/initrd/* $DESTMNTPT/lib/modules/$KERNELVER/
  1325. depmod -b $DESTMNTPT
  1326. fi
  1327. #100113 /bin/TARGETEXES has list of executables that were copied from initrd (and not in main f.s.)...
  1328. if [ -f /bin/TARGETEXES ];then
  1329. for ONEEXE in `cat /bin/TARGETEXES` #ex: sbin/e2fsck
  1330. do
  1331. DIREXE="`dirname $ONEEXE`"
  1332. cp -a -f --remove-destination /${ONEEXE} ${DESTMNTPT}/${DIREXE}/
  1333. done
  1334. fi
  1335. #same thing here...
  1336. if [ -d /lib/keymaps ];then
  1337. mkdir -p ${DESTMNTPT}/lib/keymaps
  1338. cp -a -f /lib/keymaps/* ${DESTMNTPT}/lib/keymaps/
  1339. mkdir -p ${DESTMNTPT}/lib/consolefonts
  1340. cp -a -f /lib/consolefonts/* ${DESTMNTPT}/lib/consolefonts/
  1341. fi
  1342. mkdir $DESTMNTPT/sys 2>/dev/null
  1343. rm -f $DESTMNTPT/var/log/modprobes.log 2>/dev/null #v2.13 see /sbin/modprobe script.
  1344. #...not necessary, not using this any more.
  1345. echo '#ATADRIVES is all internal ide/pata/sata drives...' >> $DESTMNTPT/etc/rc.d/PUPSTATE
  1346. echo "ATADRIVES='$ATADRIVES'" >> $DESTMNTPT/etc/rc.d/PUPSTATE
  1347. #fi
  1348. sync
  1349. kill $XPID
  1350. #fix space optimisation links into initrd...
  1351. #TODO
  1352. #chroot to DESTPART, set DISTRO_VERSION back to $PUPVEROLD, run rc.update
  1353. Xdialog --wmclass "gtkdialog2" --title "$(gettext 'Puppy Universal Installer')" --no-buttons --infobox "$(gettext 'Please wait, executing rc.update script...')" 0 0 60000 &
  1354. XPID=$!
  1355. sleep 2
  1356. if [ -f $DESTMNTPT/etc/puppyversion ];then #historical file, old installations.
  1357. echo -n "$PUPVEROLD" > $DESTMNTPT/etc/puppyversion #set it back to what it was.
  1358. fi
  1359. if [ -f $DESTMNTPT/etc/DISTRO_SPECS ];then
  1360. vPATTERN="s%^DISTRO_VERSION=.*%DISTRO_VERSION='${PUPVEROLD}'%" #110422
  1361. sed -e "$vPATTERN" $DESTMNTPT/etc/DISTRO_SPECS > /tmp/distro_specs_old
  1362. cp -f /tmp/distro_specs_old $DESTMNTPT/etc/DISTRO_SPECS #set DISTRO_VERSION back to what it was.
  1363. fi
  1364. #busybox chroot does not have -c ...
  1365. FLAGDEVMISS=0
  1366. if [ ! -e $DESTMNTPT/dev/null ];then #130613 recent pups have empty /dev. rc.update may need these...
  1367. cp -a /dev/console $DESTMNTPT/dev/
  1368. cp -a /dev/null $DESTMNTPT/dev/
  1369. FLAGDEVMISS=1
  1370. fi
  1371. chroot $DESTMNTPT /etc/rc.d/rc.update option2hdinstall
  1372. if [ $FLAGDEVMISS -eq 1 ];then #130613
  1373. rm -f $DESTMNTPT/dev/console
  1374. rm -f $DESTMNTPT/dev/null
  1375. fi
  1376. #(need to tell rc.update where src files are, as passed param)
  1377. sync
  1378. mv -f $DESTMNTPT/etc/fstab $DESTMNTPT/etc/fstab.bak
  1379. echo "/dev/$DESTPART / $DESTFS defaults 0 1" > $DESTMNTPT/etc/fstab
  1380. echo "none /proc proc defaults 0 0" >> $DESTMNTPT/etc/fstab
  1381. echo "none /sys sysfs defaults 0 0" >> $DESTMNTPT/etc/fstab
  1382. echo "none /dev/pts devpts gid=2,mode=620 0 0" >> $DESTMNTPT/etc/fstab
  1383. echo "/dev/fd0 /mnt/floppy auto noauto,rw 0 0" >> $DESTMNTPT/etc/fstab
  1384. sync
  1385. kill $XPID
  1386. umount $DESTMNTPT/srcmntpt
  1387. rmdir $DESTMNTPT/srcmntpt
  1388. fi
  1389. #make bootable...
  1390. #usb/floppy boot disk, or grub.
  1391. while [ "$INSTOPTION" = "2" ];do
  1392. #091210 simpler stuff for grub4dos...
  1393. if [ -f /usr/sbin/grub4dosconfig ];then
  1394. mkdir -p /mnt/$DESTPART/boot/grub
  1395. cp -af $SRCPATH/vmlinuz /mnt/$DESTPART/boot/
  1396. sync
  1397. umount /mnt/$DESTPART
  1398. unmountcdfunc
  1399. echo "
  1400. `gettext \"If you have GRUB installed, find the 'menu.lst' file (usually in /boot
  1401. in the partition in which GRUB is installed) and insert the text,
  1402. or, if you have GRUB4DOS installed, find the 'menu.lst' file (usually
  1403. in / in the partition in which GRUB4DOS is installed) and insert this:\"`
  1404. " > /tmp/NEWGRUBTEXT
  1405. echo "title Puppy Linux ${NEWVER} full install in ${DESTPART}
  1406. root (hd${GRUB_DRVN}${GRUB_PARTN})
  1407. kernel /boot/vmlinuz root=/dev/${DESTPART} pmedia=${FINALPMEDIA}
  1408. `eval_gettext \"WARNING: If your PC has a mix of IDE and SATA hard drives, then (hd\\\${GRUB_DRVN}\\\${GRUB_PARTN})
  1409. may be wrong. GRUB numbers drives as hd<drive>,<partition> where
  1410. <drive> and <partition> numbering starts from zero. The problem is
  1411. that GRUB sees IDE drives first (hd0,), whereas if you look at Pmount
  1412. you may see it listed second (hd1,). The Uni. Installer uses the
  1413. ordering as reported by Pmount, which may be wrong for GRUB!
  1414. (EX: if an IDE drive is hd1,0 (sdb1), may need to be changed to hd0,0)\"`" >> /tmp/NEWGRUBTEXT
  1415. nohup defaulttextviewer /tmp/NEWGRUBTEXT &
  1416. sleep 3
  1417. Xdialog --wmclass "gtkdialog2" --left --buttons-style text --title "$(gettext 'Puppy Universal Installer')" --ok-label "OK" --msgbox "$(gettext 'If all went well, Puppy has been installed to') $DESTPART.\n\
  1418. $(gettext 'The text-editor window shows text that you can insert into the menu.lst')
  1419. $(gettext 'file if you have GRUB or GRUB4DOS inststalled.')
  1420. $(gettext 'If your PC does not have GRUB, GRUB4DOS, LILO or any other boot manager')
  1421. $(gettext 'installed, or you want to do a reinstallation, just click the ')'OK'
  1422. `gettext \"button to finish the Universal Installer, then go to the 'System' menu\"`
  1423. `gettext \"and run the GRUB or GRUB4DOS installer -- this will probe your PC, so\"`
  1424. `gettext \"you probably won't need the contents of the text-editor...\"`" 0 0
  1425. break
  1426. fi
  1427. #TODO needs work, as could have usb hd, that cannot unplug and do not want it to be turned
  1428. # into a boot disk!...
  1429. Xdialog --wmclass "gtkdialog2" --left --buttons-style text --title "$(gettext 'Puppy Universal Installer')" --ok-label "$(gettext 'Boot from USB')" --cancel-label "$(gettext 'Install/update GRUB')" --yesno "$(gettext 'If all went well, Puppy has been installed to') $DESTPART.\n\
  1430. $(gettext 'But, now we have the sometimes-difficult part, how to make Puppy bootable.')\n\
  1431. $(gettext 'You can do one, or both, of these:')\n\
  1432. \n\
  1433. $(gettext 'Boot disk: Use a floppy disk or USB pen drive to boot Puppy.')\n\
  1434. GRUB: $(gettext 'Install GRUB in the hard drive (or update existing GRUB)').\n\
  1435. \n\
  1436. `gettext \"Click 'Boot from USB' if you want to sacrifice a usb Flash pen drive as a\"`\n\
  1437. `gettext \"'boot disk'. This Universal Installer script will return to this dialog\"`\n\
  1438. `gettext \"window after creating the USB 'boot disk'.\"`\n\
  1439. $(gettext 'Note, you would probably only choose this if your PC does not have a floppy')\n\
  1440. $(gettext 'drive and you do not want to install GRUB to the hard drive.')\n\
  1441. \n\
  1442. `gettext \"Click 'Install/update GRUB' to install (or update) the GRUB boot manager.\"`\n\
  1443. `gettext \"You will be given the opportunity to create a floppy 'boot disk' as well\"`\n\
  1444. `gettext \"as install GRUB to the hard drive.\"`\n\
  1445. \n\
  1446. $(gettext 'FOR USB BOOT DISK CHOICE, PLEASE INSERT IT RIGHT NOW BEFORE PROCEEDING!')\n\
  1447. ($(gettext 'must have FAT16 f.s., and any files in it will be deleted'))\n\
  1448. $(gettext 'IT MUST ALSO BE UNMOUNTED -- BE SURE BEFORE PROCEEDING')" 0 0
  1449. if [ $? -eq 0 ];then #BOOT DISK
  1450. BOOTPART=""
  1451. #v3.96...
  1452. USBDRIVES="`echo "$PROBEDISK" | grep '|usbdrv|' | cut -f 3 -d '/' | cut -f 1 -d '|' | tr "\n" " "`"
  1453. for ONEUSB in $USBDRIVES
  1454. do
  1455. [ "$ATADRIVES" != "" ] && [ "`echo "$ATADRIVES" | grep "$ONEUSB"`" != "" ] && continue #eliminate ide/sata drives. v3.97
  1456. if [ "`disktype /dev/$ONEUSB | grep "file system" | grep "^FAT"`" != "" ];then
  1457. BOOTPART="$ONEUSB"
  1458. break
  1459. fi
  1460. if [ "`disktype /dev/${ONEUSB}1 | grep "file system" | grep "^FAT"`" != "" ];then
  1461. BOOTPART="${ONEUSB}1"
  1462. break
  1463. fi
  1464. done
  1465. if [ ! "$BOOTPART" = "" ];then
  1466. Xdialog --wmclass "gtkdialog2" --left --title "$(gettext 'Puppy Universal Installer')" --ok-label "$Yes_lbl" --cancel-label "$No_lbl" --yesno "`eval_gettext \"Please confirm that you want to make '\\\$BOOTPART' into a boot disk for Puppy.\nIf Puppy has mis-identified the device, then answer 'No' here...\n\nClick 'Yes' button if correct device...\"`" 0 0
  1467. [ ! $? -eq 0 ] && continue
  1468. fi
  1469. if [ ! "$BOOTPART" = "" ];then
  1470. cp -af $SRCPATH/vmlinuz /mnt/$DESTPART/
  1471. sync
  1472. Xdialog --wmclass "gtkdialog2" --title "$(gettext 'Puppy Universal Installer')" --msgbox "`eval_gettext \"Creating \\\$BOOTPART boot disk...\"`" 0 0 &
  1473. XPID=$!
  1474. #passed params $BOOTPART $DESTPART $SRCPATH $FINALPMEDIA
  1475. echo '#!/bin/sh
  1476. BOOTPART="$1"
  1477. DESTPART="$2"
  1478. SRCPATH="$3"
  1479. FINALPMEDIA="$4"
  1480. mkdir /tmp/bootdiskmntpt 2> /dev/null
  1481. mount -t msdos /dev/$BOOTPART /tmp/bootdiskmntpt
  1482. rm -rf /tmp/bootdiskmntpt/*
  1483. echo "'$(gettext 'Creating syslinux.cfg on /dev/')'$BOOTPART..."
  1484. echo "default vmlinuz root=/dev/$DESTPART pmedia=$FINALPMEDIA" > /tmp/bootdiskmntpt/syslinux.cfg
  1485. echo "'$(gettext 'Writing the Linux kernel, vmlinuz, to')' /dev/$BOOTPART..."
  1486. cp -f $SRCPATH/vmlinuz /tmp/bootdiskmntpt/
  1487. sync
  1488. umount /dev/$BOOTPART
  1489. rmdir /tmp/bootdiskmntpt
  1490. echo "'$(gettext 'Making the')' /dev/$BOOTPART '$(gettext 'bootable using Syslinux...')'"
  1491. syslinux /dev/$BOOTPART
  1492. sync
  1493. echo -n "'$(gettext 'Done. Press ENTER key:')' "
  1494. read allisdone
  1495. ' > /tmp/installpup.sh
  1496. chmod 755 /tmp/installpup.sh
  1497. rxvt -bg "orange" -title "$(gettext 'Puppy Universal Installer')" -geometry 80x10 -e /tmp/installpup.sh $BOOTPART $DESTPART $SRCPATH $FINALPMEDIA
  1498. kill $XPID
  1499. fi
  1500. else #Grub
  1501. mkdir -p /mnt/$DESTPART/boot/grub
  1502. cp -af $SRCPATH/vmlinuz /mnt/$DESTPART/boot/
  1503. sync
  1504. umount /mnt/$DESTPART
  1505. unmountcdfunc
  1506. if [ -e /proc/ide ];then #v3.97
  1507. grubEXTRAMSG=""
  1508. else
  1509. grubEXTRAMSG="
  1510. $(gettext 'WARNING: If your PC has a mix of IDE and SATA hard drives, then')
  1511. $(gettext 'GRUB may get the drive numbering wrong. In which case, you may')
  1512. $(gettext 'have to manually edit the entry or entries in /boot/grub/menu.lst')
  1513. $(gettext 'in the partition where GRUB is installed. This problem has come')
  1514. $(gettext 'with recent Linux kernels where IDE drives are now /dev/sd*, the')
  1515. $(gettext 'same letters as SATA drives, whereas before they were /dev/hd*.')
  1516. $(gettext 'GRUB uses "hd" notation for both IDE and SATA drives, and numbers')
  1517. $(gettext 'drives as hd<drive>,<partition> where <drive> and <partition> numbering')
  1518. $(gettext 'starts from zero (again different, as Linux numbers partitions from 1).')
  1519. $(gettext 'The problem is that GRUB sees IDE drives first (hd0,), whereas if you')
  1520. $(gettext 'look at Pmount you may see it listed second (hd1,). The Uni. Installer')
  1521. $(gettext 'uses the ordering as reported by Pmount, which may be wrong for GRUB!')
  1522. ($(gettext 'EX: if an IDE drive is hd1,0 (sdb1), may need to be changed to hd0,0'))"
  1523. fi
  1524. Xdialog --buttons-style "text" --wmclass "gtkdialog2" --left --title "$(gettext 'Universal Installer')" --ok-label "$(gettext 'UPDATE')" --cancel-label "$(gettext 'INSTALL')" --yesno "$(gettext 'Click UPDATE button if you want to update an existing installation')
  1525. $(gettext 'of GRUB, or click INSTALL to install or reinstall GRUB...')
  1526. ${grubEXTRAMSG}" 0 0
  1527. if [ $? -eq 0 ];then #v3.96 update grub.
  1528. echo "title Puppy Linux $NEWVER full install
  1529. root (hd${GRUB_DRVN}${GRUB_PARTN})
  1530. kernel /boot/vmlinuz root=/dev/$DESTPART pmedia=${FINALPMEDIA}" > /tmp/NEWGRUBTEXT
  1531. if [ -e /proc/ide ];then #v3.97
  1532. grubEXTRAMSG="$(gettext '...for your convenience, this text has been written to') /tmp/NEWGRUBTEXT"
  1533. else
  1534. grubEXTRAMSG="$(gettext '...for your convenience, this text has been written to') /tmp/NEWGRUBTEXT
  1535. $(gettext 'WARNING: If your PC has a mix of IDE and SATA hard drives, then') (hd${GRUB_DRVN}${GRUB_PARTN})
  1536. $(gettext 'may be wrong. GRUB numbers drives as hd<drive>,<partition> where')
  1537. $(gettext '<drive> and <partition> numbering starts from zero. The problem is')
  1538. $(gettext 'that GRUB sees IDE drives first (hd0,), whereas if you look at Pmount')
  1539. $(gettext 'you may see it listed second (hd1,). The Uni. Installer uses the')
  1540. $(gettext 'ordering as reported by Pmount, which may be wrong for GRUB!')
  1541. ($(gettext 'EX: if an IDE drive is hd1,0 (sdb1), may need to be changed to hd0,0'))"
  1542. fi
  1543. Xdialog --wmclass "gtkdialog2" --left --title "$(gettext 'Universal Installer')" --msgbox "$(gettext 'You have chosen to update an existing GRUB installation.')
  1544. $(gettext 'This requires a final manual step...')
  1545. $(gettext 'Find the "menu.lst" file (usually in /boot/grub in the')
  1546. $(gettext 'partition in which GRUB is installed) and insert this:')
  1547. title Puppy Linux $NEWVER full install in $DESTPART
  1548. root (hd${GRUB_DRVN}${GRUB_PARTN})
  1549. kernel /boot/vmlinuz root=/dev/$DESTPART pmedia=${FINALPMEDIA}
  1550. $grubEXTRAMSG
  1551. $(gettext 'After you click the OK button, the Uni. Installer will exit.')" 0 0
  1552. exit
  1553. else
  1554. Xdialog --wmclass "gtkdialog2" --left --title "$(gettext 'Puppy Universal Installer')" --msgbox "$(gettext '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
  1555. while [ 1 ];do
  1556. grubconfig /dev/$DESTPART
  1557. #...if choose to create a boot floppy, writes 'no' to /tmp/loopbrk.txt.
  1558. Xdialog --wmclass "gtkdialog2" --title "$(gettext 'Universal Installer')" --ok-label "$Yes_lbl" --cancel-label "$No_lbl" --yesno "$(gettext 'If you have already run grubconfig to create a boot floppy or installed')\n\
  1559. `gettext \"to h.d., click 'Yes' button to rerun grubconfig script to either create\"`\n\
  1560. `gettext \"another boot floppy or install or reinstall GRUB to the hard drive.\"`\n\
  1561. `gettext \"If choose 'Yes', just accept all the defaults as before.\"`\n\
  1562. \n\
  1563. `gettext \"Click 'Yes' to rerun grubconfig...\"`\n\
  1564. `gettext \"Click 'No' if installation finished...\"`" 0 0
  1565. [ ! $? -eq 0 ] && break
  1566. done
  1567. rm -f /tmp/loopbrk.txt
  1568. exit
  1569. fi
  1570. fi
  1571. Xdialog --wmclass "gtkdialog2" --title "$(gettext 'Puppy Universal Installer')" --ok-label "$Yes_lbl" --cancel-label "$No_lbl" --yesno "$(gettext 'Do you want to go back and create another boot disk or Grub boot?...')" 0 0
  1572. [ ! $? -eq 0 ] && break
  1573. done
  1574. umount /mnt/$DESTPART 2> /dev/null
  1575. ;;
  1576. atacd|scsicd|usbcd)
  1577. pupmessage -bg '#FF8080' "$(gettext 'not yet implemented')"
  1578. #TO DO
  1579. ;;
  1580. esac
  1581. unmountcdfunc
  1582. ###END###