On Tue, Feb 07, 2012 at 09:42:07AM -0500, Dave Anderson wrote:
> I've got a system running amd64/mp -current (latest source update on
> February 1st) and have noticed (for quite a while, actually) that the
> nightly backup of / to /altroot wasn't working.  I finally got around to
> looking into this and discovered that the /etc/daily script was
> explicitly checking for /dev/whatever in the /altroot fstab entry -- but
> I've been using DUIDs (as set up by the installer).
> 
> Shouldn't the daily script be updated to handle DUIDs as well as
> explicit devices in /etc/fstab?
> 
>       Dave
> 
> -- 
> Dave Anderson
> <d...@daveanderson.com>
> 

Does this diff work for you? Test with duid and without would be
nice. :-)

And don't be bashful. Anybody can test!

.... Ken

Index: daily
===================================================================
RCS file: /cvs/src/etc/daily,v
retrieving revision 1.72
diff -u -p -r1.72 daily
--- daily       6 Dec 2011 21:02:39 -0000       1.72
+++ daily       7 Feb 2012 20:14:26 -0000
@@ -90,20 +90,20 @@ if [ -f /var/account/acct ]; then
 fi
 
 # If ROOTBACKUP is set to 1 in the environment, and
-# if filesystem named /altroot is type ffs, on /dev/* and mounted "xx",
+# if filesystem named /altroot is type ffs and mounted "xx",
 # use it as a backup root filesystem to be updated daily.
 next_part "Backing up root filesystem:"
 while [ "X$ROOTBACKUP" = X1 ]; do
-       rootbak=`awk '$2 == "/altroot" && $1 ~ /^\/dev\// && $3 == "ffs" && \
-           $4 ~ /xx/ \
-               { print substr($1, 6) }' < /etc/fstab`
+       rootbak=`awk '$2 == "/altroot" && $3 == "ffs" && $4 ~ /xx/ \
+               { print $1 }' < /etc/fstab`
        if [ -z "$rootbak" ]; then
                echo "No xx ffs /altroot device found in the fstab(5)."
                break
        fi
-       bakdisk=${rootbak%[a-p]}
+       rootbak=${rootbak#/dev/}
+       bakdisk=${rootbak%%?(.)[a-p]}
        sysctl -n hw.disknames | grep -Fqw $bakdisk || break
-       bakpart=${rootbak#$bakdisk}
+       bakpart=${rootbak##$bakdisk?(.)}
        baksize=`disklabel $bakdisk 2>/dev/null | \
                awk -v "part=$bakpart:" '$1 == part { print $2 }'`
        rootdev=`mount | awk '$3 == "/" && $1 ~ /^\/dev\// && $5 == "ffs" \

Reply via email to