View | Details | Raw Unified | Return to bug 160530
Collapse All | Expand All

(-)tools/tools/nanobsd/Files/root/updatep1 (-7 / +10 lines)
Lines 32-54 Link Here
32
#	ssh somewhere cat image.s1 | sh updatep1
32
#	ssh somewhere cat image.s1 | sh updatep1
33
#
33
#
34
34
35
PARTNUM=1
36
OTHER_PARTNUM=2
37
35
set -e
38
set -e
36
39
37
. /etc/nanobsd.conf
40
. /etc/nanobsd.conf
38
41
39
if mount | grep ${NANO_DRIVE}s1 > /dev/null ; then
42
if mount | grep ${NANO_DRIVE}s$PARTNUM > /dev/null ; then
40
	echo "You are running partition 1 already"
43
	echo "You are running partition $PARTNUM already"
41
	echo "you probably want to use 'updatep2' instead"
44
	echo "you probably want to use 'updatep$OTHER_PARTNUM' instead"
42
	exit 1
45
	exit 1
43
fi
46
fi
44
47
45
# Blow away old system.
48
# Blow away old system.
46
dd if=/dev/zero of=/dev/${NANO_DRIVE}s1 bs=1m count=1 > /dev/null 2>&1
49
dd if=/dev/zero of=/dev/${NANO_DRIVE}s$PARTNUM bs=1m count=1 > /dev/null 2>&1
47
50
48
# Copy in new system
51
# Copy in new system
49
dd of=/dev/${NANO_DRIVE}s1 obs=64k
52
dd of=/dev/${NANO_DRIVE}s$PARTNUM obs=64k
50
53
51
# Check that it worked
54
# Check that it worked
52
fsck_ffs -n /dev/${NANO_DRIVE}s1a
55
fsck_ffs -n /dev/${NANO_DRIVE}s${PARTNUM}a
53
56
54
gpart set -a active -i 1 ${NANO_DRIVE}
57
gpart set -a active -i $PARTNUM ${NANO_DRIVE}
(-)tools/tools/nanobsd/Files/root/updatep2 (-10 / +13 lines)
Lines 32-61 Link Here
32
#	ssh somewhere cat image.s1 | sh updatep2
32
#	ssh somewhere cat image.s1 | sh updatep2
33
#
33
#
34
34
35
PARTNUM=2
36
OTHER_PARTNUM=1
37
35
set -e
38
set -e
36
39
37
. /etc/nanobsd.conf
40
. /etc/nanobsd.conf
38
41
39
if mount | grep ${NANO_DRIVE}s2 > /dev/null ; then
42
if mount | grep ${NANO_DRIVE}s$PARTNUM > /dev/null ; then
40
	echo "You are running partition 2 already"
43
	echo "You are running partition $PARTNUM already"
41
	echo "you probably want to use 'updatep1' instead"
44
	echo "you probably want to use 'updatep$OTHER_PARTNUM' instead"
42
	exit 1
45
	exit 1
43
fi
46
fi
44
47
45
# Blow away old system.
48
# Blow away old system.
46
dd if=/dev/zero of=/dev/${NANO_DRIVE}s2 bs=1m count=1 > /dev/null 2>&1
49
dd if=/dev/zero of=/dev/${NANO_DRIVE}s$PARTNUM bs=1m count=1 > /dev/null 2>&1
47
50
48
# Copy in new system
51
# Copy in new system
49
dd of=/dev/${NANO_DRIVE}s2 obs=64k
52
dd of=/dev/${NANO_DRIVE}s$PARTNUM obs=64k
50
53
51
# Check that it worked
54
# Check that it worked
52
fsck_ffs -n /dev/${NANO_DRIVE}s2a
55
fsck_ffs -n /dev/${NANO_DRIVE}s${PARTNUM}a
53
56
54
# Update the /etc/fstab
57
# Update the /etc/fstab
55
trap "umount /mnt" 1 2 15 EXIT
58
trap "umount /mnt" 1 2 15 EXIT
56
mount /dev/${NANO_DRIVE}s2a /mnt
59
mount /dev/${NANO_DRIVE}s${PARTNUM}a /mnt
57
sed -i "" "s/${NANO_DRIVE}s1/${NANO_DRIVE}s2/" /mnt/conf/base/etc/fstab
60
sed -i "" "s/${NANO_DRIVE}s$OTHER_PARTNUM/${NANO_DRIVE}s$PARTNUM/" /mnt/conf/base/etc/fstab
58
sed -i "" "s/${NANO_DRIVE}s1/${NANO_DRIVE}s2/" /mnt/etc/fstab
61
sed -i "" "s/${NANO_DRIVE}s$OTHER_PARTNUM/${NANO_DRIVE}s$PARTNUM/" /mnt/etc/fstab
59
umount /mnt
62
umount /mnt
60
trap 1 2 15 EXIT
63
trap 1 2 15 EXIT
61
gpart set -a active -i 2 ${NANO_DRIVE}
64
gpart set -a active -i $PARTNUM ${NANO_DRIVE}

Return to bug 160530