svn commit: r271497 - in user/nwhitehorn/bsdinstall_zfspartedit: . partedit scripts

Nathan Whitehorn nwhitehorn at FreeBSD.org
Sat Sep 13 05:54:33 UTC 2014


Author: nwhitehorn
Date: Sat Sep 13 05:54:31 2014
New Revision: 271497
URL: http://svnweb.freebsd.org/changeset/base/271497

Log:
  Bring up to date so I can finish this stuff up.

Modified:
  user/nwhitehorn/bsdinstall_zfspartedit/bsdinstall.8
  user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_powerpc.c
  user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_x86.c
  user/nwhitehorn/bsdinstall_zfspartedit/partedit/sade.8
  user/nwhitehorn/bsdinstall_zfspartedit/scripts/auto
  user/nwhitehorn/bsdinstall_zfspartedit/scripts/jail
  user/nwhitehorn/bsdinstall_zfspartedit/scripts/mirrorselect
Directory Properties:
  user/nwhitehorn/bsdinstall_zfspartedit/   (props changed)

Modified: user/nwhitehorn/bsdinstall_zfspartedit/bsdinstall.8
==============================================================================
--- user/nwhitehorn/bsdinstall_zfspartedit/bsdinstall.8	Sat Sep 13 05:08:35 2014	(r271496)
+++ user/nwhitehorn/bsdinstall_zfspartedit/bsdinstall.8	Sat Sep 13 05:54:31 2014	(r271497)
@@ -95,6 +95,8 @@ for more information on this target.
 .It Cm keymap
 If the current controlling TTY is a
 .Xr syscons 4
+or
+.Xr vt 4
 console, asks the user to set the current keymap, and saves the result to the
 new system's
 .Pa rc.conf .
@@ -367,5 +369,4 @@ This version of
 first appeared in
 .Fx 9.0 .
 .Sh AUTHORS
-.An -nosplit
-.An Nathan Whitehorn Aq nwhitehorn at FreeBSD.org
+.An Nathan Whitehorn Aq Mt nwhitehorn at FreeBSD.org

Modified: user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_powerpc.c
==============================================================================
--- user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_powerpc.c	Sat Sep 13 05:08:35 2014	(r271496)
+++ user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_powerpc.c	Sat Sep 13 05:54:31 2014	(r271497)
@@ -60,7 +60,8 @@ is_scheme_bootable(const char *part_type
 	if (strcmp(platform, "ps3") == 0 && strcmp(part_type, "GPT") == 0)
 		return (1);
 	if (strcmp(platform, "chrp") == 0 &&
-	    (strcmp(part_type, "MBR") == 0 || strcmp(part_type, "BSD") == 0))
+	    (strcmp(part_type, "MBR") == 0 || strcmp(part_type, "BSD") == 0 ||
+	     strcmp(part_type, "GPT") == 0))
 		return (1);
 
 	return (0);
@@ -68,13 +69,28 @@ is_scheme_bootable(const char *part_type
 
 size_t
 bootpart_size(const char *part_type) {
+	size_t platlen = sizeof(platform);
+	if (strlen(platform) == 0)
+		sysctlbyname("hw.platform", platform, &platlen, NULL, -1);
+
 	if (strcmp(part_type, "APM") == 0 || strcmp(part_type, "MBR") == 0)
 		return (800*1024);
+	if (strcmp(platform, "chrp") == 0 && strcmp(part_type, "GPT") == 0)
+		return (800*1024);
 	return (0);
 }
 
 const char *
 bootpart_type(const char *scheme) {
+	size_t platlen = sizeof(platform);
+	if (strlen(platform) == 0)
+		sysctlbyname("hw.platform", platform, &platlen, NULL, -1);
+
+	if (strcmp(platform, "chrp") == 0)
+		return ("prep-boot");
+	if (strcmp(platform, "powermac") == 0)
+		return ("apple-boot");
+
 	return ("freebsd-boot");
 }
 
@@ -85,9 +101,14 @@ bootcode_path(const char *part_type) {
 	
 const char *
 partcode_path(const char *part_type, const char *fs_type) {
+	size_t platlen = sizeof(platform);
+	if (strlen(platform) == 0)
+		sysctlbyname("hw.platform", platform, &platlen, NULL, -1);
+
 	if (strcmp(part_type, "APM") == 0)
 		return ("/boot/boot1.hfs");
-	if (strcmp(part_type, "MBR") == 0)
+	if (strcmp(part_type, "MBR") == 0 ||
+	    (strcmp(platform, "chrp") == 0 && strcmp(part_type, "GPT") == 0))
 		return ("/boot/boot1.elf");
 	return (NULL);
 }

Modified: user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_x86.c
==============================================================================
--- user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_x86.c	Sat Sep 13 05:08:35 2014	(r271496)
+++ user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_x86.c	Sat Sep 13 05:54:31 2014	(r271497)
@@ -69,7 +69,7 @@ bootpart_size(const char *scheme) {
 		return (0);
 
 	if (strcmp(platform, "BIOS") == 0)
-		return (64*1024);
+		return (512*1024);
 	else 
 		return (800*1024);
 

Modified: user/nwhitehorn/bsdinstall_zfspartedit/partedit/sade.8
==============================================================================
--- user/nwhitehorn/bsdinstall_zfspartedit/partedit/sade.8	Sat Sep 13 05:08:35 2014	(r271496)
+++ user/nwhitehorn/bsdinstall_zfspartedit/partedit/sade.8	Sat Sep 13 05:54:31 2014	(r271497)
@@ -64,12 +64,11 @@ installer. It was replaced in
 with the equivalent part of
 .Xr bsdinstall 8 .
 .Sh AUTHORS
-.An Nathan Whitehorn Aq nwhitehorn at FreeBSD.org
+.An Nathan Whitehorn Aq Mt nwhitehorn at FreeBSD.org
 .Sh BUGS
 The utility misses a lot of nice features, such as tools for
 manipulating
 .Xr gmirror 8
 or
-.Xr zfs 8
-.
+.Xr zfs 8 .
 These will be added later.

Modified: user/nwhitehorn/bsdinstall_zfspartedit/scripts/auto
==============================================================================
--- user/nwhitehorn/bsdinstall_zfspartedit/scripts/auto	Sat Sep 13 05:08:35 2014	(r271496)
+++ user/nwhitehorn/bsdinstall_zfspartedit/scripts/auto	Sat Sep 13 05:54:31 2014	(r271497)
@@ -35,11 +35,15 @@ BSDCFG_SHARE="/usr/share/bsdconfig"
 ############################################################ FUNCTIONS
 
 error() {
+	local msg
+	if [ -n "$1" ]; then
+		msg="$1\n\n"
+	fi
 	test -n "$DISTDIR_IS_UNIONFS" && umount -f $BSDINSTALL_DISTDIR
 	test -f $PATH_FSTAB && bsdinstall umount
 	dialog --backtitle "FreeBSD Installer" --title "Abort" \
 	    --no-label "Exit" --yes-label "Restart" --yesno \
-	    "An installation step has been aborted. Would you like to restart the installation or exit the installer?" 0 0
+	    "${msg}An installation step has been aborted. Would you like to restart the installation or exit the installer?" 0 0
 	if [ $? -ne 0 ]; then
 		exit 1
 	else
@@ -58,7 +62,7 @@ trap true SIGINT	# This section is optio
 bsdinstall keymap
 
 trap error SIGINT	# Catch cntrl-C here
-bsdinstall hostname || error
+bsdinstall hostname || error "Set hostname failed"
 
 export DISTRIBUTIONS="base.txz kernel.txz"
 if [ -f $BSDINSTALL_DISTDIR/MANIFEST ]; then
@@ -95,7 +99,7 @@ if [ -n "$FETCH_DISTRIBUTIONS" ]; then
 	BSDINSTALL_DISTSITE=$(`dirname $0`/mirrorselect 2>&1 1>&3)
 	MIRROR_BUTTON=$?
 	exec 3>&-
-	test $MIRROR_BUTTON -eq 0 || error
+	test $MIRROR_BUTTON -eq 0 || error "No mirror selected"
 	export BSDINSTALL_DISTSITE
 fi
 
@@ -125,8 +129,8 @@ exec 3>&-
 
 case "$PARTMODE" in
 "Guided")	# Guided
-	bsdinstall autopart || error
-	bsdinstall mount || error
+	bsdinstall autopart || error "Partitioning error"
+	bsdinstall mount || error "Failed to mount filesystem"
 	;;
 "Shell")	# Shell
 	clear
@@ -136,18 +140,18 @@ case "$PARTMODE" in
 "Manual")	# Manual
 	if f_isset debugFile; then
 		# Give partedit the path to our logfile so it can append
-		BSDINSTALL_LOG="${debugFile#+}" bsdinstall partedit || error
+		BSDINSTALL_LOG="${debugFile#+}" bsdinstall partedit || error "Partitioning error"
 	else
-		bsdinstall partedit || error
+		bsdinstall partedit || error "Partitioning error"
 	fi
-	bsdinstall mount || error
+	bsdinstall mount || error "Failed to mount filesystem"
 	;;
 "ZFS")	# ZFS
-	bsdinstall zfsboot || error
-	bsdinstall mount || error
+	bsdinstall zfsboot || error "ZFS setup failed"
+	bsdinstall mount || error "Failed to mount filesystem"
 	;;
 *)
-	error
+	error "Unknown partitioning mode"
 	;;
 esac
 
@@ -156,7 +160,7 @@ if [ ! -z "$FETCH_DISTRIBUTIONS" ]; then
 
 	# Download to a directory in the new system as scratch space
 	BSDINSTALL_FETCHDEST="$BSDINSTALL_CHROOT/usr/freebsd-dist"
-	mkdir -p "$BSDINSTALL_FETCHDEST" || error
+	mkdir -p "$BSDINSTALL_FETCHDEST" || error "Could not create directory $BSDINSTALL_FETCHDEST"
 
 	export DISTRIBUTIONS="$FETCH_DISTRIBUTIONS"
 	# Try to use any existing distfiles
@@ -169,13 +173,13 @@ if [ ! -z "$FETCH_DISTRIBUTIONS" ]; then
 	fi
 		
 	export FTP_PASSIVE_MODE=YES
-	bsdinstall distfetch || error
+	bsdinstall distfetch || error "Failed to fetch distribution"
 	export DISTRIBUTIONS="$ALL_DISTRIBUTIONS"
 fi
 
-bsdinstall checksum || error
-bsdinstall distextract || error
-bsdinstall rootpass || error
+bsdinstall checksum || error "Distribution checksum failed"
+bsdinstall distextract || error "Distribution extract failed"
+bsdinstall rootpass || error "Could not set root password"
 
 trap true SIGINT	# This section is optional
 if [ "$NETCONFIG_DONE" != yes ]; then
@@ -239,7 +243,7 @@ finalconfig() {
 finalconfig
 
 trap error SIGINT	# SIGINT is bad again
-bsdinstall config  || error
+bsdinstall config  || error "Failed to save config"
 
 if [ ! -z "$BSDINSTALL_FETCHDEST" ]; then
 	[ "$BSDINSTALL_FETCHDEST" != "$BSDINSTALL_DISTDIR" ] && \

Modified: user/nwhitehorn/bsdinstall_zfspartedit/scripts/jail
==============================================================================
--- user/nwhitehorn/bsdinstall_zfspartedit/scripts/jail	Sat Sep 13 05:08:35 2014	(r271496)
+++ user/nwhitehorn/bsdinstall_zfspartedit/scripts/jail	Sat Sep 13 05:54:31 2014	(r271497)
@@ -38,9 +38,13 @@ f_dprintf "Began Installation at %s" "$(
 export BSDINSTALL_CHROOT=$1
 
 error() {
+	local msg
+	if [ -n "$1" ]; then
+		msg="$1\n\n"
+	fi
 	dialog --backtitle "FreeBSD Installer" --title "Abort" \
 	    --no-label "Exit" --yes-label "Restart" --yesno \
-	    "An installation step has been aborted. Would you like to restart the installation or exit the installer?" 0 0
+	    "${msg}An installation step has been aborted. Would you like to restart the installation or exit the installer?" 0 0
 	if [ $? -ne 0 ]; then
 		exit
 	else
@@ -51,7 +55,7 @@ error() {
 
 rm -rf $BSDINSTALL_TMPETC
 mkdir $BSDINSTALL_TMPETC
-mkdir -p $1 || error
+mkdir -p $1 || error "mkdir failed for $1"
 
 test ! -d $BSDINSTALL_DISTDIR && mkdir -p $BSDINSTALL_DISTDIR
 
@@ -60,9 +64,9 @@ if [ ! -f $BSDINSTALL_DISTDIR/MANIFEST -
 	BSDINSTALL_DISTSITE=$(`dirname $0`/mirrorselect 2>&1 1>&3)
 	MIRROR_BUTTON=$?
 	exec 3>&-
-	test $MIRROR_BUTTON -eq 0 || error
+	test $MIRROR_BUTTON -eq 0 || error "No mirror selected"
 	export BSDINSTALL_DISTSITE
-	fetch -o $BSDINSTALL_DISTDIR/MANIFEST $BSDINSTALL_DISTSITE/MANIFEST || error
+	fetch -o $BSDINSTALL_DISTDIR/MANIFEST $BSDINSTALL_DISTSITE/MANIFEST || error "Could not download $BSDINSTALL_DISTSITE/MANIFEST"
 fi
 
 export DISTRIBUTIONS="base.txz"
@@ -94,17 +98,17 @@ if [ -n "$FETCH_DISTRIBUTIONS" -a -z "$B
 	BSDINSTALL_DISTSITE=`bsdinstall mirrorselect 2>&1 1>&3`
 	MIRROR_BUTTON=$?
 	exec 3>&-
-	test $MIRROR_BUTTON -eq 0 || error
+	test $MIRROR_BUTTON -eq 0 || error "No mirror selected"
 	export BSDINSTALL_DISTSITE
 fi
 
 if [ ! -z "$FETCH_DISTRIBUTIONS" ]; then
-	bsdinstall distfetch || error
+	bsdinstall distfetch || error "Failed to fetch distribution"
 fi
 
-bsdinstall checksum || error
-bsdinstall distextract || error
-bsdinstall rootpass || error
+bsdinstall checksum || error "Distribution checksum failed"
+bsdinstall distextract || error "Distribution extract failed"
+bsdinstall rootpass || error "Could not set root password"
 
 trap true SIGINT	# This section is optional
 bsdinstall services
@@ -114,7 +118,7 @@ dialog --backtitle "FreeBSD Installer" -
     bsdinstall adduser
 
 trap error SIGINT	# SIGINT is bad again
-bsdinstall config  || error
+bsdinstall config  || error "Failed to save config"
 cp /etc/resolv.conf $1/etc
 cp /etc/localtime $1/etc
 

Modified: user/nwhitehorn/bsdinstall_zfspartedit/scripts/mirrorselect
==============================================================================
--- user/nwhitehorn/bsdinstall_zfspartedit/scripts/mirrorselect	Sat Sep 13 05:08:35 2014	(r271496)
+++ user/nwhitehorn/bsdinstall_zfspartedit/scripts/mirrorselect	Sat Sep 13 05:54:31 2014	(r271497)
@@ -158,6 +158,7 @@ MIRROR_BUTTON=$?
 exec 3>&-
 
 _UNAME_R=`uname -r`
+_UNAME_R=${_UNAME_R%-p*}
 
 case ${_UNAME_R} in
 	*-CURRENT|*-STABLE|*-PRERELEASE)


More information about the svn-src-user mailing list