svn commit: r217438 - in user/nwhitehorn/bsdinstall: partedit scripts

Nathan Whitehorn nwhitehorn at FreeBSD.org
Sat Jan 15 03:06:04 UTC 2011


Author: nwhitehorn
Date: Sat Jan 15 03:06:03 2011
New Revision: 217438
URL: http://svn.freebsd.org/changeset/base/217438

Log:
  Add the ability to escape to a shell and set up partitions entirely by hand.
  Also add rudimentary ability to use partedit as a replacement for sade.

Modified:
  user/nwhitehorn/bsdinstall/partedit/Makefile
  user/nwhitehorn/bsdinstall/partedit/partedit.c
  user/nwhitehorn/bsdinstall/scripts/auto

Modified: user/nwhitehorn/bsdinstall/partedit/Makefile
==============================================================================
--- user/nwhitehorn/bsdinstall/partedit/Makefile	Sat Jan 15 01:03:26 2011	(r217437)
+++ user/nwhitehorn/bsdinstall/partedit/Makefile	Sat Jan 15 03:06:03 2011	(r217438)
@@ -2,6 +2,7 @@
 
 BINDIR= /usr/libexec/bsdinstall
 PROG=	partedit
+LINKS= ${BINDIR}/partedit ${BINDIR}/autopart
 LDADD=	-lgeom -lncursesw -lutil -ldialog -lm
 
 PARTEDIT_ARCH= ${MACHINE}

Modified: user/nwhitehorn/bsdinstall/partedit/partedit.c
==============================================================================
--- user/nwhitehorn/bsdinstall/partedit/partedit.c	Sat Jan 15 01:03:26 2011	(r217437)
+++ user/nwhitehorn/bsdinstall/partedit/partedit.c	Sat Jan 15 03:06:03 2011	(r217438)
@@ -1,4 +1,5 @@
 #include <sys/param.h>
+#include <libgen.h>
 #include <libutil.h>
 #include <inttypes.h>
 #include <errno.h>
@@ -22,7 +23,7 @@ static void get_mount_points(struct part
 static int validate_setup(void);
 
 int
-main(void) {
+main(int argc, const char **argv) {
 	struct partition_metadata *md;
 	struct partedit_item *items;
 	struct gmesh mesh;
@@ -34,20 +35,12 @@ main(void) {
 	init_fstab_metadata();
 
 	init_dialog(stdin, stdout);
-	dialog_vars.backtitle = __DECONST(char *, "FreeBSD Installer");
+	if (strcmp(basename(argv[0]), "sade") != 0)
+		dialog_vars.backtitle = __DECONST(char *, "FreeBSD Installer");
 	dialog_vars.item_help = TRUE;
 	nscroll = i = 0;
 
-	/* Ask about guided vs. manual partitioning */
-	dlg_put_backtitle();
-	dialog_vars.yes_label = "Guided";
-	dialog_vars.no_label = "Manual";
-	op = dialog_yesno("Partitioning", "Would you like to use the guided "
-	    "partitioning tool (recommended for beginners) or to set up "
-	    "partitions manually (experts)?", 0, 0);
-	dialog_vars.yes_label = NULL;
-	dialog_vars.no_label = NULL;
-	if (op == 0) /* Guided */
+	if (strcmp(basename(argv[0]), "autopart") == 0) /* Guided */
 		part_wizard();
 
 	/* Show the part editor either immediately, or to confirm wizard */

Modified: user/nwhitehorn/bsdinstall/scripts/auto
==============================================================================
--- user/nwhitehorn/bsdinstall/scripts/auto	Sat Jan 15 01:03:26 2011	(r217437)
+++ user/nwhitehorn/bsdinstall/scripts/auto	Sat Jan 15 03:06:03 2011	(r217438)
@@ -38,8 +38,29 @@ if [ ! -z "$FETCH_DISTRIBUTIONS" ]; then
 fi
 
 rm $PATH_FSTAB
-bsdinstall partedit || error
-bsdinstall mount || error
+
+dialog --backtitle "FreeBSD Installer" --title "Partitioning" --extra-button \
+    --extra-label "Manual" --ok-label "Guided" --cancel-label "Shell" \
+    --yesno "Would you like to use the guided partitioning tool (recommended for beginners) or to set up partitions manually (experts)? You can also open a shell and set up partitions entirely by hand." 0 0
+
+case $? in
+0)	# Guided
+	bsdinstall autopart || error
+	bsdinstall mount || error
+	;;
+1)	# Shell
+	clear
+	echo "Use this shell to set up partitions for the new system. When finished, mount the system at $BSDINSTALL_CHROOT and place an fstab file for the new system at $PATH_FSTAB. Then type 'exit'. You can also enter the partition editor at any time by entering 'bsdinstall partedit'."
+	sh
+	;;
+3)	# Manual
+	bsdinstall partedit || error
+	bsdinstall mount || error
+	;;
+*)
+	error
+	;;
+esac
 
 if [ ! -z $FETCH_DISTRIBUTIONS ]; then
 	ALL_DISTRIBUTIONS=$DISTRIBUTIONS


More information about the svn-src-user mailing list