Check-in [6e511a4694]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

SHA1 Hash:6e511a46945b0faca5a013035f4909b211e67faa
Date: 2012-05-14 02:53:49
User: BarryK
Comment:maybe a bit over-the-top but have implemented test for save-file not mounted rw at first shutdown

Tags And Properties
Changes

Changes to woof-code/rootfs-skeleton/etc/rc.d/rc.shutdown

@@ -64,10 +64,12 @@
 #120130 rodin.s: update for gettext (line 91).
 #120218 changed TEXTDOMAIN=etcrcd___rc.shutdown to TEXTDOMAIN=rc.shutdown (unlikely to be any other file same name in $PATH).
 #120219 zekebaby: unmount network shares, alternate method. 120220 another alternate method.
 #120409 experimenting with minit, i discovered "rm -rf /tmp/*" is killing mingetty. initrd.gz wipes it, have added code to wipe for full hd install at bootup...
 #120427 01micko: support ext4 save-file.
+#120514 WARNING: i don't have this problem, as no longer deleting /tmp/* (120409), however Karl Godt reported that 'fuser -k -m' may kill rc.shutdown then if no /tmp/bootcnt.txt then X restarts, ref: http://bkhome.org/blog/?viewDetailed=02827
+#120514 Karl Godt: 1st shutdown: test save-file mounted rw, not ro.
 
 #110923
 . /usr/bin/gettext.sh # enables use of eval_gettext (several named variables) and ngettext (plurals)
 export TEXTDOMAIN=rc.shutdown
 export OUTPUT_CHARSET=UTF-8
@@ -413,60 +415,65 @@
    echo "$MYPASSWORD" | losetup-FULL -p 0 $CRYPTO $DEVLOOP ${SMNTPT}$SAVEFILE >/dev/console
    [ ! $? -eq 0 ] && exit 1
    mount -t $FILEFS -o noatime,rw $DEVLOOP /tmp/save1stpup
   fi
 
-  #floppy disk has little space. snapmergepuppy handles this for subsequent saves, but for now,
-  #be radical, only save /etc...
-  if [ "$SAVEPART" = "fd0" ];then
-   RDIRS="/initrd/pup_rw/etc"
+  #120514 Karl Godt: test save-file mounted rw, not ro...
+  if[ "`mount | grep ' /tmp/save1stpup ' | grep ' (rw'`" = "" ];then
+   echo "ERROR: $SAVEFILE did not mount properly. Aborting save."
+   umount /tmp/save1stpup 2>/dev/null
+   umount $SMNTPT 2>/dev/null
+   sleep 5
   else
-   #RDIRS="`find /initrd/pup_rw/ -maxdepth 1 -mount -type d | grep -v "/$" | grep -v "/mnt"| grep -v "/tmp"|grep -v "/proc"|grep -v "/sys"| grep -v "/var"| grep -v "/dev" | grep -v "/lost" | tr "\n" " "`"
-   #110503 remove /var exclusion...
-   RDIRS="`find /initrd/pup_rw/ -maxdepth 1 -mount -type d | grep -v -E '/$|/mnt|/tmp|/proc|/sys|/dev|/lost' | tr "\n" " "`"
-  fi
-  for ONEDIR in $RDIRS
-  do
-   BASENAME="`basename $ONEDIR`"
-
-   if [ ! -d /tmp/save1stpup/${BASENAME} ];then #110503
-    mkdir -p /tmp/save1stpup/${BASENAME}
-    #110503 got this from /usr/sbin/snapmergepuppy...
-    chmod "/tmp/save1stpup/${BASENAME}" --reference="$ONEDIR"
-    OWNER="`stat --format=%U "$ONEDIR"`"
-    chown $OWNER "/tmp/save1stpup/${BASENAME}"
-    GRP="`stat --format=%G "$ONEDIR"`"
-    chgrp $GRP "/tmp/save1stpup/${BASENAME}"
-    touch "/tmp/save1stpup/${BASENAME}" --reference="$ONEDIR"
+   #floppy disk has little space. snapmergepuppy handles this for subsequent saves, but for now,
+   #be radical, only save /etc...
+   if [ "$SAVEPART" = "fd0" ];then
+    RDIRS="/initrd/pup_rw/etc"
+   else
+    #RDIRS="`find /initrd/pup_rw/ -maxdepth 1 -mount -type d | grep -v "/$" | grep -v "/mnt"| grep -v "/tmp"|grep -v "/proc"|grep -v "/sys"| grep -v "/var"| grep -v "/dev" | grep -v "/lost" | tr "\n" " "`"
+    #110503 remove /var exclusion...
+    RDIRS="`find /initrd/pup_rw/ -maxdepth 1 -mount -type d | grep -v -E '/$|/mnt|/tmp|/proc|/sys|/dev|/lost' | tr "\n" " "`"
    fi
-
-   cp -a $ONEDIR/* /tmp/save1stpup/${BASENAME}/ #v2.16exp3
-   [ "$BASENAME" = "root" ] && cp -a $ONEDIR/.[0-9a-zA-Z]* /tmp/save1stpup/${BASENAME}/ #v2.16exp4
-  done
-  sync
-  umount /tmp/save1stpup
-
-  #w481 if low-ram, save-file is on a fast media, and no swap file/partition, then create one...
-  swapfile_func $SMNTPT $SAVEPART
-
-  umount $SMNTPT 2> /dev/null
-
-  #100917 booted from usbflash, saved to partition other than boot...
-  #101020 also allowing in case of frugal install in a sub-directory...
-  if [ "$expBOOTDRV" ];then #see choosepartfunc.
-   if [ "$SAVEPART" != "$PDEV1" ];then
-    SAVEMARK="`echo -n "$SAVEPART" | rev | sed -e 's%[a-z].*%%' | rev`" #ex: sdc2 becomes 2.
-    aPATTERN="/dev/$PDEV1 "
-    aMNTPT="`mount | grep "$aPATTERN" | cut -f 3 -d ' '`"
-    mkdir -p /mnt/$PDEV1
-    if [ "$aMNTPT" = "" ];then
-     mount -t $DEV1FS /dev/$PDEV1 /mnt/$PDEV1
-     aMNTPT="/mnt/$PDEV1"
-     fUMNT='yes'
+   for ONEDIR in $RDIRS
+   do
+    BASENAME="`basename $ONEDIR`"
+    if [ ! -d /tmp/save1stpup/${BASENAME} ];then #110503
+     mkdir -p /tmp/save1stpup/${BASENAME}
+     #110503 got this from /usr/sbin/snapmergepuppy...
+     chmod "/tmp/save1stpup/${BASENAME}" --reference="$ONEDIR"
+     OWNER="`stat --format=%U "$ONEDIR"`"
+     chown $OWNER "/tmp/save1stpup/${BASENAME}"
+     GRP="`stat --format=%G "$ONEDIR"`"
+     chgrp $GRP "/tmp/save1stpup/${BASENAME}"
+     touch "/tmp/save1stpup/${BASENAME}" --reference="$ONEDIR"
     fi
-    echo -n "$SAVEMARK" > ${aMNTPT}${xPSUBDIR}/SAVEMARK #file in boot partition. 'init' script reads this. 101020
-    [ "$fUMNT" = "yes" ] && umount /dev/$PDEV1
+    cp -a $ONEDIR/* /tmp/save1stpup/${BASENAME}/ #v2.16exp3
+    [ "$BASENAME" = "root" ] && cp -a $ONEDIR/.[0-9a-zA-Z]* /tmp/save1stpup/${BASENAME}/ #v2.16exp4
+   done
+   sync
+   umount /tmp/save1stpup
+   #w481 if low-ram, save-file is on a fast media, and no swap file/partition, then create one...
+   swapfile_func $SMNTPT $SAVEPART
+
+   umount $SMNTPT 2> /dev/null
+
+   #100917 booted from usbflash, saved to partition other than boot...
+   #101020 also allowing in case of frugal install in a sub-directory...
+   if [ "$expBOOTDRV" ];then #see choosepartfunc.
+    if [ "$SAVEPART" != "$PDEV1" ];then
+     SAVEMARK="`echo -n "$SAVEPART" | rev | sed -e 's%[a-z].*%%' | rev`" #ex: sdc2 becomes 2.
+     aPATTERN="/dev/$PDEV1 "
+     aMNTPT="`mount | grep "$aPATTERN" | cut -f 3 -d ' '`"
+     mkdir -p /mnt/$PDEV1
+     if [ "$aMNTPT" = "" ];then
+      mount -t $DEV1FS /dev/$PDEV1 /mnt/$PDEV1
+      aMNTPT="/mnt/$PDEV1"
+      fUMNT='yes'
+     fi
+     echo -n "$SAVEMARK" > ${aMNTPT}${xPSUBDIR}/SAVEMARK #file in boot partition. 'init' script reads this. 101020
+     [ "$fUMNT" = "yes" ] && umount /dev/$PDEV1
+    fi
    fi
   fi
  ;;
  69) #save to folder on multisession CD/DVD (including 1st shutdown). (5+64=69) NOT used
   multisavefunc