From f46ceee925ea5bbafafc5750e754ae87e088887a Mon Sep 17 00:00:00 2001 From: krw <> Date: Wed, 8 Feb 2012 18:22:43 +0000 Subject: [PATCH] Let /altroot work with a duid-based fstab. Reported by & fix tested by Dave Anderson. Thanks! ok deraadt@ --- src/etc/daily | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/etc/daily b/src/etc/daily index 4d4b60b3..f3bd0bc4 100644 --- a/src/etc/daily +++ b/src/etc/daily @@ -1,5 +1,5 @@ # -# $OpenBSD: daily,v 1.72 2011/12/06 21:02:39 halex Exp $ +# $OpenBSD: daily,v 1.73 2012/02/08 18:22:43 krw Exp $ # From: @(#)daily 8.2 (Berkeley) 1/25/94 # # For local additions, create the file /etc/daily.local. @@ -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" \