diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2009-04-25 18:31:27 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2009-04-25 18:31:27 +0000 |
commit | 394ec8e94f426c5c3ebfd7dbbd98f7f1b4d2227d (patch) | |
tree | 190537b6b4e47fe8ea05895ff89c8d6d4ea219d0 | |
parent | 08b339a168785f4f8ba7acd6b5e10967934be2e6 (diff) |
Cleanup. Some ksh'ing, shrinkage, verbiage tweaks and consistency.
-rw-r--r-- | distrib/miniroot/upgrade.sh | 39 |
1 files changed, 13 insertions, 26 deletions
diff --git a/distrib/miniroot/upgrade.sh b/distrib/miniroot/upgrade.sh index 3d6543ff233..1f7e4a787b3 100644 --- a/distrib/miniroot/upgrade.sh +++ b/distrib/miniroot/upgrade.sh @@ -1,5 +1,5 @@ #!/bin/ksh -# $OpenBSD: upgrade.sh,v 1.67 2009/04/25 17:43:08 krw Exp $ +# $OpenBSD: upgrade.sh,v 1.68 2009/04/25 18:31:26 krw Exp $ # $NetBSD: upgrade.sh,v 1.2.4.5 1996/08/27 18:15:08 gwr Exp $ # # Copyright (c) 1997-2009 Todd Miller, Theo de Raadt, Ken Westerback @@ -45,41 +45,31 @@ MODE=upgrade # Have the user confirm that $ROOTDEV is the root filesystem. while :; do - ask "Root filesystem?" "$ROOTDEV" + ask "Root filesystem?" $ROOTDEV resp=${resp##*/} [[ -b /dev/$resp ]] && break - echo "Sorry, $resp is not a block device." + echo "$resp is not a block device." done ROOTDEV=$resp -echo -n "Checking root filesystem (fsck -fp /dev/${ROOTDEV}) ... " -if ! fsck -fp /dev/$ROOTDEV >/dev/null 2>&1; then - echo "FAILED.\nYou must fsck ${ROOTDEV} manually." - exit -fi +echo -n "Checking root filesystem (fsck -fp /dev/$ROOTDEV)..." +fsck -fp /dev/$ROOTDEV >/dev/null 2>&1 || { echo "FAILED." ; exit ; } echo "OK." -echo -n "Mounting root filesystem..." -if ! mount -o ro /dev/$ROOTDEV /mnt; then - echo "ERROR: can't mount root filesystem!" - exit -fi -echo "done." +echo -n "Mounting root filesystem (mount -o ro /dev/$ROOTDEV /mnt)..." +mount -o ro /dev/$ROOTDEV /mnt || { echo "FAILED." ; exit ; } +echo "OK." # The fstab, hosts and myname files are required. -for _file in fstab hosts myname; do - if [ ! -f /mnt/etc/$_file ]; then - echo "ERROR: no /mnt/etc/${_file}!" - exit - fi - cp /mnt/etc/$_file /tmp/$_file +for _f in fstab hosts myname; do + [[ -f /mnt/etc/$_f ]] || { echo "No /mnt/etc/$_f!" ; exit ; } + cp /mnt/etc/$_f /tmp/$_f done hostname $(stripcom /tmp/myname) THESETS="$THESETS site$VERSION-$(hostname -s).tgz" - -# Configure the network +# Configure the network. enable_network manual_net_cfg @@ -90,10 +80,7 @@ munge_fstab check_fs # Mount filesystems in /etc/fstab. -if ! umount /mnt; then - echo "ERROR: can't unmount previously mounted root!" - exit -fi +umount /mnt || { echo "Can't umount $ROOTDEV!" ; exit ; } mount_fs # Install sets. |