bootmanager 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. #!/bin/ash
  2. #BK 2007, original idea from sunburnt
  3. #Lesser GPL licence v2 (/usr/share/doc/legal). 2007 www.puppylinux.com
  4. #written for Puppy 2.16.
  5. #/etc/rc.d/BOOTCONFIG has variable EXTRASFSLIST='kde.sfs devx_216.sfs'
  6. # ...space-delimited list of .sfs files to be loaded.
  7. # ...must be located at same place as the pup_save file (in /mnt/home)
  8. # or at '/' for full hd installation.
  9. #v2.17
  10. #/etc/rc.d/MODULESCONFIG has variables PCI_OVERRIDES, SKIPLIST
  11. #that are read and managed by the BootManager.
  12. #v4.02 bugfix, modules now .ko.gz.
  13. #v4.02 /lib/modules/modules.dep.<kernver> no more.
  14. #v403 yeslist_func, parameters may be added to modules.
  15. #v409 bugfix, list of sfs files was picking up non-sfs files.
  16. #v411 bugfix, when choose to add more than one module.
  17. #v412 /etc/DISTRO_SPECS, renamed pup_xxx.sfs, pup_save.2fs etc.
  18. #w001 pup files renamed to woofr001.sfs, woofsave.2fs.
  19. #w007 renamed to woof-007.sfs
  20. #w015 allow 6 extra sfs files, up from 3. w020 zdrv fix.
  21. #w478 file prefix 'pup2' got screened out.
  22. #v423 need to check sfs 3.x or 4.x.
  23. #v424 do away with checkbox that overrides user choice and loads _nnn.sfs only.
  24. #v424 advise of sfs-version-converter.
  25. #100125 manage system services at bootup.
  26. #100221 slight change to a message. 100301 add msg for lameSMBxplorer.
  27. #100518 fixed showed wrong partition for /mnt/home.
  28. #100607 kernel 2.6.27.47 has squashfs4.
  29. #100710 if pupsave file is in a subdirectory, only look for extra sfs's in that subdirectory.
  30. #100711 modify to look in both top dir and subdirectory.
  31. #100809 some inappropriate sfs files were displaying as candidates in dual-pane window.
  32. #100831 fix KERNELSUBVER for olpc people, have 'uname -r' returning version with '_'.
  33. #100913 new simplified puppy filenames.
  34. #101221 yaf-splash fix.
  35. #110305 refine code for blacklist module.
  36. #110422 DISTRO_VERSION variable now has dotted format. note, also now using full dotted version# in puppy filenames.
  37. #110505 support sudo for non-root user.
  38. #111011 now using pupdialog instead of Xdialog for sfs chooser.
  39. #111015 support kernel 3.x.
  40. #111113 roll back to Xdialog for sfs chooser. pupdialog limited items, some people have 100s sfs's.
  41. #120201 rodin.s: internationalized.
  42. #120323 replace 'xmessage' with 'pupmessage'.
  43. #120527 shinobar's sfs-load on-the-fly pet has /etc/rc.d/BOOTCONFIG.save, sync it.
  44. #120626 only offer to load sfs files if have layered f.s., mention sfs_load.
  45. #121125 when install a Service Pack, DISTRO_VERSION gets bumped, however may still want to load devx*_<old-version>.sfs, remove filter.
  46. #131126 zigbert: gui (gtkdialog) improvements.
  47. [ "`whoami`" != "root" ] && exec sudo -A ${0} ${@} #110505
  48. export TEXTDOMAIN=bootmanager
  49. export OUTPUT_CHARSET=UTF-8
  50. . gettext.sh
  51. #reentrant.
  52. #$1='' then run the main window.
  53. #$1=extrasfs then run the extrasfs_func.
  54. CLPARAM1="$1"
  55. CLPARAM2="$2"
  56. MY_SELF="$0"
  57. CURRDIR="`pwd`"
  58. . /etc/rc.d/PUPSTATE
  59. . /etc/DISTRO_SPECS
  60. #PUPPYVERSION="`cat /etc/puppyversion`"
  61. KERNVER="`uname -r`"
  62. [ ! -f /etc/rc.d/BOOTCONFIG ] && touch /etc/rc.d/BOOTCONFIG #v424
  63. . /etc/rc.d/BOOTCONFIG #v424
  64. if vercmp $KERNVER ge 3.0;then #111015
  65. SFSSTR='squashfs, version 4'
  66. else
  67. KERNELSUBVER=`echo -n "$KERNVER" | cut -f 3 -d '.' | cut -f 1 -d '-' | cut -f 1 -d '_'` #v423 100831
  68. SUB_SUB_KERNELVER=`echo -n "$KERNVER" | cut -f 1 -d '-' | cut -f 4 -d '.'` #100607
  69. SFSSTR='squashfs, version 3' #v423
  70. [ $KERNELSUBVER -gt 28 ] && SFSSTR='squashfs, version 4' #v423
  71. [ $KERNELSUBVER -eq 27 ] && [ $SUB_SUB_KERNELVER -gt 46 ] && SFSSTR='squashfs, version 4' #100607
  72. fi
  73. #v3.02
  74. . /etc/rc.d/MODULESCONFIG
  75. DEFAULT_SERIAL="false"
  76. DEFAULT_FAST="false"
  77. [ "$BYPASSSERIALPROBING" = "yes" ] && DEFAULT_SERIAL="true"
  78. [ "$FASTBOOTMODULESLIST" != "" ] && DEFAULT_FAST="true"
  79. if [ "$PUPMODE" = "5" ];then
  80. pupmessage -bg '#FF8080' -title "$(gettext 'BootManager error')" "$(gettext 'You must shutdown and create a personal save file first.')"
  81. exit
  82. fi
  83. xEXTRASFSMNTPTx="" #100711
  84. if [ "$PUP_HOME" = "" ];then #defined in PUPSTATE.
  85. EXTRASFSMNTPT='/'
  86. MSGx="`eval_gettext \"Note2: These files are at '/' (in \\\$PDEV1 partition)\"`"
  87. MSGz='/'
  88. else
  89. EXTRASFSMNTPT="/initrd${PUP_HOME}"
  90. xHOMEPART="$PDEV1" #100518
  91. [ "$PUPSAVE" ] && xHOMEPART="`echo -n "$PUPSAVE" | cut -f 1 -d ','`" #100518
  92. #MSGx="Note2: These files are at /mnt/home (same as '${DISTRO_FILE_PREFIX}save')"
  93. MSGz='/mnt/home'
  94. #100711 modify to look in both top dir and subdirectory...
  95. #100710 if pupsave is in a subdirectory, only look in that...
  96. if [ "$PUPSAVE" ];then #this test probably not needed
  97. xPSUBDIR="`echo -n "$PUPSAVE" | cut -f 3 -d ',' | sed -e 's%/[^/]*$%%'`" #ex: sda3,ext2,/pup220/spupsave.2fs will return /pup220
  98. if [ "$xPSUBDIR" ];then
  99. MSGz="/mnt/home or /mnt/home${xPSUBDIR}"
  100. xEXTRASFSMNTPTx="/initrd${PUP_HOME}${xPSUBDIR}"'/*.sfs' #100711
  101. fi
  102. fi
  103. MSGx="`eval_gettext \"Note2: These files are at \\\${MSGz} (in \\\${xHOMEPART} partition)\"`" #100221 100518 100710
  104. fi
  105. #for multisession cd, extra sfs files have to be on the cd...
  106. #v3.97 sfs files are at '/', saved with a session...
  107. if [ "$PUPMODE" = "77" ];then
  108. MSGz='/'
  109. EXTRASFSMNTPT='/'
  110. xEXTRASFSMNTPTx="" #100711
  111. MSGx="$(gettext 'Note2: All SFS files have to get loaded into RAM from CD')"
  112. fi
  113. extrasfs_func() {
  114. echo -n "" > /tmp/bootmanager_sfs_dlglist
  115. UNMOUNTME=""
  116. #cd $EXTRASFSMNTPT
  117. #v409 lobster gets some non-sfs files in ALLSFSLIST ...i have no idea how, but
  118. #need an extra grep filter here... w007 new name woof-007.sfs ... w478 fix for 'pup2' prefix... 100809 bug fix...
  119. ALLSFSLIST="`ls -1 $EXTRASFSMNTPT/*.sfs $xEXTRASFSMNTPTx | grep '\.sfs$' | tr "\n" " "`"
  120. #cd $CURRDIR
  121. sync
  122. [ "$UNMOUNTME" != "" ] && umount $UNMOUNTME
  123. #eliminate other versions from list...
  124. BASEFIXEDSFSLIST=""; ITEMCNT=0
  125. rm -f /tmp/bootmanager_wrong_sfs_version 2>/dev/null #v423
  126. for ONESFS in $ALLSFSLIST
  127. do
  128. BASEONESFS="`basename $ONESFS`" #100711
  129. [ "`echo "$BASEONESFS" | grep '^zdrv'`" != "" ] && continue #100809
  130. [ "`echo "$BASEONESFS" | grep '^adrv'`" != "" ] && continue
  131. [ "`echo "$BASEONESFS" | grep '^ydrv'`" != "" ] && continue
  132. [ "`echo "$BASEONESFS" | grep '^pup_'`" != "" ] && continue #100809
  133. [ "`echo "$BASEONESFS" | grep "^${DISTRO_FILE_PREFIX}\\-[0-9][0-9][0-9]\\.sfs$"`" != "" ] && continue #100809
  134. [ "`echo "$BASEONESFS" | grep "^${DISTRO_FILE_PREFIX}[rz]"`" != "" ] && continue #100809
  135. #121125 when install a Service Pack, DISTRO_VERSION gets bumped, however may still want to load devx*_<old-version>.sfs,
  136. # so, remove this filter...
  137. [ "`echo "$BASEONESFS" | grep "^${DISTRO_PUPPYSFS}"`" != "" ] && continue #100913
  138. [ "`echo "$BASEONESFS" | grep "^${DISTRO_ZDRVSFS}"`" != "" ] && continue #100913
  139. #v423 eliminate wrong squashfs version...
  140. if [ "`disktype ${ONESFS} | grep "$SFSSTR"`" = "" ];then
  141. echo "$BASEONESFS" >> /tmp/bootmanager_wrong_sfs_version
  142. continue
  143. fi
  144. [ "`echo "$BASEFIXEDSFSLIST" | grep "$BASEONESFS"`" != "" ] && continue #100711 avoid duplicates.
  145. BASEFIXEDSFSLIST="$BASEFIXEDSFSLIST $BASEONESFS"
  146. done
  147. BASEALLSFSLIST="$BASEFIXEDSFSLIST"
  148. #compose list for xdialog listbox...
  149. for ONESFS in $BASEALLSFSLIST
  150. do
  151. if [ "$EXTRASFSLIST" = "" ];then
  152. DLGLIST="$DLGLIST $ONESFS $ONESFS off"
  153. else
  154. [ "`echo -n "$EXTRASFSLIST" | grep -v "$ONESFS"`" != "" ] && DLGLIST="$DLGLIST $ONESFS $ONESFS off"
  155. fi
  156. done
  157. for ONESFS in $EXTRASFSLIST
  158. do
  159. DLGLIST="$DLGLIST $ONESFS $ONESFS on"
  160. done
  161. #v423 let user know wrong sfs's...
  162. if [ -e /tmp/bootmanager_wrong_sfs_version ];then
  163. pupmessage -bg '#FFC0C0' "`eval_gettext \"NOTICE: The following SFS files located in directory \\\${MSGz}
  164. are the wrong version for the current Linux kernel:\"`
  165. `cat /tmp/bootmanager_wrong_sfs_version`
  166. `eval_gettext \"The above files will be ignored.
  167. The kernel requires \\\${SFSSTR}, SFS files.
  168. Note, there is an SFS-version-converter in the Utility menu.\"`" &
  169. fi
  170. if [ "$DLGLIST" = "" ];then
  171. [ "$CLPARAM2" = "quiet" ] && return 1
  172. pupmessage -center -bg '#FFC0C0' "`eval_gettext \"Sorry, there are no SFS files in directory \\\$MSGz
  173. You will need to download and place one there first.\"`"
  174. return 1
  175. fi
  176. #111113 revert to Xdialog...
  177. EXECME="Xdialog --wmclass \"module16\" --backtitle \"$(gettext 'Choose which SFS files are to be loaded at bootup.\n(top entry will be on top Unionfs layer)')\" --title \"$(gettext 'BootManager: SFS files')\" --left --stdout --separator \" \" --help \"`eval_gettext \"Please click the 'install' icon on the desktop for information about SFS files.\nYou will find an introduction, plus links to SFS files that can be downloaded.\n\nNote, the BootManager performs some filtering of the available SFS files,\nscreening out some that might have incorrect version number -- files of the\nformat '*_nnn.sfs' should be '*_\\\${DISTRO_VERSION}.sfs' to pass the filter.\"`\" --buildlist \"$(gettext 'Note1: No more than 6 SFS files in right-pane!')\n${MSGx}\" 0 0 8 $DLGLIST >/tmp/bmrettags.txt"
  178. eval ${EXECME}
  179. RETVAL=$?
  180. [ ! $RETVAL -eq 0 ] && return 1
  181. RETTAGS="`cat /tmp/bmrettags.txt`"
  182. RETTAGS="`echo -n "$RETTAGS" | sed -e 's/ $//g'`"
  183. [ ! -e /etc/rc.d/BOOTCONFIG ] && touch /etc/rc.d/BOOTCONFIG
  184. grep -v 'EXTRASFSLIST' /etc/rc.d/BOOTCONFIG > /tmp/BOOTCONFIG
  185. cat /tmp/BOOTCONFIG > /etc/rc.d/BOOTCONFIG
  186. echo "EXTRASFSLIST='${RETTAGS}'" >> /etc/rc.d/BOOTCONFIG
  187. #120527 shinobar's sfs-load on-the-fly pet has this, sync it...
  188. if [ -f /etc/rc.d/BOOTCONFIG.save ];then
  189. bPTN="s%^EXTRASFSLIST=.*%EXTRASFSLIST='${RETTAGS}'%"
  190. sed -i -e "$bPTN" /etc/rc.d/BOOTCONFIG.save
  191. fi
  192. } #end extrasfs_func
  193. blacklist_func() {
  194. #blacklisting of modules at bootup.
  195. . /etc/rc.d/MODULESCONFIG
  196. MODLIST=""
  197. xSKIPLIST="`echo -n "$SKIPLIST" | tr ' ' '\n' | sort -u | tr '\n' ' ' | tr -s ' '`" #110305
  198. LOADEDMODULES="`lsmod | grep -v '^Module' | cut -f 1 -d ' ' | sort | tr '\n' ' '`" #110305
  199. for ONEMOD in $LOADEDMODULES
  200. do
  201. MODLIST="$MODLIST $ONEMOD $ONEMOD off"
  202. done
  203. for ONEMOD in $xSKIPLIST
  204. do
  205. MODLIST="$MODLIST $ONEMOD $ONEMOD on"
  206. done
  207. EXECME="Xdialog --wmclass \"module16\" --title \"$(gettext 'BootManager: Module blacklist manager')\" --left --stdout --separator \" \" --buildlist \"$(gettext 'On the left pane are modules that are currently loaded.\n
  208. On the right pane is the complete list of blacklisted modules.\n
  209. If you want to prevent a module from loading, move it to the right\n
  210. side, click OK, then reboot.\n
  211. Note, if you want to find out further information about any module,\n
  212. run PupScan (look in the System menu)\n
  213. Note, you need to reboot for any change to take effect.')\" 0 0 8 $MODLIST >/tmp/skiprettags.txt"
  214. eval $EXECME
  215. RETVAL=$?
  216. [ ! $RETVAL -eq 0 ] && return 1
  217. SKIPLIST=" `cat /tmp/skiprettags.txt | tr '\n' ' '`"
  218. #now update /etc/rc.d/MODULESCONFIG...
  219. sed -i -e "s%^SKIPLIST=.*%SKIPLIST='${SKIPLIST}'%" /etc/rc.d/MODULESCONFIG #110305
  220. } #end blacklist_func
  221. yeslist_func() {
  222. #choose extra modules to load at bootup.
  223. /usr/lib/gtkdialog/box_splash -close never -text "$(gettext 'Please wait, processing...')" &
  224. X1PID=$!
  225. . /etc/rc.d/MODULESCONFIG
  226. MODLIST=""
  227. old_slow_off_list(){
  228. #note, lsmod will show all modules with '-' as '_'...
  229. LOADEDMODULES=" `lsmod | grep -v '^Module' | cut -f 1 -d ' ' | tr '\n' ' '`"
  230. #v403 handles both .ko and .ko.gz modules...
  231. ALLMODULES="`cat /lib/modules/$KERNVER/modules.dep | cut -f 1 -d ':' | grep -o '[a-zA-Z0-9_-]*\.ko' | tr '\-' '_' | sort - | tr '\n' ' '`"
  232. for ONEMOD in $ALLMODULES
  233. do
  234. NAMEONLY="`basename $ONEMOD .ko`"
  235. MODPATTERN=" $NAMEONLY "
  236. #leave off list if already loaded...
  237. [ "`echo "$LOADEDMODULES" | grep "$MODPATTERN"`" != "" ] && continue
  238. MODPATTERN=' '"$NAMEONLY"'[ :]'
  239. #leave off left pane if already on right pane...
  240. [ "`echo "$ADDLIST" | grep "$MODPATTERN"`" != "" ] && continue
  241. MODLIST="$MODLIST $NAMEONLY $NAMEONLY off"
  242. done
  243. } #old_slow_off_list
  244. LOADEDMODULES=`cut -f1 -d' ' /proc/modules`
  245. ALLMODULES=`cut -f 1 -d ':' /lib/modules/$KERNVER/modules.dep | grep -o '[a-zA-Z0-9_-]*\.ko' | tr '\-' '_' | sed 's%\.k.*$%%' | sort`
  246. ALLMODULES=`echo "$ALLMODULES" | /bin/grep -vw "$LOADEDMODULES"`
  247. ADDLIST_MOD_ONLY=`echo "$ADDLIST" | tr ' ' '\n' | sed 's%:.*%%;/^$/d'`
  248. ALLMODULES=`echo "$ALLMODULES" | /bin/grep -vw "$ADDLIST_MOD_ONLY"`
  249. ALLMODULES=`echo "$ALLMODULES" | sed 's%\(.*\)%& & off%'`
  250. MODLIST=`echo "$ALLMODULES" | tr '\n' ' '`
  251. #echo "$MODLIST" >&2
  252. for ONEMOD in $ADDLIST
  253. do
  254. NAMEONLY="$ONEMOD"
  255. xONEMOD="$ONEMOD"
  256. if [ `echo -n "$ONEMOD" | tr ':' ' ' | wc -w` -gt 1 ];then
  257. MPARAMS="`echo -n "$ONEMOD" | cut -f 2-9 -d ':' | tr ':' ' '`"
  258. NAMEONLY="`echo -n "$ONEMOD" | cut -f 1 -d ':'`"
  259. xONEMOD="$NAMEONLY $MPARAMS"
  260. fi
  261. MODPATTERN=" $NAMEOLY "
  262. #leave off list if already loaded...
  263. [ "`echo "$LOADEDMODULES" | grep "$MODPATTERN"`" != "" ] && continue
  264. MODLIST="$MODLIST $ONEMOD \"$xONEMOD\" on"
  265. done
  266. #echo >&2
  267. #echo "$MODLIST" >&2
  268. [ "$MODLIST" ] || : ##TODO something
  269. kill $X1PID 2>/dev/null
  270. EXECME="Xdialog --wmclass \"module16\" --title \"$(gettext 'BootManager: Module add-list manager')\" --left --stdout --separator \" \" --buildlist \"$(gettext 'On the left pane is the complete list of modules available to be\nused by Puppy (and not currently loaded).\nOn the right pane are modules that you have explicitly chosen to\nbe loaded at bootup (not auto-loaded by default).\nIf you want to force a module to load, move it to the right pane,\nclick OK button, then reboot Puppy.\nNote, if you want to find out further information about any module,\nrun PupScan (look in the System menu)')\" 0 0 8 $MODLIST >/tmp/yesrettags.txt"
  271. eval $EXECME
  272. RETVAL=$?
  273. [ ! $RETVAL -eq 0 ] && return 1
  274. cat /tmp/yesrettags.txt | tr ' ' '\n' | tr ':' ' ' > /tmp/modules_addlist_edit #v411
  275. Xdialog --backtitle "$(gettext "If you wish, add any required parameters to these modules\nExample: mmc_block major=179\nIf you don't know what this means, just click 'OK' button")" --wmclass "module16" --title "$(gettext 'BootManager: Edit module addlist')" --left --stdout --no-cancel --editbox /tmp/modules_addlist_edit 0 0 > /tmp/modules_addlist_edit_out #'geany
  276. [ $? -ne 0 ] && return 1
  277. ADDLIST="`cat /tmp/modules_addlist_edit_out`"
  278. ADDLIST=' '"`echo "$ADDLIST" | tr ' ' ':' | tr '\n' ' ' | tr -s ' '`"
  279. #ADDLIST=" `cat /tmp/yesrettags.txt | tr '\n' ' '`"
  280. #now update /etc/rc.d/MODULESCONFIG...
  281. grep -v '^ADDLIST' /etc/rc.d/MODULESCONFIG > /tmp/MODULESCONFIG
  282. mv -f /tmp/MODULESCONFIG /etc/rc.d/MODULESCONFIG
  283. echo "ADDLIST='${ADDLIST}'" >> /etc/rc.d/MODULESCONFIG
  284. } #end yeslist_func
  285. # \"Sometimes two modules are eligible for the same hardware, and you need to choose\none of them. An example is the rt2500usb and rt73usb wireless networking modules\n-- with some hardware these are both eligible however our experience has been that\nthe rt73usb works better. For such a situation, create a line here, of format\nmodule1:module2, where you want module2 to have preference over module1.\nNote: an alternative approach is to blacklist the rt2500usb module (see main menu)\nhowever that is gross as it always prevents rt2500usb from loading.\"
  286. preflist_func() {
  287. xPREFLIST="`echo -n "$PREFLIST" | sed -e 's/^ //' | tr ' ' '\n'`"
  288. echo "$xPREFLIST" > /tmp/bootmanager_preflist
  289. xxPREFLIST="`Xdialog --backtitle \"$(gettext 'Sometimes two modules are eligible for the same hardware,\n
  290. and you need to choose one of them. Create a line here,\nof format module1:module2, where you want module2 to\nhave preference over module1.')\" --wmclass \"module16\" --title \"$(gettext 'BootManager: Module preference-list manager')\" --left --stdout --help \"$(gettext 'Sometimes two modules are eligible for the same hardware, and you need to choose\none of them. An example is the rt2500usb and rt73usb wireless networking modules\n-- with some hardware these are both eligible however our experience has been that\nthe rt73usb works better. For such a situation, create a line here, of format\nmodule1:module2, where you want module2 to have preference over module1.\nNote: an alternative approach is to blacklist the rt2500usb module (see main menu)\nhowever that is gross as it always prevents rt2500usb from loading.')\" --editbox /tmp/bootmanager_preflist 0 0`"
  291. if [ $? -eq 0 ];then
  292. NEWPREFLIST="`echo "$xxPREFLIST" | tr '\n' ' ' | sed -e 's/^/ /' | tr -s ' '`"
  293. grep -v '^PREFLIST' /etc/rc.d/MODULESCONFIG > /tmp/MODULESCONFIG
  294. mv -f /tmp/MODULESCONFIG /etc/rc.d/MODULESCONFIG
  295. echo "PREFLIST='${NEWPREFLIST}'" >> /etc/rc.d/MODULESCONFIG
  296. fi
  297. } #end preflist_func
  298. sysdaemons_func() { #100125
  299. osdcnt=0
  300. echo -n "" > /tmp/bootmanager_osd
  301. for ONESYSDAEMON in `find /etc/init.d -maxdepth 1 -type f | grep -v -E 'txt|pcmcia|alsa'`
  302. do
  303. osdcnt=`expr $osdcnt + 1`
  304. OSDNAME="`basename $ONESYSDAEMON`"
  305. xOSDNAME="`echo -n "$OSDNAME" | sed -e 's%^[0-9]%%' -e 's%^[0-9]%%'`" #remove any leading number.
  306. OSDDIR="`dirname $ONESYSDAEMON`"
  307. OSDDEFAULT='false'
  308. [ -x $ONESYSDAEMON ] && OSDDEFAULT='true'
  309. OSDDESCR=''
  310. case $xOSDNAME in
  311. alsa) OSDDESCR='('$(gettext 'ALSA sound server, required to play audio')')' ;;
  312. cups) OSDDESCR='('$(gettext 'CUPS printing, required to print')')' ;;
  313. messagebus) OSDDESCR='('$(gettext 'DBUS interprocess messaging, required by some apps')')' ;;
  314. rc.acpi) OSDDESCR='('$(gettext 'ACPI management, not essential')')' ;;
  315. slmodem) OSDDESCR='('$(gettext 'Only needed for certain Internet dialup modems')')' ;;
  316. sys_logger) OSDDESCR='('$(gettext 'Logs kernel & app. info. & error messages, not essential')')' ;;
  317. rc.smbqmsvc) OSDDESCR='('$(gettext 'only needed for quick mounting Samba shares in lameSMBxplorer')')' ;;
  318. esac
  319. OSDBOXES="${OSDBOXES} <checkbox><label>${xOSDNAME} ${OSDDESCR}</label><default>${OSDDEFAULT}</default><variable>OSDCHK_${osdcnt}_</variable></checkbox>"
  320. echo "OSDCHK_${osdcnt}_|${OSDDIR}|${OSDNAME}" >> /tmp/bootmanager_osd
  321. done
  322. if [ "`grep '/etc/rc.d/rc.firewall' /etc/rc.d/rc.local`" != "" ];then
  323. osdcnt=`expr $osdcnt + 1`
  324. OSDDEFAULT='false'
  325. [ -x /etc/rc.d/rc.firewall ] && OSDDEFAULT='true'
  326. OSDBOXES="${OSDBOXES} <checkbox><label>rc.firewall ($(gettext 'Firewall important security on Internet'))</label><default>${OSDDEFAULT}</default><variable>OSDCHK_${osdcnt}_</variable></checkbox>"
  327. echo "OSDCHK_${osdcnt}_|/etc/rc.d|rc.firewall" >> /tmp/bootmanager_osd
  328. fi
  329. #also offer udev management...
  330. osdcnt=`expr $osdcnt + 1`
  331. OSDDEFAULT='false'
  332. [ "`grep '^BACKENDON' /etc/eventmanager | grep 'true'`" != "" ] && OSDDEFAULT='true'
  333. OSDBOXES="${OSDBOXES} <checkbox><label>udev (`gettext \"Hardware hotplug detection -- see 'Help'\"`)</label><default>${OSDDEFAULT}</default><variable>OSDCHK_${osdcnt}_</variable></checkbox>"
  334. echo "OSDCHK_${osdcnt}_||udev" >> /tmp/bootmanager_osd
  335. export BootManager_Services='
  336. <window title="'$(gettext 'BootManager - System services')'" icon-name="gtk-execute" default-height="400">
  337. <vbox space-expand="true" space-fill="true">
  338. <frame '$(gettext 'System services')'>
  339. '"`/usr/lib/gtkdialog/xml_info 80 startup_services.svg 60 "$(gettext "Untick a checkbox to prevent service from running at startup")"`"'
  340. <hbox space-expand="true" space-fill="true">
  341. <vbox scrollable="true" shadow-type="0" border-width="10" space-expand="true" space-fill="true">
  342. '${OSDBOXES}'
  343. </vbox>
  344. </hbox>
  345. </frame>
  346. <hbox space-expand="false" space-fill="false">
  347. <button space-expand="false" space-fill="false">
  348. '"`/usr/lib/gtkdialog/xml_button-icon help`"'
  349. <label>'$(gettext 'Help')'</label>
  350. <action>cp /etc/init.d/README.txt /tmp/box_help; /usr/lib/gtkdialog/box_help "'$(gettext 'Startup services')'" &</action>
  351. </button>
  352. <text space-expand="true" space-fill="true"><label>""</label></text>
  353. <button space-expand="false" space-fill="false">
  354. <label>'$(gettext "Cancel")'</label>
  355. '"`/usr/lib/gtkdialog/xml_button-icon cancel`"'
  356. <action>exit:CANCEL</action>
  357. </button>
  358. <button space-expand="false" space-fill="false">
  359. <label>'$(gettext "Ok")'</label>
  360. '"`/usr/lib/gtkdialog/xml_button-icon ok`"'
  361. <action>exit:OK</action>
  362. </button>
  363. </hbox>
  364. </vbox>
  365. </window>'
  366. RETSTRING="`gtkdialog -p BootManager_Services`"
  367. [ "`echo "$RETSTRING" | grep 'EXIT' | grep 'OK'`" = "" ] && return
  368. while [ $osdcnt -gt 0 ];do
  369. OSDVAR="OSDCHK_${osdcnt}_"
  370. OSDDIR="`grep "$OSDVAR" /tmp/bootmanager_osd | cut -f 2 -d '|'`"
  371. OSDNAME="`grep "$OSDVAR" /tmp/bootmanager_osd | cut -f 3 -d '|'`"
  372. if [ "$OSDNAME" = "udev" ];then
  373. if [ "`echo "$RETSTRING" | grep "$OSDVAR" | grep 'true'`" != "" ];then
  374. if [ "`grep '^BACKENDON' /etc/eventmanager | grep 'false'`" != "" ];then
  375. pupmessage -center -bg orange "`gettext \"The EventManager will now be run, so that you can enable 'udev'.
  376. You will need to tick the 'hotplug module/firmware loading' checkbox...\"`"
  377. eventmanager &
  378. fi
  379. else
  380. if [ "`grep '^BACKENDON' /etc/eventmanager | grep 'true'`" != "" ];then
  381. pupmessage -center -bg orange "`gettext \"The EventManager will now be run, so that you can disable 'udev'.
  382. You will need to untick the 'hotplug module/firmware loading' checkbox...\"`"
  383. eventmanager &
  384. fi
  385. fi
  386. fi
  387. if [ "$OSDDIR" = "/etc/init.d" -o "$OSDDIR" = "/etc/rc.d" ];then
  388. if [ "`echo "$RETSTRING" | grep "$OSDVAR" | grep 'true'`" != "" ];then
  389. chmod 755 ${OSDDIR}/${OSDNAME}
  390. else
  391. chmod 644 ${OSDDIR}/${OSDNAME}
  392. fi
  393. fi
  394. osdcnt=`expr $osdcnt - 1`
  395. done
  396. } #end sysdaemons_func
  397. if [ "$CLPARAM1" = "extrasfs" ];then
  398. extrasfs_func
  399. exit
  400. elif [ "$CLPARAM1" = "blacklist" ];then
  401. blacklist_func
  402. exit
  403. elif [ "$CLPARAM1" = "yeslist" ];then
  404. yeslist_func
  405. exit
  406. elif [ "$CLPARAM1" = "preflist" ];then
  407. preflist_func
  408. exit
  409. elif [ "$CLPARAM1" = "sysdaemons" ];then #100125
  410. sysdaemons_func
  411. exit
  412. fi
  413. #120626 only offer to load sfs files if have layered f.s., mention sfs_load...
  414. if [ -d /initrd ];then #PUPMODE=2, full hd install, will not have this.
  415. if [ "`cat /root/.packages/woof-installed-packages /root/.packages/user-installed-packages | grep '^sfs_load'`" != "" ];then
  416. SFSLOAD_XML="$(gettext "ALTERNATIVE: Shinobar's SFS_Load application will enable you to install SFS files on-the-fly, that is, load and unload them without having to reboot -- see the 'Setup' menu.")"
  417. #'geany
  418. fi
  419. SFSFRAME_XML='
  420. <frame '$(gettext 'Load SFS files')'>
  421. <vbox space-expand="true" space-fill="true">
  422. '"`/usr/lib/gtkdialog/xml_info scale package_sfs.svg 60 "$(gettext "Puppy has a file named") ${DISTRO_PUPPYSFS} $(gettext "that is always loaded. However, extra SFS files can be loaded at bootup, for example 'kde.sfs' to provide KDE applications, and 'devx.sfs' to provide everything for compiling C/C++ source. These can be thought of as 'combo packs' of many packages in one file.")" " " "${SFSLOAD_XML}"`"'
  423. <vbox space-expand="false" space-fill="false">
  424. <text height-request="20"><label>""</label></text>
  425. <hbox>
  426. <text><label>'$(gettext 'Choose which extra SFS files to load at bootup')'</label></text>
  427. <button>
  428. '"`/usr/lib/gtkdialog/xml_button-icon package_sfs.svg big`"'
  429. <action>'"$MY_SELF"' extrasfs &</action>
  430. </button>
  431. </hbox>
  432. <text height-request="5"><label>""</label></text>
  433. </vbox>
  434. </vbox>
  435. </frame>'
  436. else
  437. if [ "`cat /root/.packages/woof-installed-packages /root/.packages/user-installed-packages | grep '^sfs_load'`" != "" ];then
  438. SFSLOAD_XML="$(gettext "Shinobar's SFS_Load application will enable you to install SFS files -- see the 'Setup' menu.")"
  439. #'geany
  440. else
  441. SFSLOAD_XML="$(gettext "TECHNICAL: Clicking on an SFS file will open it, and it's contents can then be copied to /. It is recommended to use the '-a -f --remove-destination' parameters for the 'cp' command.")"
  442. #'geany
  443. fi
  444. SFSFRAME_XML='
  445. <frame '$(gettext 'Load SFS files')'>
  446. <vbox space-expand="true" space-fill="true">
  447. '"`/usr/lib/gtkdialog/xml_info scale package_sfs.svg 60 "$(gettext "NOTICE: As this is a full installation of Puppy without an initrd, SFS files cannot be loaded/unloaded at bootup. However, they can be permanently installed.")" " " "${SFSLOAD_XML}"`"'
  448. </vbox>
  449. </frame>'
  450. fi
  451. #######################################################
  452. export BootManager='
  453. <window title="'$(gettext 'Startup Manager')'" icon-name="gtk-execute">
  454. <vbox space-expand="true" space-fill="true">
  455. <notebook labels="'$(gettext 'Startup Apps')'|'$(gettext 'SFS-packages')'|'$(gettext 'Modules')'|'$(gettext 'Services')'">
  456. <frame '$(gettext 'Manage startup apps')'>
  457. <vbox space-expand="true" space-fill="true">
  458. '"`/usr/lib/gtkdialog/xml_info scale startup_app.svg 60 "$(gettext "Manage what apps are set to start when the graphical server (X) starts on your system. These apps include the notification icons in the system tray and some other hidden services that need the graphical server to be running.")"`"'
  459. <vbox space-expand="false" space-fill="false">
  460. <text height-request="20"><label>""</label></text>
  461. <hbox>
  462. <text><label>'$(gettext 'Manage startup apps')'</label></text>
  463. <button>
  464. '"`/usr/lib/gtkdialog/xml_button-icon startup_app.svg big`"'
  465. <action>wmstartups</action>
  466. </button>
  467. </hbox>
  468. <text height-request="5"><label>""</label></text>
  469. </vbox>
  470. </vbox>
  471. </frame>
  472. '"${SFSFRAME_XML}"'
  473. <frame '$(gettext 'Load kernel modules')'>
  474. <vbox space-expand="true" space-fill="true">
  475. '"`/usr/lib/gtkdialog/xml_info scale module.svg 60 "$(gettext "If a driver module did not get loaded, or the wrong one got loaded, or you want to 'blacklist' a module, this is the place. A common scenario is a driver got auto-loaded, for say your wireless network card, but you cannot or do not want to use it, and want some other module or want to use Ndiswrapper (to use the Windows driver).")"`"'
  476. <vbox space-expand="false" space-fill="false">
  477. <text height-request="20"><label>""</label></text>
  478. <hbox>
  479. <text><label>'$(gettext "'Blacklist' module")'</label></text>
  480. <button>
  481. '"`/usr/lib/gtkdialog/xml_button-icon module_no.svg big`"'
  482. <action>'"$MY_SELF"' blacklist &</action>
  483. </button>
  484. </hbox>
  485. <hbox>
  486. <text><label>'$(gettext 'Add new module')'</label></text>
  487. <button>
  488. '"`/usr/lib/gtkdialog/xml_button-icon module_yes.svg big`"'
  489. <action>'"$MY_SELF"' yeslist &</action>
  490. </button>
  491. </hbox>
  492. <hbox>
  493. <text><label>'$(gettext 'Give preference to one module over another')'</label></text>
  494. <button>
  495. '"`/usr/lib/gtkdialog/xml_button-icon module.svg big`"'
  496. <action>'"$MY_SELF"' preflist &</action>
  497. </button>
  498. </hbox>
  499. <text height-request="5"><label>""</label></text>
  500. </vbox>
  501. </vbox>
  502. </frame>
  503. <frame '$(gettext 'Manage system services')'>
  504. <vbox space-expand="true" space-fill="true">
  505. '"`/usr/lib/gtkdialog/xml_info scale startup_services.svg 60 "$(gettext "These are processes (applications) that are started at bootup and run continuously in the background. On slow PCs it may help to not run some of these.")"`"'
  506. <vbox space-expand="false" space-fill="false">
  507. <text height-request="20"><label>""</label></text>
  508. <hbox>
  509. <text><label>'$(gettext 'Choose which system services to run at startup')'</label></text>
  510. <button>
  511. '"`/usr/lib/gtkdialog/xml_button-icon startup_services.svg big`"'
  512. <action>'"$MY_SELF"' sysdaemons &</action>
  513. </button>
  514. </hbox>
  515. <text height-request="5"><label>""</label></text>
  516. </vbox>
  517. </vbox>
  518. </frame>
  519. </notebook>
  520. <hbox height-request="30" space-expand="false" space-fill="false">
  521. <button>'"`/usr/lib/gtkdialog/xml_button-icon quit`"'<label>'$(gettext 'Quit')'</label></button>
  522. </hbox>
  523. </vbox>
  524. </window>'
  525. . /usr/lib/gtkdialog/xml_info gtk #build bg_pixmap for gtk-theme
  526. RETSTRING="`gtkdialog -p BootManager`"
  527. eval "$RETSTRING"
  528. [ "$EXIT" = "abort" ] && exit
  529. ###END###