Hi all,
This diff enables daily(8) to use DUID instead of pathname in
/etc/fstab for backing up root filesystem.
I'm not a shell expert... comments are welcome.
Index: daily
===================================================================
RCS file: /cvs/src/etc/daily,v
retrieving revision 1.68
diff -u -r1.68 daily
--- daily 22 Sep 2010 13:01:10 -0000 1.68
+++ daily 18 Mar 2011 15:15:57 -0000
@@ -97,11 +97,22 @@
rootbak=`awk '$2 == "/altroot" && $1 ~ /^\/dev\// && $3 == "ffs" && \
$4 ~ /xx/ \
{ print substr($1, 6) }' < /etc/fstab`
- if [ -z "$rootbak" ]; then
- echo "No xx ffs /altroot device found in the fstab(5)."
- break
+ if [ ! -z $rootbak ]; then
+ bakdisk=${rootbak%[a-p]}
+ else
+ duid=`awk '$2 == "/altroot" && $1 ~ /^.*\..*/ && \
+ $3 == "ffs" && $4 ~ /xx/ \
+ { print substr($1, 1, 18) }' < /etc/fstab`
+ if [ -z "$duid" ]; then
+ echo "No xx ffs /altroot device found in the fstab(5)."
+ break
+ fi
+ duiddisk=`echo $duid | awk '{ print substr($1, 1, 16) }'`
+ bakdisk=`sysctl -n hw.disknames | \
+ sed -e 's/.*[,=]\(.*\):'$duiddisk'.*/\1/'`
+ rootbak=`echo $duid | \
+ awk '{ print "'$bakdisk'"substr($1, 18, 1) }'`
fi
- bakdisk=${rootbak%[a-p]}
sysctl -n hw.disknames | grep -Fqw $bakdisk || break
bakpart=${rootbak#$bakdisk}
baksize=`disklabel $bakdisk 2>/dev/null | \
--
Mattieu Baptiste
"/earth is 102% full ... please delete anyone you can."