summaryrefslogtreecommitdiff
path: root/etc/daily
diff options
context:
space:
mode:
Diffstat (limited to 'etc/daily')
-rw-r--r--etc/daily14
1 files changed, 7 insertions, 7 deletions
diff --git a/etc/daily b/etc/daily
index 4d4b60b3258..f3bd0bc410e 100644
--- a/etc/daily
+++ b/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" \