Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Jan 2011 18:23:36 +0000 (UTC)
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r217060 - user/nwhitehorn/bsdinstall/scripts
Message-ID:  <201101061823.p06INaR9024371@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: nwhitehorn
Date: Thu Jan  6 18:23:36 2011
New Revision: 217060
URL: http://svn.freebsd.org/changeset/base/217060

Log:
  Make error handling a little cleaner.

Modified:
  user/nwhitehorn/bsdinstall/scripts/auto

Modified: user/nwhitehorn/bsdinstall/scripts/auto
==============================================================================
--- user/nwhitehorn/bsdinstall/scripts/auto	Thu Jan  6 18:00:34 2011	(r217059)
+++ user/nwhitehorn/bsdinstall/scripts/auto	Thu Jan  6 18:23:36 2011	(r217060)
@@ -4,22 +4,19 @@ echo "Begun Installation at $(date)" > $
 
 cdialog --backtitle "FreeBSD Installer" --title "Welcome" --msgbox "Welcome to the FreeBSD Installer." 0 0
 
-checkerror() {
+error() {
+	cdialog --backtitle "FreeBSD Installer" --title "Abort" \
+	    --no-label "Exit" --yes-label "Restart" --yesno \
+	    "You have canceled an installation step. Would you like to restart the installation or exit the installer?" 0 0
 	if [ $? -ne 0 ]; then
-		cdialog --backtitle "FreeBSD Installer" --title "Abort" \
-		    --no-label "Exit" --yes-label "Restart" --yesno \
-		    "You have canceled an installation step. Would you like to restart the installation or exit the installer?" 0 0
-		if [ $? -ne 0 ]; then
-			exit
-		else
-			exec $0 $@
-		fi
+		exit
+	else
+		exec $0
 	fi
 }
 
 rm /tmp/rc.conf
-bsdinstall hostname
-checkerror
+bsdinstall hostname || error
 
 FETCH_DISTRIBUTIONS=""
 for dist in $DISTRIBUTIONS; do
@@ -30,31 +27,24 @@ done
 
 if [ ! -z "$FETCH_DISTRIBUTIONS" ]; then
 	cdialog --backtitle "FreeBSD Installer" --title "Network Installation" --msgbox "No installation files were found on the boot volume. The next few screens will allow you to configure networking so that they can be downloaded from the Internet." 0 0
-	bsdinstall netconfig
-	checkerror
+	bsdinstall netconfig || error
 fi
 
 rm $PATH_FSTAB
-bsdinstall partedit
-checkerror
-bsdinstall mount 
+bsdinstall partedit || error
+bsdinstall mount || error
 
 if [ ! -z $FETCH_DISTRIBUTIONS ]; then
 	ALL_DISTRIBUTIONS=$DISTRIBUTIONS
 	DISTRIBUTIONS=$FETCH_DISTRIBUTIONS
-	bsdinstall distfetch
-	checkerror
+	bsdinstall distfetch || error
 	DISTRIBUTIONS=$ALL_DISTRIBUTIONS
 fi
 
-bsdinstall distextract
-checkerror
-bsdinstall rootpass
-checkerror
-bsdinstall adduser
-checkerror
-bsdinstall config 
-checkerror
+bsdinstall distextract || error
+bsdinstall rootpass || error
+bsdinstall adduser || error
+bsdinstall config  || error
 
 cdialog --backtitle "FreeBSD Installer" --title "Complete" --msgbox "Installation of FreeBSD complete!" 0 0
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101061823.p06INaR9024371>