rc.update 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546
  1. #!/bin/sh
  2. #LGPL Barry Kauler 2006,2007 www.puppylinux.com
  3. #v555 pup files renamed to woofr555.sfs, woofsave.2fs.
  4. #w001 /etc/networkmodules generated (previously done in createpuppy, Unleashed).
  5. #w002 run gtk-update-icon-cache on hicolor icons.
  6. #w002 run icon_switcher_cli for default desktop icon set JQ8flat.
  7. #w007 if sfs layer with extra modules added or removed, need to run depmod.
  8. #w012 updated for new standardised pkg database format.
  9. #w020 april2009: fix for add/remove zdrv (modules) sfs.
  10. #w464 tidyup, make sure /etc/puppyversion is history.
  11. #w474 updatenetmoduleslist.sh called when zdrv loaded or unloaded.
  12. #w477 /etc/desktop_icon_theme has default desktop icon set.
  13. #v423 fix for PUPMODE=2, full hd installation.
  14. #100425 generate woof-tree-official.png from svg.
  15. #100913 new puppy filenames.
  16. #101020 no longer using modprobe.conf.
  17. #101228 01micko: bug fix.
  18. #110119 giving this script an overhaul.
  19. #110122 make sure all woof scripts are updated.
  20. #110204 LANG in /etc/profile got overwritten.
  21. #110422 DISTRO_VERSION variable now has dotted format. note, also now using full dotted version# in puppy filenames.
  22. #110622 mageia1 note, pixbuf cache.
  23. #110722 updated lists of woof scripts that must be updated.
  24. #110722 get rid of stray modules.* files, may occur when mix usage of the two depmods.
  25. #110826 do not call icon_switcher_cli at all.
  26. #111009 try fix upgrading old wary save-file.
  27. #111027 maybe need to fix permissions on /tmp and /var.
  28. #111123 first-boot fix if did cross-build in Woof.
  29. #120209 append LANG when call fixmenus. also run fixdesk, fixscripts
  30. #120225 fix non-english PuppyPin when layers change.
  31. #120323 shinobar: need some more operations when unionfs layers change.
  32. #120505 PUPMODE==2, need to consider situation of a full-hd install that is not pre-setup.
  33. #120522 ubuntu precise puppy must have the schemas compiled (otherwise seamonkey crashed) (normally done in 3builddistro).
  34. #120523 precise puppy, may also need to run gio-querymodules. (refer also installpkg.sh, 3builddistro)
  35. #120605 shinobar: need to run gtk-query-immodules-2.0 at first start.
  36. #130203 change probedisk2 to probedisk.
  37. #130217 depmod_func() created, to ensure deletion of modules.* files.
  38. #130418 support kmod (see also rc.sysinit, 3builddistro).
  39. #This script is called by /etc/rc.d/rc.sysinit. the purpose is to perform
  40. #any required updates to files when a new version of Puppy is booted.
  41. #this script can also be called by /usr/sbin/puppyinstaller, when doing a full install
  42. #(option2) to hard drive. in that case, chroot to hd partition, and the ${DISTRO_PUPPYSFS}
  43. #source files are mounted on /srcmntpt in the hd partition.
  44. #puppyinstaller will call here with PUPMODE="option2hdinstall"
  45. PUPMODE="$1"
  46. KERNVER="`uname -r`"
  47. [ -z $DISPLAY ] || XSTATUS="yes" #v3.99
  48. [ "$PUPMODE" = "" ] && exit
  49. depmod_func() { #130217 extracted as a function.
  50. #then run depmod to overwrite any depmod files on OLD layer...
  51. echo "Executing depmod, to update module files..."
  52. if which kmod;then #130418
  53. depmod #this is a symlink to kmod.
  54. else
  55. #110722 get rid of stray modules.* files, may occur when mix usage of the two depmods...
  56. mkdir -p /tmp/rc_update_dump
  57. mv -f /lib/modules/${KERNVER}/modules.* /tmp/rc_update_dump
  58. [ -f /tmp/rc_update_dump/modules.builtin ] && mv -f /tmp/rc_update_dump/modules.builtin /lib/modules/${KERNVER}/
  59. [ -f /tmp/rc_update_dump/modules.order ] && mv -f /tmp/rc_update_dump/modules.order /lib/modules/${KERNVER}/
  60. rm -f /tmp/rc_update_dump/modules.*
  61. if [ "`busybox | grep 'depmod'`" != "" ];then
  62. busybox depmod #use busybox depmod if available.
  63. else
  64. depmod
  65. fi
  66. fi
  67. }
  68. case $PUPMODE in
  69. "7") #tmpfs (pup_rw), hd for persistent storage (pup_ro1), ${DISTRO_PUPPYSFS} (pup_ro2).
  70. NEWFILESMNTPT="/initrd/pup_ro2"
  71. OLDFILESMNTPT="/initrd/pup_ro1"
  72. ;;
  73. "6") #no tmpfs, PDEV1 (pup_rw), ${DISTRO_PUPPYSFS} (pup_ro2)
  74. #have booted from PDEV1 partition, which has initrd.gz & ${DISTRO_PUPPYSFS} files on it, and
  75. #session has been saved direct to the partition. (very similar to mode 12)
  76. NEWFILESMNTPT="/initrd/pup_ro2"
  77. OLDFILESMNTPT="/initrd/pup_rw"
  78. ;;
  79. "12") #no tmpfs, ${DISTRO_FILE_PREFIX}save.3fs (pup_rw), nothing (pup_ro1), ${DISTRO_PUPPYSFS} (pup_ro2)
  80. #example: boot from live-cd, ${DISTRO_FILE_PREFIX}save.3fs on a fast h.d. partition.
  81. NEWFILESMNTPT="/initrd/pup_ro2"
  82. OLDFILESMNTPT="/initrd/pup_rw"
  83. ;;
  84. "13") #tmpfs (pup_rw), ${DISTRO_FILE_PREFIX}save.3fs (pup_ro1), ${DISTRO_PUPPYSFS} (pup_ro2).
  85. #example: boot from usb flash, ${DISTRO_FILE_PREFIX}save.3fs on flash media (needs restrained writes).
  86. NEWFILESMNTPT="/initrd/pup_ro2"
  87. OLDFILESMNTPT="/initrd/pup_ro1"
  88. ;;
  89. "77") #tmpfs (pup_rw), folders (pup_ro1), ${DISTRO_PUPPYSFS} (pup_ro2).
  90. #example: boot from multisession live-cd/dvd, pup_ro1 is a tmpfs folders copied from cd.
  91. NEWFILESMNTPT="/initrd/pup_ro2"
  92. OLDFILESMNTPT="/initrd/pup_ro1"
  93. ;;
  94. "option2hdinstall")
  95. NEWFILESMNTPT="/srcmntpt"
  96. OLDFILESMNTPT=""
  97. ;;
  98. 5) #v423
  99. #PUPMODE=5 is first boot, ignore.
  100. if [ -f /etc/rc.d/WOOFMERGEVARS ];then #111123 inserted by 3builddistro.
  101. . /etc/rc.d/WOOFMERGEVARS
  102. if [ "$WOOF_HOSTARCH" != "$WOOF_TARGETARCH" ];then #woof did a cross-build
  103. echo -n " cross-build-fix" >/dev/console
  104. #these are normally done in 3builddistro.
  105. ldconfig #ldconfig put in by 3builddistro. rebuild /etc/ld.so.cache
  106. /usr/sbin/indexgen.sh #create master help index.
  107. /usr/sbin/fixmenus #Reconstruct configuration files for JWM, Fvwm95, IceWM. 120323 note: fixmenus corrects $LANG.
  108. /usr/bin/fc-cache -s -v #fontconfig cache
  109. PANGOMODULES="`find /etc/pango -type f -name pango.modules`"
  110. [ "$PANGOMODULES" = "" ] && PANGOMODULES='/etc/pango/pango.modules'
  111. [ ! -s ${PANGOMODULES} ] && pango-querymodules > ${PANGOMODULES}
  112. #120522 ubuntu precise puppy must have the schemas compiled (otherwise seamonkey crashed)...
  113. [ -d /usr/share/glib-2.0/schemas ] && [ -e /usr/bin/glib-compile-schemas ] && /usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas
  114. #120523 this too...
  115. [ -d /usr/lib/gio/modules ] && [ -e /usr/bin/gio-querymodules ] && /usr/bin/gio-querymodules /usr/lib/gio/modules
  116. #120605 note, /usr/lib/gtk-2.0/2.10.0/gtk.immodules is a symlink to this...
  117. gtk-query-immodules-2.0 > /etc/gtk-2.0/gtk.immodules #120605 shinobar.
  118. fi
  119. fi
  120. NEWPVERSION="`grep '^DISTRO_VERSION' /etc/DISTRO_SPECS | cut -f 2 -d '=' | cut -f 2 -d '"' | cut -f 2 -d "'" | cut -f 1 -d ' '`" #110422
  121. #w001 generate /etc/networkmodules...
  122. echo -n " network-drivers-list" >/dev/console
  123. /usr/sbin/updatenetmoduleslist.sh
  124. #110119 just in case something missing (like svg loader)...
  125. echo -n " pixbuf-loaders" >/dev/console
  126. gdk-pixbuf-query-loaders > /etc/gtk-2.0/gdk-pixbuf.loaders
  127. #110622 note, mageia1 requires above file to be at /usr/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache -- symlink created by 3builddistro.
  128. #w002 update icon cache (supposed to speed things up)...
  129. echo -n " gtk-icon-cache" >/dev/console
  130. #note, can use --ignore-theme-index if want to...
  131. /usr/bin/gtk-update-icon-cache -f /usr/share/icons/hicolor/
  132. #w002 generate desktop icons (previously done in unleashed)...
  133. echo -n " desk-icons" >/dev/console
  134. if [ -f /etc/desktop_icon_theme ];then #110119
  135. DEFAULT_DESK_ICONS="`cat /etc/desktop_icon_theme`" #Woof creates this.
  136. else #precaution
  137. DEFAULT_DESK_ICONS="`ls -1 /usr/local/lib/X11/themes | tail -n 1`"
  138. fi
  139. #110826 not needed, now done in 3builddistro...
  140. #/usr/sbin/icon_switcher_cli $DEFAULT_DESK_ICONS
  141. #[ -f /usr/share/doc/woof-tree-official.svg ] && [ ! -f /usr/share/doc/woof-tree-official.png ] && rsvg-convert -w 648 -a -o /usr/share/doc/woof-tree-official.png /usr/share/doc/woof-tree-official.svg #100425
  142. exit ###EXIT###
  143. ;;
  144. *) #v423 PUPMODE=2 (full hd install) then just exit.
  145. #exit
  146. #120505 need to consider situation of a full-hd install that is not pre-setup, as would normally be done by 3builddistro in Woof and the Universal Installer.
  147. #one exception is a cross-build in Woof. in such a situation /etc/networkmodules would not exist...
  148. [ -f /etc/networkmodules ] && exit ###EXIT###
  149. #code as per PUPMODE==5 above...
  150. if [ -f /etc/rc.d/WOOFMERGEVARS ];then #111123 inserted by 3builddistro.
  151. . /etc/rc.d/WOOFMERGEVARS
  152. if [ "$WOOF_HOSTARCH" != "$WOOF_TARGETARCH" ];then #woof did a cross-build
  153. echo -n " cross-build-fix" >/dev/console
  154. #these are normally done in 3builddistro.
  155. ldconfig #ldconfig put in by 3builddistro. rebuild /etc/ld.so.cache
  156. /usr/sbin/indexgen.sh #create master help index.
  157. /usr/sbin/fixmenus #Reconstruct configuration files for JWM, Fvwm95, IceWM. 120323 note: fixmenus corrects $LANG.
  158. /usr/bin/fc-cache -s -v #fontconfig cache
  159. PANGOMODULES="`find /etc/pango -type f -name pango.modules`"
  160. [ "$PANGOMODULES" = "" ] && PANGOMODULES='/etc/pango/pango.modules'
  161. [ ! -s ${PANGOMODULES} ] && pango-querymodules > ${PANGOMODULES}
  162. #120522 ubuntu precise puppy must have the schemas compiled (otherwise seamonkey crashed)...
  163. [ -d /usr/share/glib-2.0/schemas ] && [ -e /usr/bin/glib-compile-schemas ] && /usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas
  164. #120523 this too...
  165. [ -d /usr/lib/gio/modules ] && [ -e /usr/bin/gio-querymodules ] && /usr/bin/gio-querymodules /usr/lib/gio/modules
  166. #120605 note, /usr/lib/gtk-2.0/2.10.0/gtk.immodules is a symlink to this...
  167. gtk-query-immodules-2.0 > /etc/gtk-2.0/gtk.immodules #120605 shinobar.
  168. fi
  169. fi
  170. NEWPVERSION="`grep '^DISTRO_VERSION' /etc/DISTRO_SPECS | cut -f 2 -d '=' | cut -f 2 -d '"' | cut -f 2 -d "'" | cut -f 1 -d ' '`" #110422
  171. #w001 generate /etc/networkmodules...
  172. echo -n " network-drivers-list" >/dev/console
  173. /usr/sbin/updatenetmoduleslist.sh #creates /etc/networkmodules
  174. #110119 just in case something missing (like svg loader)...
  175. echo -n " pixbuf-loaders" >/dev/console
  176. gdk-pixbuf-query-loaders > /etc/gtk-2.0/gdk-pixbuf.loaders
  177. #110622 note, mageia1 requires above file to be at /usr/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache -- symlink created by 3builddistro.
  178. #w002 update icon cache (supposed to speed things up)...
  179. echo -n " gtk-icon-cache" >/dev/console
  180. #note, can use --ignore-theme-index if want to...
  181. /usr/bin/gtk-update-icon-cache -f /usr/share/icons/hicolor/
  182. #w002 generate desktop icons (previously done in unleashed)...
  183. echo -n " desk-icons" >/dev/console
  184. if [ -f /etc/desktop_icon_theme ];then #110119
  185. DEFAULT_DESK_ICONS="`cat /etc/desktop_icon_theme`" #Woof creates this.
  186. else #precaution
  187. DEFAULT_DESK_ICONS="`ls -1 /usr/local/lib/X11/themes | tail -n 1`"
  188. fi
  189. #110826 not needed, now done in 3builddistro...
  190. #/usr/sbin/icon_switcher_cli $DEFAULT_DESK_ICONS
  191. exit ###EXIT###
  192. ;;
  193. esac
  194. . $NEWFILESMNTPT/etc/DISTRO_SPECS #w020 has DISTRO_VERSION, DISTRO_BINARY_COMPAT, DISTRO_FILE_PREFIX
  195. NEWPVERSION="`grep '^DISTRO_VERSION' $NEWFILESMNTPT/etc/DISTRO_SPECS | cut -f 2 -d '=' | cut -f 2 -d '"' | cut -f 2 -d "'" | cut -f 1 -d ' '`" #110422
  196. #note, reboot after creating save file, this might not be there...
  197. # (but does get created, see bottom of this script)
  198. if [ -f $OLDFILESMNTPT/etc/puppyversion ];then
  199. OLDPVERSION="`cat $OLDFILESMNTPT/etc/puppyversion`" #110422
  200. rm -f $OLDFILESMNTPT/etc/puppyversion #init does this, but not in case of full hd install.
  201. fi
  202. [ -f $OLDFILESMNTPT/etc/DISTRO_SPECS ] && OLDPVERSION="`grep '^DISTRO_VERSION' $OLDFILESMNTPT/etc/DISTRO_SPECS | cut -f 2 -d '=' | cut -f 2 -d '"' | cut -f 2 -d "'" | cut -f 1 -d ' '`" #110422
  203. [ "$OLDPVERSION" = "" ] && OLDPVERSION="$NEWPVERSION" #110422
  204. if [ "$OLDPVERSION" = "0" ];then #101228 01micko: workaround for weird bug, full hd install.
  205. #OLDPVERSION=`expr $NEWPVERSION - 1`
  206. OLDPVERSION='0.0' #110422
  207. fi
  208. #if [ $NEWPVERSION -gt $OLDPVERSION ];then
  209. FLAGnew='false' #110422
  210. if vercmp $NEWPVERSION gt $OLDPVERSION ; then #110422
  211. FLAGnew='true' #110422
  212. VERstr='to version'
  213. [ "$OLDPVERSION" != "0.0" ] && VERstr="from version $OLDPVERSION to" #110422
  214. echo "Upgrading ${DISTRO_NAME} ${VERstr} ${NEWPVERSION}..." #110422
  215. echo -n " $OLDPVERSION to $NEWPVERSION" >/dev/console
  216. #need to identify files that absolutely must always be updated, when
  217. #there is a new version, and forcefully copy them...
  218. echo "Updating w.m. menus..."
  219. cp -af $NEWFILESMNTPT/root/.packages/Packages-* /root/.packages/ #w012
  220. cp -af $NEWFILESMNTPT/root/.packages/DISTRO_PKGS_SPECS /root/.packages/ #w012
  221. #110119...
  222. rm -rf /root/.packages/builtin_files
  223. cp -af $NEWFILESMNTPT/root/.packages/builtin_files /root/.packages/
  224. cp -af $NEWFILESMNTPT/root/.packages/woof-installed-packages /root/.packages/
  225. PKG_REPOS_ENABLED="`grep '^PKG_REPOS_ENABLED' /root/.packages/PKGS_MANAGEMENT | cut -f 2 -d "'"`" #geany'
  226. grep -v '^PKG_REPOS_ENABLED' $NEWFILESMNTPT/root/.packages/PKGS_MANAGEMENT > /tmp/PKGS_MANAGEMENT-tmp
  227. mv -f /tmp/PKGS_MANAGEMENT-tmp /root/.packages/PKGS_MANAGEMENT
  228. echo "PKG_REPOS_ENABLED='${PKG_REPOS_ENABLED}'" >> /root/.packages/PKGS_MANAGEMENT
  229. [ -f /etc/puppyversion ] && rm -f /etc/puppyversion #about time got rid of this.
  230. cp -af $NEWFILESMNTPT/etc/DISTRO_SPECS /etc/ #w012
  231. cp -af /root/.fvwm95rc /root/DOTfvwm95rc.bak 2>/dev/null
  232. cp -af /root/.jwmrc /root/DOTjwmrc.bak 2>/dev/null
  233. # Update if needed
  234. if [ -f $OLDFILESMNTPT/etc/xdg/templates/_root_.jwmrc -a \
  235. "`grep JWMRC_VERSION_001 $OLDFILESMNTPT/etc/xdg/templates/_root_.jwmrc`" = "" ]; then
  236. cp -af $NEWFILESMNTPT/etc/xdg/templates/_root_.jwmrc /etc/xdg/templates/
  237. fi
  238. cp -af /root/.icewm/menu /root/DOTicewmmenu.bak 2>/dev/null #v1.0.5
  239. cp -af $NEWFILESMNTPT/root/.fvwm95rc /root/ 2>/dev/null
  240. cp -af $NEWFILESMNTPT/root/.jwmrc /root/ 2>/dev/null
  241. cp -af $NEWFILESMNTPT/root/.icewm/menu /root/.icewm/ 2>/dev/null #v1.0.5
  242. #also update every boot and shutdown script...
  243. echo "Updating boot and shutdown system scripts..."
  244. cp -af $NEWFILESMNTPT/etc/rc.d/rc.country /etc/rc.d/
  245. cp -af $NEWFILESMNTPT/etc/rc.d/rc.network /etc/rc.d/
  246. cp -af $NEWFILESMNTPT/etc/rc.d/rc.shutdown /etc/rc.d/
  247. cp -af $NEWFILESMNTPT/etc/rc.d/rc.sysinit /etc/rc.d/
  248. cp -af $NEWFILESMNTPT/etc/rc.d/rc.update /etc/rc.d/
  249. #110119...
  250. cp -af $NEWFILESMNTPT/etc/rc.d/rc.services /etc/rc.d/
  251. cp -af $NEWFILESMNTPT/etc/rc.d/functions4puppy /etc/rc.d/
  252. cp -af $NEWFILESMNTPT/etc/rc.d/functions4puppy4 /etc/rc.d/
  253. SKIPLIST="`grep '^SKIPLIST' /etc/rc.d/MODULESCONFIG | cut -f 2 -d '"'`" #geany'
  254. ADDLIST="`grep '^ADDLIST' /etc/rc.d/MODULESCONFIG | cut -f 2 -d "'"`" #geany'
  255. REGEX1="s%^SKIPLIST.*%SKIPLIST=\"${SKIPLIST}\"%"
  256. REGEX2="s%^ADDLIST.*%ADDLIST='${ADDLIST}'%"
  257. cp -af $NEWFILESMNTPT/etc/rc.d/MODULESCONFIG /etc/rc.d/
  258. sed -i -e "${REGEX1}" -e "${REGEX2}" /etc/rc.d/MODULESCONFIG
  259. #110204 problem, as overwrites LANG setting...
  260. #cp -af $NEWFILESMNTPT/etc/profile /etc/
  261. xLANG="`grep '^LANG=' /etc/profile | cut -f 2 -d '=' | cut -f 1 -d ' '`"
  262. #110216 still not working. so, do this bad hack (see rc.shutdown)...
  263. [ -f /var/local/etc_profile_at_shutdown ] && xLANG="`grep '^LANG=' /var/local/etc_profile_at_shutdown | cut -f 2 -d '=' | cut -f 1 -d ' '`" #110216
  264. REGEX3="s%^LANG=.*%LANG=${xLANG}%"
  265. sed -e "$REGEX3" $NEWFILESMNTPT/etc/profile > /etc/profile
  266. #cp -af $NEWFILESMNTPT/usr/X11R7/bin/xwin /usr/X11R7/bin/
  267. cp -af $NEWFILESMNTPT/root/.xinitrc /root/
  268. #110122 make sure all woof scripts are updated... 110722 updated lists... 111009 update...
  269. for ONESCRIPT in df initrd_layer_test mount ps pupkill umount
  270. do
  271. cp -a -f --remove-destination $NEWFILESMNTPT/bin/$ONESCRIPT /bin/
  272. done
  273. for ONESCRIPT in clean_desk_icons dir2sfs dir2tgz initNEW poweroff probedisk probepart pup_event_backend_firmware pup_event_backend_modprobe pup_event_backend_modprobe_protect pup_event_frontend_d reboot runlevel test-eide test-scsi
  274. do
  275. cp -a -f --remove-destination $NEWFILESMNTPT/sbin/$ONESCRIPT /sbin/ 2>/dev/null
  276. done
  277. for ONESCRIPT in dir2pet dirs2pets evince gtkdialog-splash lprshell man new2dir pet2tgz petspec pman pupdialog restartwm startx tgz2pet wmexit wmpoweroff wmreboot wvdialshell xterm xwin yaf-splash
  278. do
  279. cp -a -f --remove-destination $NEWFILESMNTPT/usr/bin/$ONESCRIPT /usr/bin/ 2>/dev/null
  280. done
  281. for ONESCRIPT in alsaconf alsawizard askpass background_reshape bcrypt_gui bootflash bootmanager burniso2cd calcfreespace.sh cdburner-wizard chooselocale connectwizard connectwizard_2nd countrywizard cups_shell dotpup delayedrun deskshortcut.sh download_file eventmanager exploderpm filemnt fitimage2root fixdesk fixmenus fixPuppyPin floppy-format.sh framebufferwizard freememappletshell gen_modem_init_string get_bluetooth_connection get_modem_alternate_device grubconfig grubconfigREADME.txt icon_switcher icon_switcher_cli indexgen.sh input-wizard ipinfo loginmanager modemdisconnect modemprobe modemprobe_erase modemprobe_help modemtest networkdisconnect partview pcur pdict Pdisk petget pgprs-shell pmodemdiag pmonitork.sh pmonitorx.sh pmount pmovie pngoverlay pngoverlay.bac pngoverlay.sh pppconnect pppdisconnect pppsetup Pudd pup-advert-blocker pupautodetect pupcamera pupdial pupdial_init_hotpluggable pupdial_wizard_helper puppyhelp puppyinstaller puppypdf pupscan remasterpup2 remove_builtin report-video resizepfile.sh root2user save2flash save2image savesession-dvd scannerwizard.sh securetelnetshell set_bg set_hwclock_type set-time-for-puppy set-xftdpi sfsget shutdownconfig snapmergepuppy sns spacereplace systemvalues timezone-set updatenetmoduleslist.sh usb_modem_special_status usb_modeswitch_status video_upgrade_wizard video-wizard wakepup2 welcome1stboot welcome1stboot.bac wirelesswizard wizardwizard xdelta_gui xf86svga336wizard xgamma-gui xinitrc_test xorgwizard xorgwizard-automatic xrandrshell xserverwizard
  282. do
  283. cp -a -f --remove-destination $NEWFILESMNTPT/usr/sbin/$ONESCRIPT /usr/sbin/ 2>/dev/null
  284. done
  285. cp -a -f --remove-destination $NEWFILESMNTPT/usr/local/petget /usr/local/
  286. cp -a -f --remove-destination $NEWFILESMNTPT/usr/local/simple_network_setup /usr/local/
  287. cp -a -f --remove-destination $NEWFILESMNTPT/usr/local/video_upgrade /usr/local/
  288. #Remove old kernels if present
  289. for i in $(ls -d /lib/modules/[0-9]*)
  290. do
  291. OLDKERN=$(echo $i | cut -f 4 -d '/')
  292. if [ "$KERNVER" != "$OLDKERN" ]; then
  293. rm -rf $i
  294. fi
  295. done
  296. depmod_func #run depmod. 130217 extracted as a function.
  297. #alsaconf generates alsaconf.cards, maybe have to get rid of old one?... 110119
  298. [ -f /var/tmp/alsaconf.cards ] && rm -f /var/tmp/alsaconf.cards
  299. if [ -f /etc/modprobe.conf ];then #110119 deprecated.
  300. SNDCARD0="`grep '^alias snd\-card\-0' /etc/modprobe.conf`"
  301. SNDSLOT0="`grep '^alias sound\-slot\-0' /etc/modprobe.conf`"
  302. rm -f /etc/modprobe.conf
  303. [ "$SNDCARD0" ] && echo "$SNDCARD0" >> /etc/modprobe.d/alsa.conf
  304. [ "$SNDSLOT0" ] && echo "$SNDSLOT0" >> /etc/modprobe.d/alsa.conf
  305. fi
  306. #v2.14 Jesse suggested this. remove any broken shared library symlinks...
  307. find / -mount -noleaf -path '*/lib/*' -type l -name *.so -o -noleaf -path '*/lib/*' -type l -name *.so.* |
  308. while read ONESYMLINK
  309. do
  310. ONESYMDEST="`readlink $ONESYMLINK`"
  311. ONESYMDIR="`dirname $ONESYMLINK`"
  312. FIRSTCHAR="`echo -n "$ONESYMDEST" | cut -b 1`"
  313. if [ "$FIRSTCHAR" = "/" ];then
  314. [ ! -e "$ONESYMDEST" ] && rm -f $ONESYMLINK
  315. else
  316. [ ! -e $ONESYMDIR/$ONESYMDEST ] && rm -f $ONESYMLINK
  317. fi
  318. done
  319. #111009 try fix upgrading old wary save-file...
  320. if [ "$PUPMODE" != "option2hdinstall" ];then
  321. case $DISTRO_FILE_PREFIX in
  322. wary)
  323. if vercmp $OLDPVERSION lt 5.1.5;then #before i recompiled everything in t2.
  324. #x might not work, wipe all stuff in save-file...
  325. rm -rf $OLDFILESMNTPT/usr/X11R7/* #hmmm, will this show on top?
  326. rm -f /etc/X11/xorg.conf
  327. #111026 upnorth posted this.. (http://murga-linux.com/puppy/viewtopic.php?t=72258&start=90)
  328. rm /etc/gtk-2.0/gdk-pixbuf.loaders
  329. gdk-pixbuf-query-loaders >/etc/gtk-2.0/gdk-pixbuf.loaders
  330. fi
  331. ;;
  332. esac
  333. fi
  334. #w001 generate /etc/networkmodules...
  335. echo -n " network-drivers-list" >/dev/console
  336. /usr/sbin/updatenetmoduleslist.sh
  337. #w002 update icon cache (supposed to speed things up)...
  338. echo -n " gtk-icon-cache" >/dev/console
  339. /usr/bin/gtk-update-icon-cache -f /usr/share/icons/hicolor/
  340. #110119 just in case something missing (like svg loader)...
  341. echo -n " pixbuf-loaders" >/dev/console
  342. gdk-pixbuf-query-loaders > /etc/gtk-2.0/gdk-pixbuf.loaders
  343. #110622 note, mageia1 requires above file to be at /usr/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache -- symlink created by 3builddistro.
  344. #111027 sometimes these go back to 755... 01micko reports this problem with full install
  345. chmod 777 /tmp
  346. chmod 777 /var
  347. #moved this stuff down from line 166. fixmenus must run after desktop icons setup...
  348. #master help index has to be updated...
  349. /usr/sbin/indexgen.sh
  350. #120209 i think these also need to run, in case a target file has changed and needs to be re-translated...
  351. #but, i think the english target files will have to be copied to top first...
  352. SSSDESK="`grep '^\[' $NEWFILESMNTPT/usr/share/sss/desk_strings/desk_strings | tr -d '[' | tr -d ']' | tr '\n' ' '`"
  353. SSSSCRIPTS="`grep '^\[' $NEWFILESMNTPT/usr/share/sss/script_strings/script_strings | tr -d '[' | tr -d ']' | tr '\n' ' '`"
  354. for ASECTIONID in ${SSSDESK} ${SSSSCRIPTS} #ex: general _woof_.jwmrc
  355. do
  356. #allow any character to be the 'marker' for / in the section-id...
  357. MARKERCHAR="`echo -n "$ASECTIONID" | cut -c 1`"
  358. TARGETFILE="`echo -n "$ASECTIONID" | tr "${MARKERCHAR}" '/'`" #ex: /root/Choices/ROX-Filer/PuppyPin
  359. if [ -f ${NEWFILESMNTPT}${TARGETFILE} ];then #precaution.
  360. TARGETPATH="`dirname $TARGETFILE`"
  361. cp -a -f ${NEWFILESMNTPT}${TARGETFILE} ${TARGETPATH}/
  362. fi
  363. [ -f /var/local/sss${TARGETFILE} ] && rm -f /var/local/sss${TARGETFILE} #remove previous en backup (see fixdesk)
  364. done
  365. LANG=$xLANG /usr/sbin/fixscripts
  366. LANG=$xLANG /usr/sbin/fixdesk
  367. #Reconstruct configuration files for JWM, Fvwm95, IceWM... 120209 append LANG...
  368. LANG=$xLANG /usr/sbin/fixmenus
  369. fi
  370. xLANG="`grep '^LANG=' /etc/profile | cut -f 2 -d '=' | cut -f 1 -d ' '`"
  371. #stuff to update on every boot...
  372. #think have to do this everytime...
  373. cp -af $NEWFILESMNTPT/etc/DISTRO_SPECS /etc/
  374. touch /etc/DISTRO_SPECS #important, as snapmergepuppy uses '-u' cp option. ...huh, why?
  375. #v2.16 if unionfs layers have changed, may need to fix menu (etc)...
  376. #note, BootManager may be popped-up, see /usr/sbin/delayedrun.
  377. if [ -d /initrd ];then #test it isn't full hd installation.
  378. . /etc/rc.d/BOOTCONFIG
  379. #v2.16.1 bug with multisession-cd, different folder at each startup, so screen out...
  380. xLASTUNIONRECORD="`echo -n "$LASTUNIONRECORD" | sed -e 's/^20[0-9][0-9][-0123456789]* //'`"
  381. xPREVUNIONRECORD="`echo -n "$PREVUNIONRECORD" | sed -e 's/^20[0-9][0-9][-0123456789]* //'`"
  382. if [ "$xLASTUNIONRECORD" != "$xPREVUNIONRECORD" ];then
  383. echo -en " layered-filesystem \\033[1;35mnext boot will be faster!\\033[0;39m" > /dev/console
  384. echo "Unionfs layers have changed since previous boot, fixing menu..."
  385. #master help index has to be updated...
  386. /usr/sbin/indexgen.sh
  387. #Reconstruct configuration files for JWM, Fvwm95, IceWM...
  388. LANG=$xLANG /usr/sbin/fixmenus
  389. fc-cache -f #120323 shinobar: some sfs files may have fonts
  390. which gtk-query-immodules-2.0 &>/dev/null && gtk-query-immodules-2.0 > /etc/gtk-2.0/gtk.immodules #120323 shinobar: refresh gtk.immodules
  391. depmod_func #120323 shinobar: and some sfs may have kernel modules. 130217 depmod extracted as a function.
  392. #w007 has a 'zdrv' layer been added or removed?...
  393. EXMOD_CNT=0
  394. zzPATTERN='zdrv' #120323 have settled on this in all zdrv sfs filenames.
  395. EXMOD_SFS1="`echo "$xLASTUNIONRECORD" | tr ' ' '\n' | grep "$zzPATTERN"`"
  396. EXMOD_SFS2="`echo "$xPREVUNIONRECORD" | tr ' ' '\n' | grep "$zzPATTERN"`"
  397. [ "$EXMOD_SFS1" != "" ] && EXMOD_CNT=1
  398. [ "$EXMOD_SFS2" != "" ] && EXMOD_CNT=`expr $EXMOD_CNT + 1`
  399. if [ $EXMOD_CNT -eq 2 ];then
  400. [ "$EXMOD_SFS1" != "$EXMOD_SFS2" ] && EXMOD_CNT=1 #may have changed to a different zdrv sfs.
  401. fi
  402. if [ $EXMOD_CNT -eq 1 ];then
  403. #depmod #120323 removed, already done above.
  404. /usr/sbin/updatenetmoduleslist.sh
  405. fi
  406. fi
  407. #fix the desktop...
  408. #note, init does 'touch' on PuppyPin and globicons to prevent overwrite at version upgrade.
  409. #if [ $NEWPVERSION -gt $OLDPVERSION -o "$xLASTUNIONRECORD" != "$xPREVUNIONRECORD" ];then
  410. if [ "$FLAGnew" = "true" -o "$xLASTUNIONRECORD" != "$xPREVUNIONRECORD" ];then #110422
  411. #need some way to retain user-modifications, especially additions to desktop...
  412. #one way is to just merge everything and then delete invalid entries...
  413. #DennisF reported backdrop image reverted to default.jpg, so screen out default here...
  414. grep -v '<backdrop' $NEWFILESMNTPT/root/Choices/ROX-Filer/PuppyPin >> /root/Choices/ROX-Filer/PuppyPin
  415. cat $NEWFILESMNTPT/root/Choices/ROX-Filer/globicons >> /root/Choices/ROX-Filer/globicons
  416. #an inconstency, user-mod to desktop, PuppyPin gets changed in
  417. #/root/Choices/ROX-Filer/, but globicons gets copied and updated in
  418. #/root/.config/rox.sourceforge.net/ROX-Filer/...
  419. if [ -f /root/.config/rox.sourceforge.net/ROX-Filer/globicons ];then
  420. cat /root/.config/rox.sourceforge.net/ROX-Filer/globicons >> /root/Choices/ROX-Filer/globicons
  421. rm -f /root/.config/rox.sourceforge.net/ROX-Filer/globicons
  422. fi
  423. for LAYERNUM in 3 4 5 6 7 8 9 #v431 added 6 7 8 9
  424. do
  425. [ -f /initrd/pup_ro$LAYERNUM/root/Choices/ROX-Filer/PuppyPin ] && cat /initrd/pup_ro$LAYERNUM/root/Choices/ROX-Filer/PuppyPin >> /root/Choices/ROX-Filer/PuppyPin
  426. [ -f /initrd/pup_ro$LAYERNUM/root/Choices/ROX-Filer/globicons ] && cat /initrd/pup_ro$LAYERNUM/root/Choices/ROX-Filer/globicons >> /root/Choices/ROX-Filer/globicons
  427. done
  428. echo '<?xml version="1.0"?>' > /tmp/PuppyPinTmp
  429. echo '<pinboard>' >> /tmp/PuppyPinTmp
  430. grep -v -E 'pinboard>|<\?xml' /root/Choices/ROX-Filer/PuppyPin | sort -u >> /tmp/PuppyPinTmp
  431. echo '</pinboard>' >> /tmp/PuppyPinTmp
  432. #120225 non-english locale may have translations for PuppyPin. translate en text now, and
  433. #duplicates will get removed further down...
  434. if [ -f /usr/share/sss/desk_strings/desk_strings.${xLANG%_*} ];then #ex: script_strings.de
  435. sPTN="/^\[_root_Choices_ROX-Filer_PuppyPin\]/,/^$/p" #this is a multi-line block find expression.
  436. CODEBLOCK="`sed -n "$sPTN" /usr/share/sss/desk_strings/desk_strings.${xLANG%_*} | sed -e '/^#/d' -e '/%%/d' -e '/^$/d' -e '/^\[/d'`" #extracts just the relevant block of lines.
  437. if [ "$CODEBLOCK" ];then
  438. echo "$CODEBLOCK" > /tmp/rc-update-puppypin-codeblock
  439. sed -i -f /tmp/rc-update-puppypin-codeblock /tmp/PuppyPinTmp
  440. fi
  441. fi
  442. #sort -u only gets rid of completely duplicate lines. delete duplicate execs...
  443. #also delete line if exec is invalid. also avoid overlapping icons...
  444. EXECSLOG="";XYLOG=""
  445. echo -n "" > /root/Choices/ROX-Filer/PuppyPin
  446. cat /tmp/PuppyPinTmp |
  447. while read ONELINE
  448. do
  449. if [ "`echo -n "$ONELINE" | grep -v '<icon '`" != "" ];then
  450. echo "$ONELINE" >> /root/Choices/ROX-Filer/PuppyPin
  451. continue
  452. fi
  453. ONEEXEC="`echo -n "$ONELINE" | cut -f 2 -d '>' | cut -f 1 -d '<'`"
  454. ONEX=`echo -n "$ONELINE" | cut -f 1 -d '>' | cut -f 2 -d '"'` #'geany
  455. ONEY=`echo -n "$ONELINE" | cut -f 1 -d '>' | cut -f 4 -d '"'` #'geany
  456. ONEXY0="${ONEX}_${ONEY}"
  457. ONEXY="${ONEX}_${ONEY}"
  458. while [ "`echo -n "$XYLOG" | grep "$ONEXY"`" != "" ];do
  459. ONEX=`expr $ONEX + 32` #64
  460. ONEY=`expr $ONEY + 48` #96
  461. ONEXY="${ONEX}_${ONEY}"
  462. done
  463. if [ "`echo "$EXECSLOG" | grep "$ONEEXEC"`" = "" ];then
  464. if [ -e $ONEEXEC ];then #could be a file, symlink or directory(rox-dir).
  465. XYLOG="$XYLOG $ONEXY"
  466. if [ "$ONEXY" = "$ONEXY0" ];then
  467. echo "$ONELINE" >> /root/Choices/ROX-Filer/PuppyPin
  468. else
  469. #icon has to be moved...
  470. XPATTERN="s/x=\"[0-9]*\"/x=\"${ONEX}\"/g"
  471. YPATTERN="s/y=\"[0-9]*\"/y=\"${ONEY}\"/g"
  472. echo "$ONELINE" | sed -e "$XPATTERN" | sed -e "$YPATTERN" >> /root/Choices/ROX-Filer/PuppyPin
  473. fi
  474. fi
  475. fi
  476. EXECSLOG="$EXECSLOG $ONEEXEC"
  477. done
  478. #now do globicons file...
  479. echo '<?xml version="1.0"?>' > /tmp/globiconsTmp
  480. echo '<special-files>' >> /tmp/globiconsTmp
  481. grep -v -E 'special\-files>|<\?xml' /root/Choices/ROX-Filer/globicons >> /tmp/globiconsTmp
  482. echo '</special-files>' >> /tmp/globiconsTmp
  483. #get rid of duplicate entries...
  484. RULESLOG="";FLAGIGNORE="";ONERULE=""
  485. echo -n "" > /root/Choices/ROX-Filer/globicons
  486. #v431 add tests that executables and icons exist...
  487. #v431 make sure tags start new lines...
  488. cat /tmp/globiconsTmp | tr -d '\n' | sed -e 's%$%\n%' -e 's%<icon>%\n<icon>%g' -e 's%<rule%\n<rule%g' -e 's%</rule>%\n</rule>%g' -e 's%</special%\n</special%g' -e 's%<special%\n<special%g' |
  489. while read ONELINE
  490. do
  491. if [ "`echo -n "$ONELINE" | grep 'rule match'`" != "" ];then
  492. ONERULE="`echo -n "$ONELINE" | cut -f 2 -d '"'`" #'geany
  493. read ONEICON
  494. read ENDRULE
  495. [ "`echo -n "$RULESLOG" | grep "$ONERULE"`" != "" ] && continue #avoid duplicates.
  496. [ ! -e "$ONERULE" ] && continue #test executable exists.
  497. REALICON="`echo -n "$ONEICON" | cut -f 2 -d '>' | cut -f 1 -d '<'`"
  498. [ ! -e "$REALICON" ] && continue #test icon exists.
  499. RULESLOG="$RULESLOG $ONERULE"
  500. echo "$ONELINE
  501. $ONEICON
  502. $ENDRULE" >> /root/Choices/ROX-Filer/globicons
  503. else
  504. echo "$ONELINE" >> /root/Choices/ROX-Filer/globicons
  505. fi
  506. done
  507. fi
  508. fi
  509. ###END###