Browse Source

Let /altroot work with a duid-based fstab.

Reported by & fix tested by Dave Anderson. Thanks!
ok deraadt@
OPENBSD_5_1
krw 12 years ago
parent
commit
f46ceee925
1 changed files with 7 additions and 7 deletions
  1. +7
    -7
      src/etc/daily

+ 7
- 7
src/etc/daily View File

@ -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" \


Loading…
Cancel
Save