Advertisement
s243a

/etc/rc.d/rc.update (attack pup)

Feb 21st, 2021
1,556
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 21.49 KB | None | 0 0
  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. # 2009-2 TazOC a few cosmetic updates, echo progress dots to console
  15. # 2009-6-12 TazOC custom LHP rox icons (globicons) and pinboard handling
  16. # 2009-9 TazOC Puppy 4.3 xwin moved from /usr/X11R7/bin to /usr/bin
  17.  
  18. #This script is called by /etc/rc.d/rc.sysinit. the purpose is to perform
  19. #any required updates to files when a new version of Puppy is booted.
  20.  
  21. #this script can also be called by /usr/sbin/puppyinstaller, when doing a full install
  22. #(option2) to hard drive. in that case, chroot to hd partition, and the ${DISTRO_FILE_PREFIX}_xxx.sfs
  23. #source files are mounted on /srcmntpt in the hd partition.
  24. #puppyinstaller will call here with PUPMODE="option2hdinstall"
  25.  
  26. PUPMODE="$1"
  27. KERNVER="`uname -r`"
  28. [ -z $DISPLAY ] || XSTATUS="yes" #v3.99
  29.  
  30.  
  31.  [ "$PUPMODE" = "" ] && exit
  32.  case $PUPMODE in
  33.   "7") #tmpfs (pup_rw), hd for persistent storage (pup_ro1), ${DISTRO_FILE_PREFIX}rxxx.sfs (pup_ro2).
  34.    NEWFILESMNTPT="/initrd/pup_ro2"
  35.    OLDFILESMNTPT="/initrd/pup_ro1"
  36.    ;;
  37.   "6") #no tmpfs, PDEV1 (pup_rw), ${DISTRO_FILE_PREFIX}rxxx.sfs (pup_ro2)
  38.    #have booted from PDEV1 partition, which has initrd.gz & ${DISTRO_FILE_PREFIX}rxxx.sfs files on it, and
  39.    #session has been saved direct to the partition. (very similar to mode 12)
  40.    NEWFILESMNTPT="/initrd/pup_ro2"
  41.    OLDFILESMNTPT="/initrd/pup_rw"
  42.    ;;
  43.   "12") #no tmpfs, ${DISTRO_FILE_PREFIX}save.3fs (pup_rw), nothing (pup_ro1), ${DISTRO_FILE_PREFIX}rxxx.sfs (pup_ro2)
  44.    #example: boot from live-cd, ${DISTRO_FILE_PREFIX}save.3fs on a fast h.d. partition.
  45.    NEWFILESMNTPT="/initrd/pup_ro2"
  46.    OLDFILESMNTPT="/initrd/pup_rw"
  47.    ;;
  48.   "13") #tmpfs (pup_rw), ${DISTRO_FILE_PREFIX}save.3fs (pup_ro1), ${DISTRO_FILE_PREFIX}rxxx.sfs (pup_ro2).
  49.    #example: boot from usb flash, ${DISTRO_FILE_PREFIX}save.3fs on flash media (needs restrained writes).
  50.    NEWFILESMNTPT="/initrd/pup_ro2"
  51.    OLDFILESMNTPT="/initrd/pup_ro1"
  52.    ;;
  53.   "77") #tmpfs (pup_rw), folders (pup_ro1), ${DISTRO_FILE_PREFIX}rxxx.sfs (pup_ro2).
  54.    #example: boot from multisession live-cd/dvd, pup_ro1 is a tmpfs folders copied from cd.
  55.    NEWFILESMNTPT="/initrd/pup_ro2"
  56.    OLDFILESMNTPT="/initrd/pup_ro1"
  57.    ;;
  58.   "option2hdinstall")
  59.    NEWFILESMNTPT="/srcmntpt"
  60.    OLDFILESMNTPT=""
  61.    ;;
  62.   5) #v423
  63.    #PUPMODE=5 is first boot, ignore.
  64.    NEWPVERSION=`grep '^DISTRO_VERSION' /etc/DISTRO_SPECS | cut -f 2 -d '=' | cut -f 1 -d ' '`
  65.    #w001 generate /etc/networkmodules...
  66.    echo -n " network-drivers-list" >/dev/console
  67.    /usr/sbin/updatenetmoduleslist.sh
  68.    #w002 update icon cache (supposed to speed things up)...
  69.    echo -n " gtk-icon-cache" >/dev/console
  70.    /usr/bin/gtk-update-icon-cache -f /usr/share/icons/hicolor/
  71.    #w002 generate desktop icons (previously done in unleashed)...
  72.    echo -n " desk-icons" >/dev/console
  73.    DEFAULT_DESK_ICONS="JQ8flat"
  74.    [ $NEWPVERSION -ge 500 ] && DEFAULT_DESK_ICONS="JQ8flat"
  75.    [ ! -d /usr/local/lib/X11/themes/JQ8flat ] && DEFAULT_DESK_ICONS="Stardust"
  76.    [ -f /etc/desktop_icon_theme ] && DEFAULT_DESK_ICONS="`cat /etc/desktop_icon_theme`" #w477
  77.    /usr/sbin/icon_switcher_cli $DEFAULT_DESK_ICONS
  78.    exit ###EXIT###
  79.    ;;
  80.   *) #v423 PUPMODE=2 (full hd install) then just exit.
  81.    exit
  82.    ;;
  83.  esac
  84.  
  85. . $NEWFILESMNTPT/etc/DISTRO_SPECS #w020 has DISTRO_VERSION, DISTRO_BINARY_COMPAT, DISTRO_FILE_PREFIX
  86.  
  87. #w020 compose name of 'zdrv', to fit 8+3 filename...
  88. PREFIX1CHAR="`echo -n "$DISTRO_FILE_PREFIX" | cut -c 1`"
  89. KERNEL3CHARS="`echo -n "$KERNELVER" | tr -d '.' | tr -d '\-' | tr -d '[a-z]' | rev | cut -c 1,2,3 | rev`"
  90. ZDRVSFS="z${PREFIX1CHAR}${DISTRO_VERSION}${KERNEL3CHAR}.sfs"
  91.  
  92.  NEWPVERSION=`grep '^DISTRO_VERSION' $NEWFILESMNTPT/etc/DISTRO_SPECS | cut -f 2 -d '=' | cut -f 1 -d ' '`
  93.  #note, reboot after creating save file, this might not be there...
  94.  # (but does get created, see bottom of this script)
  95.  if [ -f $OLDFILESMNTPT/etc/puppyversion ];then
  96.   OLDPVERSION=`cat $OLDFILESMNTPT/etc/puppyversion`
  97.   rm -f $OLDFILESMNTPT/etc/puppyversion #init does this, but not in case of full hd install.
  98.  fi
  99.  [ -f $OLDFILESMNTPT/etc/DISTRO_SPECS ] && OLDPVERSION=`grep '^DISTRO_VERSION' $OLDFILESMNTPT/etc/DISTRO_SPECS | cut -f 2 -d '=' | cut -f 1 -d ' '`
  100.  [ ! $OLDPVERSION ] && OLDPVERSION=$NEWPVERSION
  101.  
  102.  if [ $NEWPVERSION -gt $OLDPVERSION ];then
  103.   echo "Upgrading ${DISTRO_NAME} from version $OLDPVERSION to $NEWPVERSION..."
  104.   echo -n " $OLDPVERSION to $NEWPVERSION" >/dev/console
  105.  
  106.   #need to identify files that absolutely must always be updated, when
  107.   #there is a new version, and forcefully copy them...
  108.   echo "Updating w.m. menus..."
  109.   cp -af $NEWFILESMNTPT/root/.packages/Packages-* /root/.packages/ #w012
  110.   cp -af $NEWFILESMNTPT/root/.packages/DISTRO_PKGS_SPECS /root/.packages/ #w012
  111.   cp -af $NEWFILESMNTPT/etc/DISTRO_SPECS /etc/ #w012
  112.   #cp -af $NEWFILESMNTPT/etc/puppyversion /etc/   now doing it everytime.
  113.   cp -af /root/.fvwm95rc /root/DOTfvwm95rc.bak 2>/dev/null
  114.   cp -af /root/.jwmrc /root/DOTjwmrc.bak 2>/dev/null
  115.   cp -af /root/.icewm/menu /root/DOTicewmmenu.bak 2>/dev/null #v1.0.5
  116.   cp -af $NEWFILESMNTPT/root/.fvwm95rc /root/ 2>/dev/null
  117.   cp -af $NEWFILESMNTPT/root/.jwmrc /root/ 2>/dev/null
  118.   cp -af $NEWFILESMNTPT/root/.icewm/menu /root/.icewm/ 2>/dev/null #v1.0.5
  119.   #also update every boot and shutdown script...
  120.   #v2.21 question, why are we doing this?... harmeless, but why?...
  121.   echo "Updating boot and shutdown system scripts..."
  122.   cp -af $NEWFILESMNTPT/etc/rc.d/rc.country /etc/rc.d/
  123.   cp -af $NEWFILESMNTPT/etc/rc.d/rc.local0 /etc/rc.d/
  124.   cp -af $NEWFILESMNTPT/etc/rc.d/rc.modem /etc/rc.d/
  125.   cp -af $NEWFILESMNTPT/etc/rc.d/rc.modules /etc/rc.d/
  126.   cp -af $NEWFILESMNTPT/etc/rc.d/rc.modules2 /etc/rc.d/
  127.   cp -af $NEWFILESMNTPT/etc/rc.d/rc.network /etc/rc.d/
  128.   cp -af $NEWFILESMNTPT/etc/rc.d/rc.shutdown /etc/rc.d/
  129.   cp -af $NEWFILESMNTPT/etc/rc.d/rc.sysinit /etc/rc.d/
  130.   cp -af $NEWFILESMNTPT/etc/rc.d/rc.update /etc/rc.d/
  131.   cp -af $NEWFILESMNTPT/etc/profile /etc/
  132.   cp -af $NEWFILESMNTPT/usr/bin/xwin /usr/bin/ #TazOC
  133.   cp -af $NEWFILESMNTPT/root/.xinitrc /root/
  134.  
  135.  
  136.   #then run depmod to overwrite any depmod files on OLD layer...
  137.   echo "Executing depmod, to update module files..."
  138.   depmod
  139.  
  140.  
  141.   if [ $NEWPVERSION -lt 200 ];then
  142.    #keep the menu right for our alpha/beta releases...
  143.    cp -af $NEWFILESMNTPT/root/Choices/ROX-Filer/globicons /root/Choices/ROX-Filer/
  144.    cp -af $NEWFILESMNTPT/root/Choices/ROX-Filer/PuppyPin /root/Choices/ROX-Filer/
  145.   fi
  146.  
  147.   #FUTURE: test for particular version updates here...
  148.   if [ $OLDPVERSION -lt 201 ];then
  149.    cp -af $NEWFILESMNTPT/etc/group /etc/ #added 'audio' group
  150.    #bugfixes may conflict with user customisations in rc.local...
  151.    if [ -f $OLDFILESMNTPT/etc/rc.d/rc.local ];then
  152.     mv -f /etc/rc.d/rc.local /tmp/
  153.     echo '#version upgrade, any prior content of rc.local moved to /tmp/rc.local' > /etc/rc.d/rc.local
  154.    fi
  155.    #alsaconf generates alsaconf.cards, maybe have to get rid of old one?...
  156.    [ -f /var/tmp/alsaconf.cards ] && rm -f /var/tmp/alsaconf.cards
  157.   fi
  158.  
  159.   if [ $OLDPVERSION -lt 217 ];then
  160.    #have some new stuff in /etc/modprobe.conf, but cannot just overwrite
  161.    #as user may have modified it. so just append the new stuff...
  162.    if [ "`cat /etc/modprobe.conf | grep 'tifm_7xx1'`" = "" ];then
  163.     echo 'install sdhci /sbin/modprobe mmc_block major=253 ; /sbin/modprobe --ignore-install sdhci' >> /etc/modprobe.conf
  164.     echo 'remove sdhci /sbin/modprobe -r --ignore-remove sdhci ; /sbin/modprobe -r mmc_block' >> /etc/modprobe.conf
  165.     echo 'install tifm_7xx1 /sbin/modprobe --ignore-install tifm_7xx1 ; /sbin/modprobe mmc_block major=253 ; /sbin/modprobe tifm_sd' >> /etc/modprobe.conf
  166.    fi
  167.   fi
  168.  
  169.   #master help index has to be updated...
  170.   /usr/sbin/indexgen.sh
  171.   #Reconstruct configuration files for JWM, Fvwm95, IceWM...
  172.   /usr/sbin/fixmenus
  173.  
  174.   #v2.14 Jesse suggested this. remove any broken shared library symlinks...
  175.   find / -mount -noleaf -path '*/lib/*' -type l -name *.so -o -noleaf -path '*/lib/*' -type l -name *.so.* |
  176.   while read ONESYMLINK
  177.   do
  178.    ONESYMDEST="`readlink $ONESYMLINK`"
  179.    ONESYMDIR="`dirname $ONESYMLINK`"
  180.    FIRSTCHAR="`echo -n "$ONESYMDEST" | cut -b 1`"
  181.    if [ "$FIRSTCHAR" = "/" ];then
  182.     [ ! -e "$ONESYMDEST" ] && rm -f $ONESYMLINK
  183.    else
  184.     [ ! -e $ONESYMDIR/$ONESYMDEST ] && rm -f $ONESYMLINK
  185.    fi
  186.   done
  187.  
  188.   #v3.99 find any missing deps from user-installed Puppy2 or Puppy3 pkgs...
  189.   #v4.01 removed some multimedia deps that are now in puppy4...
  190.   NEWMAJORDIGIT="`echo -n "$NEWPVERSION" | cut -b 1`"
  191.   [ $NEWPVERSION -eq 399 ] && NEWMAJORDIGIT="4"
  192.   if [ $NEWPVERSION -gt 389 ];then
  193.    if [ $OLDPVERSION -lt 390 ];then
  194.     /usr/local/petget/findinstalledpkgs.sh #writes to /tmp/petget_installedpkgs
  195.     INSTALLEDPKGS="`cat /tmp/petget_installedpkgs | cut -f 2 -d '"'`" #'geany
  196.     MISSINGPKGS=""
  197.     #if [ "$INSTALLEDPKGS" != "" ];then
  198.      DEPENDPKGS="`cat /tmp/petget_installedpkgs | cut -f 6 -d '"' | tr -s ' ' | cut -f 2 -d " " | tr "," "\n" | grep "^\+" |  sed -e 's/^\+//g' | sort -u`" #'geany
  199.      if [ $OLDPVERSION -lt 300 ];then
  200.       #major pkgs in Puppy2 that are not in Puppy4...
  201.       OLDMAJORDIGIT="2"
  202.       MISSINGPKGS="`echo "$DEPENDPKGS" | grep -E 'gtk+12|gdkxft|tk|tcl|qt|tix|libidn|fig2dev|audiofile|imlib|gdk_pixbuf10|combobox|pstoedit|speex|libosip2|mtools|gnocl|^uri|tktable|tablelist|tile|trf|cdrdao' | tr '\n' ' ' | sed -e 's/ $//'`"
  203.       GENERICDEPS="GTK1:       gtk+12 gdkxft gdk_pixbuf10 glib12
  204. Tcl/Tk:     tk tcl tix uri tktable tablelist tile trf combobox gnocl img
  205. Qt:         qt
  206. Xlib:       imlib libxaw95_DEP4
  207. Multimedia: speex libosip2 cdrdao sox
  208. Misc.:      libidn fig2dev pstoedit mtools"
  209.      else
  210.       OLDMAJORDIGIT="3"
  211.       MISSINGPKGS="`echo "$DEPENDPKGS" | grep -E 'gtk+12|gdkxft|tk|tcl|qt|tix|libidn|fig2dev|audiofile|imlib|gdk_pixbuf10|combobox|pstoedit|speex|libosip2|mtools|gnocl|^uri|tktable|tablelist|tile|trf|cdrdao|libxcb|dbus$|dbus_qt|dbus_glib' | tr '\n' ' ' | sed -e 's/ $//'`"
  212.       GENERICDEPS="GTK1:       gtk+12 gdkxft gdk_pixbuf10 glib12
  213. Tcl/Tk:     tk tcl tix uri tktable tablelist tile trf combobox gnocl img
  214. Qt:         qt
  215. Xlib:       imlib libxaw95_DEP4
  216. Multimedia: speex libosip2 cdrdao sox
  217. Misc.:      libidn fig2dev pstoedit mtools
  218. ESSENTIAL:  libxcb dbus dbus_qt dbus_glib"
  219.      fi
  220.      echo >/dev/console
  221.      echo -e "\\033[1;31m" >/dev/console #31=red
  222.      if [ "$MISSINGPKGS" != "" ];then
  223.       echo "There are Puppy${OLDMAJORDIGIT} packages installed with these missing dependencies in Puppy${NEWMAJORDIGIT}:" >/dev/console
  224.       echo " $MISSINGPKGS" >/dev/console
  225.      fi
  226.      xINSTALLEDPKGS="`echo -n "$INSTALLEDPKGS" | tr '\n'  ' '`"
  227.      echo "You will either have to uninstall the Puppy${OLDMAJORDIGIT} packages, or install the missing" >/dev/console
  228.      echo "dependencies -- the latter is easy: click the 'install' icon on the desktop" >/dev/console
  229.      echo "after Puppy is running and you have Internet access." >/dev/console
  230.      echo >/dev/console
  231.      echo "These are the most likely missing dependencies (if in doubt, install them all!):" >/dev/console
  232.      echo "PKG-TYPE    MISSING DEPENDENCIES" >/dev/console
  233.      echo "${GENERICDEPS}" >/dev/console
  234.      echo >/dev/console
  235.      echo "PLEASE WRITE THESE DEPENDENCIES DOWN ON A PIECE OF PAPER RIGHT NOW." >/dev/console
  236.      echo -e "\\033[0;39m" >/dev/console
  237.      if [ "$XSTATUS" = "yes" ];then
  238.       xmesssage "Dependencies may be missing in Puppy ${NEWPVERSION}.
  239. You will either have to uninstall the Puppy${OLDMAJORDIGIT} packages, or install the missing
  240. dependencies -- the latter is easy: click the 'install' icon on the desktop
  241. after Puppy is running and you have Internet access.
  242.  
  243. These are the most likely missing dependencies (if in doubt, install them all!):
  244. PKG-TYPE    MISSING DEPENDENCIES
  245. ${GENERICDEPS}
  246.  
  247. PLEASE WRITE THESE PACKAGE NAMES DOWN ON A PIECE OF PAPER RIGHT NOW."
  248.      else
  249.       echo -n "Then, press the ENTER key to continue: " >/dev/console
  250.       read keepgoingnow
  251.      fi
  252.     #fi
  253.    fi
  254.   fi
  255.  
  256.   if [ $OLDPVERSION -lt 411 ];then #v411
  257.    #remove the config files for the old Network Wizard...
  258.    rm -f /etc/*[0-9]mode
  259.   fi
  260.  
  261.   if [ $OLDPVERSION -lt 464 ];then #w464
  262.    if [ -f /etc/mousedevice ];then
  263.     #not using 'psaux' anymore (scrollwheel broken)...
  264.     [ "`cat /etc/mousedevice`" = "psaux" ] && echo -n "input/mice" > /etc/mousedevice
  265.    fi
  266.   fi
  267.  
  268.   #v425 updating from 420 or 421 is a problem as it has tcl/tk apps...
  269.   if [ $OLDPVERSION -eq 420 -o $OLDPVERSION -eq 421 ];then
  270.    if [ $NEWPVERSION -gt 424 ];then #4.3beta3 or greater
  271.     RBWARNMSG="WARNING!
  272. Puppy 420 and 421 has tcl/tk libraries builtin, but 430 and later do not.
  273. Therefore, if you have installed any applications that require these
  274. libraries then they will not work. You will have to run the Puppy Package
  275. Manager and install them."
  276.     echo >/dev/console
  277.     echo -e "\\033[1;31m" >/dev/console #31=red
  278.     echo "$RBWARNMSG" >/dev/console
  279.     echo -e "\\033[0;39m" >/dev/console
  280.     if [ "$XSTATUS" = "yes" ];then
  281.      xmessage -bg red -center "$RBWARNMSG"
  282.     else
  283.      echo -n "Press the ENTER key to continue: " >/dev/console
  284.      read keepgoingnow
  285.     fi
  286.    fi
  287.   fi
  288.  
  289.   if [ $NEWPVERSION -gt 424 -a $OLDPVERSION -lt 424 ];then #424=4.3beta3
  290.    if [ -d /usr/X11R7/bin ];then
  291.     ln -snf /usr/bin/restartwm /usr/X11R7/bin/restartwm
  292.     ln -snf /usr/bin/wmexit /usr/X11R7/bin/wmexit
  293.     ln -snf /usr/bin/wmpoweroff /usr/X11R7/bin/wmpoweroff
  294.     ln -snf /usr/bin/wmreboot /usr/X11R7/bin/wmreboot
  295.    fi
  296.   fi
  297.  
  298.   #w001 generate /etc/networkmodules...
  299.   echo -n " network-drivers-list" >/dev/console
  300.   /usr/sbin/updatenetmoduleslist.sh
  301.  
  302.   #w002 update icon cache (supposed to speed things up)...
  303.   echo -n " gtk-icon-cache" >/dev/console
  304.   /usr/bin/gtk-update-icon-cache -f /usr/share/icons/hicolor/
  305.  
  306.    #w002 generate desktop icons (previously done in unleashed)...
  307.    #(doing it here saves space in the iso file)
  308.    echo -n " desk-icons" >/dev/console
  309.    DEFAULT_DESK_ICONS="JQ8flat"
  310.    [ $NEWPVERSION -ge 500 ] && DEFAULT_DESK_ICONS="JQ8flat"
  311.    [ ! -d /usr/local/lib/X11/themes/JQ8flat ] && DEFAULT_DESK_ICONS="Stardust"
  312.    [ -f /etc/desktop_icon_theme ] && DEFAULT_DESK_ICONS="`cat /etc/desktop_icon_theme`" #w477
  313.    /usr/sbin/icon_switcher_cli $DEFAULT_DESK_ICONS
  314.  
  315.  fi
  316.  
  317.  
  318.  #stuff to update on every boot...
  319.  
  320.  #think have to do this everytime...
  321.  cp -af $NEWFILESMNTPT/etc/DISTRO_SPECS /etc/
  322.  touch /etc/DISTRO_SPECS #important, as snapmergepuppy uses '-u' cp option. ...huh, why?
  323.  
  324. #v2.16 if unionfs layers have changed, may need to fix menu (etc)...
  325. #note, BootManager may be popped-up, see /usr/sbin/delayedrun.
  326. if [ -d /initrd ];then #test it isn't full hd installation.
  327.  . /etc/rc.d/BOOTCONFIG
  328.  
  329.  #v2.16.1 bug with multisession-cd, different folder at each startup, so screen out...
  330.  xLASTUNIONRECORD="`echo -n "$LASTUNIONRECORD" | sed -e 's/^20[0-9][0-9][-0123456789]* //'`"
  331.  xPREVUNIONRECORD="`echo -n "$PREVUNIONRECORD" | sed -e 's/^20[0-9][0-9][-0123456789]* //'`"
  332.  
  333.  ##v2.17 2nd boot, new ${DISTRO_FILE_PREFIX}save, prevent update....
  334.  #[ " ${DISTRO_FILE_PREFIX}r${NEWPVERSION}.sfs" = "$PREVUNIONRECORD" ] && xPREVUNIONRECORD="$xLASTUNIONRECORD"
  335.  #...no, want to do fix if using an old ${DISTRO_FILE_PREFIX}save file.
  336.  
  337.  if [ "$xLASTUNIONRECORD" != "$xPREVUNIONRECORD" ];then
  338.   echo -en "  layered-filesystem \\033[1;35mnext boot will be faster\\033[0;39m..." > /dev/console
  339.   /etc/rc.d/rc.dots & # TazOC echo progress dots to console
  340.   echo "Unionfs layers have changed since previous boot, fixing menu..."
  341.   #master help index has to be updated...
  342.   /usr/sbin/indexgen.sh
  343.   #Reconstruct configuration files for JWM, Fvwm95, IceWM...
  344.   /usr/sbin/fixmenus
  345.   #w007 has a 'zdrv' layer been added or removed?...
  346.   EXMOD_CNT=0
  347.   zPATTERN='z'"${PREFIX1CHAR}"'[0-9]' #w020 ex: zu500629.sfs
  348.   zzPATTERN='^'"$zPATTERN"
  349.   EXMOD_SFS1="`echo "$xLASTUNIONRECORD" | tr ' ' '\n' | grep "$zzPATTERN"`"
  350.   EXMOD_SFS2="`echo "$xPREVUNIONRECORD" | tr ' ' '\n' | grep "$zzPATTERN"`"
  351.   [ "$EXMOD_SFS1" != "" ] && EXMOD_CNT=1
  352.   [ "$EXMOD_SFS2" != "" ] && EXMOD_CNT=`expr $EXMOD_CNT + 1`
  353.   if [ $EXMOD_CNT -eq 2 ];then
  354.    #may have changed to a different zdrv sfs...
  355.    [ "$EXMOD_SFS1" != "$EXMOD_SFS2" ] && EXMOD_CNT=1
  356.   fi
  357.   if [ $EXMOD_CNT -eq 1 ];then
  358.    depmod
  359.    /usr/sbin/updatenetmoduleslist.sh
  360.   fi
  361.  fi
  362.  
  363.  #fix the desktop...
  364.  #note, init does 'touch' on PuppyPin and globicons to prevent overwrite at version upgrade.
  365.  if [ $NEWPVERSION -gt $OLDPVERSION -o "$xLASTUNIONRECORD" != "$xPREVUNIONRECORD" ];then
  366.   #need some way to retain user-modifications, especially additions to desktop...
  367.   #one way is to just merge everything and then delete invalid entries...
  368.   #DennisF reported backdrop image reverted to default.jpg, so screen out default here...
  369.   #cat $NEWFILESMNTPT/root/Choices/ROX-Filer/PuppyPin | grep -v '<backdrop' >> /root/Choices/ROX-Filer/PuppyPin # TazOC disabled line
  370.   #cat $NEWFILESMNTPT/root/Choices/ROX-Filer/globicons >> /root/Choices/ROX-Filer/globicons # TazOC disabled line
  371.   #an inconstency, user-mod to desktop, PuppyPin gets changed in
  372.   #/root/Choices/ROX-Filer/, but globicons gets copied and updated in
  373.   #/root/.config/rox.sourceforge.net/ROX-Filer/...
  374.   if [ -f /root/.config/rox.sourceforge.net/ROX-Filer/globicons ];then
  375.    cp -f /root/.config/rox.sourceforge.net/ROX-Filer/globicons /root/Choices/ROX-Filer/globicons #TazOC keep custom LHP icons
  376.    #rm -f /root/.config/rox.sourceforge.net/ROX-Filer/globicons #TazOC disabled
  377.   fi
  378.   for LAYERNUM in 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 #TazOC
  379.   do
  380.    [ -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
  381.    [ -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
  382.   done
  383.   echo '<?xml version="1.0"?>' > /tmp/PuppyPinTmp
  384.   echo '<pinboard>' >> /tmp/PuppyPinTmp
  385.   grep -v -E 'pinboard>|<\?xml' /root/Choices/ROX-Filer/PuppyPin | sort -u >> /tmp/PuppyPinTmp
  386.   echo '</pinboard>' >> /tmp/PuppyPinTmp
  387.   #sort -u only gets rid of completely duplicate lines. delete duplicate execs...
  388.   #also delete line if exec is invalid. also avoid overlapping icons...
  389.   EXECSLOG="";XYLOG=""
  390.   echo -n "" > /root/Choices/ROX-Filer/PuppyPin
  391.   cat /tmp/PuppyPinTmp |
  392.   while read ONELINE
  393.   do
  394.    if [ "`echo -n "$ONELINE" | grep -v '<icon '`" != "" ];then
  395.     echo "$ONELINE" >> /root/Choices/ROX-Filer/PuppyPin
  396.     continue
  397.    fi
  398.    ONEEXEC="`echo -n "$ONELINE" | cut -f 2 -d '>' | cut -f 1 -d '<'`"
  399.    ONEX=`echo -n "$ONELINE" | cut -f 1 -d '>' | cut -f 2 -d '"'` #'geany
  400.    ONEY=`echo -n "$ONELINE" | cut -f 1 -d '>' | cut -f 4 -d '"'` #'geany
  401.    ONEXY0="${ONEX}_${ONEY}"
  402.    ONEXY="${ONEX}_${ONEY}"
  403.    while [ "`echo -n "$XYLOG" | grep "$ONEXY"`" != "" ];do
  404.     ONEX=`expr $ONEX + 32` #64
  405.     ONEY=`expr $ONEY + 48` #96
  406.     ONEXY="${ONEX}_${ONEY}"
  407.    done
  408.    if [ "`echo "$EXECSLOG" | grep "$ONEEXEC"`" = "" ];then
  409.     if [ -e $ONEEXEC ];then #could be a file, symlink or directory(rox-dir).
  410.      XYLOG="$XYLOG $ONEXY"
  411.      if [ "$ONEXY" = "$ONEXY0" ];then
  412.       echo "$ONELINE" >> /root/Choices/ROX-Filer/PuppyPin
  413.      else
  414.       #icon has to be moved...
  415.       XPATTERN="s/x=\"[0-9]*\"/x=\"${ONEX}\"/g"
  416.       YPATTERN="s/y=\"[0-9]*\"/y=\"${ONEY}\"/g"
  417.       echo "$ONELINE" | sed -e "$XPATTERN" | sed -e "$YPATTERN" >> /root/Choices/ROX-Filer/PuppyPin
  418.      fi
  419.     fi
  420.    fi
  421.    EXECSLOG="$EXECSLOG $ONEEXEC"
  422.   done
  423.   #now do globicons file...
  424.   echo '<?xml version="1.0"?>' > /tmp/globiconsTmp
  425.   echo '<special-files>' >> /tmp/globiconsTmp
  426.   grep -v -E 'special\-files>|<\?xml' /root/Choices/ROX-Filer/globicons >> /tmp/globiconsTmp
  427.   echo '</special-files>' >> /tmp/globiconsTmp
  428.   #get rid of duplicate entries...
  429.   RULESLOG="";FLAGIGNORE="";ONERULE=""
  430.   echo -n "" >  /root/Choices/ROX-Filer/globicons
  431.   #v431 add tests that executables and icons exist...
  432.   #v431 make sure tags start new lines...
  433.   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' |
  434.   while read ONELINE
  435.   do
  436.    if [ "`echo -n "$ONELINE" | grep 'rule match'`" != "" ];then
  437.     ONERULE="`echo -n "$ONELINE" | cut -f 2 -d '"'`" #'geany
  438.     read ONEICON
  439.     read ENDRULE
  440.     [ "`echo -n "$RULESLOG" | grep "$ONERULE"`" != "" ] && continue #avoid duplicates.
  441.     [ ! -e "$ONERULE" ] && continue #test executable exists.
  442.     REALICON="`echo -n "$ONEICON" | cut -f 2 -d '>' | cut -f 1 -d '<'`"
  443.     [ ! -e "$REALICON" ] && continue #test icon exists.
  444.     RULESLOG="$RULESLOG $ONERULE"
  445.     echo "$ONELINE
  446. $ONEICON
  447. $ENDRULE" >> /root/Choices/ROX-Filer/globicons
  448.    else
  449.     echo "$ONELINE" >> /root/Choices/ROX-Filer/globicons
  450.    fi
  451.   done
  452.  fi
  453. fi
  454. killall rc.dots &>/dev/null # TazOC stop progress dots
  455.  
  456. ###END###
  457.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement