Hash :
cfb52c65
Author :
Thomas de Grivel
Date :
2023-01-24T14:55:38
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
#!/bin/sh
set -e
umount_by_path() {
for P; do
mount \
| grep " on $P" \
| sort -r \
| cut -d ' ' -f 1 \
| xargs -n 1 umount
done
}
if [ "x$1" = "xumount" ]; then
umount_by_path /mnt/ '/mnt '
exit
fi
mount | ! grep ' on /mnt '
if [ "x$1" = "xdisklabel" ]; then
shift
for DEV; do
printf 'a a\n\n2g\n\na b\n\n2g\n\na d\n\n10g\n\na e\n\n10g\n\na f\n\n10g\n\na g\n\n2g\n\na h\n\n20g\n\na j\n\n10g\n\na k\n\n10g\n\na l\n\n10g\n\na m\n\n20g\n\na n\n\n10g\n\na o\n\n10g\n\na p\n\n\n\nw\nq\n' | disklabel -dE $DEV
done
exit
elif [ "x$1" = "xnewfs" ]; then
shift
for DEV; do
for P in a d e f g h j k l m n o p; do
newfs $DEV$P
done
done
exit
fi
for DEV; do
mount /dev/${DEV}a /mnt/
rsync -aHx --delete-before /. /mnt/
mount /dev/${DEV}d /mnt/tmp
rsync -aHx --delete-before /tmp/. /mnt/tmp/
mount /dev/${DEV}e /mnt/var
rsync -aHx --delete-before --exclude postgresql /var/. /mnt/var/
mount /dev/${DEV}f /mnt/usr
rsync -aHx --delete-before /usr/. /mnt/usr/
mount /dev/${DEV}g /mnt/usr/X11R6
rsync -aHx --delete-before /usr/X11R6/. /mnt/usr/X11R6/
mount /dev/${DEV}h /mnt/usr/local
rsync -aHx --delete-before /usr/local/. /mnt/usr/local/
mount /dev/${DEV}j /mnt/usr/src
rsync -aHx --delete-before /usr/src/. /mnt/usr/src/
mount /dev/${DEV}k /mnt/usr/obj
rsync -aHx --delete-before /usr/obj/. /mnt/usr/obj/
mount /dev/${DEV}l /mnt/usr/ports
rsync -aHx --delete-before /usr/ports/. /mnt/usr/ports/
mount /dev/${DEV}m /mnt/usr/ports/pobj
rsync -aHx --delete-before /usr/ports/pobj/. /mnt/usr/ports/pobj/
mount /dev/${DEV}n /mnt/usr/xenocara
rsync -aHx --delete-before /usr/xenocara/. /mnt/usr/xenocara/
mount /dev/${DEV}o /mnt/usr/xobj
rsync -aHx --delete-before /usr/xobj/. /mnt/usr/xobj/
mount /dev/${DEV}p /mnt/home
rsync -aHx --delete-before /home/. /mnt/home/
umount_by_path /mnt/
done