bin/154685: bin: usr.sbin/pc-sysinstall - Add Extract-Only option
for pc-sysinstall
Kris Moore
kmoore at FreeBSD.org
Fri Feb 11 15:10:10 UTC 2011
>Number: 154685
>Category: bin
>Synopsis: bin: usr.sbin/pc-sysinstall - Add Extract-Only option for pc-sysinstall
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: update
>Submitter-Id: current-users
>Arrival-Date: Fri Feb 11 15:10:09 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator: Kris Moore
>Release: 9.0-Current
>Organization:
PC-BSD / iXsystems
>Environment:
FreeBSD 9.0-CURRENT
>Description:
The attached patch adds a new "Extract Only" option to pc-sysinstall, for users who want to do complex disk-setups manually, and then point pc-sysinstall to a mount-point for installation.
>How-To-Repeat:
>Fix:
Patch attached with submission follows:
diff -ruN usr.sbin/pc-sysinstall/backend/functions.sh usr.sbin/pc-sysinstall/backend/functions.sh
--- usr.sbin/pc-sysinstall/backend/functions.sh 2011-01-27 10:26:03.733382991 -0500
+++ usr.sbin/pc-sysinstall/backend/functions.sh 2011-01-27 12:39:07.471755753 -0500
@@ -409,6 +409,7 @@
fi
};
+# Setup and install on a new disk / partition
install_fresh()
{
# Lets start setting up the disk slices now
@@ -458,6 +459,39 @@
echo_log "Installation finished!"
};
+# Extract the system to a pre-mounted directory
+install_extractonly()
+{
+ # We are ready to begin extraction, lets start now
+ init_extraction
+
+ # Check if we have any optional modules to load
+ install_components
+
+ # Check if we have any packages to install
+ install_packages
+
+ # Do any localization in configuration
+ run_localize
+
+ # Save any networking config on the installed system
+ save_networking_install
+
+ # Now add any users
+ setup_users
+
+ # Now run any commands specified
+ run_commands
+
+ # Set a hostname on the install system
+ setup_hostname
+
+ # Set the root_pw if it is specified
+ set_root_pw
+
+ echo_log "Installation finished!"
+};
+
install_image()
{
# We are ready to begin extraction, lets start now
@@ -478,7 +512,7 @@
# Do any localization in configuration
run_localize
- # ow run any commands specified
+ # Now run any commands specified
run_commands
# Merge any old configuration files
diff -ruN usr.sbin/pc-sysinstall/backend/parseconfig.sh usr.sbin/pc-sysinstall/backend/parseconfig.sh
--- usr.sbin/pc-sysinstall/backend/parseconfig.sh 2011-01-27 10:26:03.733382991 -0500
+++ usr.sbin/pc-sysinstall/backend/parseconfig.sh 2011-01-27 12:45:59.303378946 -0500
@@ -67,11 +67,10 @@
export CFGF
# Start by doing a sanity check, which will catch any obvious mistakes in the config
-file_sanity_check "installMode disk0 installType installMedium packageType"
+file_sanity_check "installMode installType installMedium packageType"
# We passed the Sanity check, lets grab some of the universal config settings and store them
-check_value installMode "fresh upgrade"
-check_value bootManager "bsd none"
+check_value installMode "fresh upgrade extract"
check_value installType "PCBSD FreeBSD"
check_value installMedium "dvd usb ftp rsync image"
check_value packageType "uzip tar rsync split"
@@ -108,6 +107,16 @@
fi
;;
+ extract)
+ # Extracting only, make sure we have a valid target directory
+ get_value_from_cfg installLocation
+ FSMNT="${VAL}" ; export FSMNT
+ if [ -z "$FSMNT" ] ; then exit_err "Missing installLocation=" ; fi
+ if [ ! -d "$FSMNT" ] ; then exit_err "No such directory: $FSMNT" ; fi
+
+ install_extractonly
+ ;;
+
upgrade)
install_upgrade
;;
diff -ruN usr.sbin/pc-sysinstall/conf/pc-sysinstall.conf usr.sbin/pc-sysinstall/conf/pc-sysinstall.conf
--- usr.sbin/pc-sysinstall/conf/pc-sysinstall.conf 2011-01-27 10:26:03.670379474 -0500
+++ usr.sbin/pc-sysinstall/conf/pc-sysinstall.conf 2011-01-27 12:28:39.739272231 -0500
@@ -36,8 +36,8 @@
export RSYNCTRIES
# Set our mount-points
-CDMNT="/cdmnt-install"
-FSMNT="/mnt"
+CDMNT=${CDMNT-/cdmnt-install}
+FSMNT=${FSMNT-/mnt}
UZIP_DIR="/usr"
BOOT_PART_MOUNT="/boot-mount"
export FSMNT CDMNT UZIP_DIR BOOT_PART_MOUNT
diff -ruN usr.sbin/pc-sysinstall/examples/README usr.sbin/pc-sysinstall/examples/README
--- usr.sbin/pc-sysinstall/examples/README 2011-01-27 10:26:03.649376160 -0500
+++ usr.sbin/pc-sysinstall/examples/README 2011-01-27 13:02:59.950214147 -0500
@@ -12,9 +12,9 @@
When hostname= is not present, pc-sysinstall will auto-generate
a hostname such as freebsd-XXXX or pcbsd-XXXX
-# installMode=(fresh or upgrade)
+# installMode=(fresh/upgrade/extract)
-Set the type of install we are doing, fresh or upgrade.
+Set the type of install we are doing.
Fresh installs will format and mount the target disks before
extracting the install images to the system. Using this mode
@@ -27,6 +27,19 @@
additional files to exclude from overwriting during the
install process.
+Extract will skip any disk setup, and perform an installation
+to the directory specified by "installLocation=". This location
+should be a directory with your pre-mounted file-systems ready
+for file extraction. When using the "extract" option, /etc/fstab
+on the installed system will *not* be automatically configured.
+
+# installLocation=
+
+Used only when installMode is set to extract.
+
+This is set to the location you want to extract your system to,
+and should already be mounted properly.
+
# installInteractive=(yes or no)
Set if the installer is running in interactive mode, and
@@ -320,7 +333,7 @@
# runScript=
runScript will copy the specified script into FSMNT, and run it in chroot of the system
-Usefull when you have a 3rd party script on the DVD / USB, and you want to copy it into
+Useful when you have a 3rd party script on the DVD / USB, and you want to copy it into
the installed system and run
# runExtCommand=
@@ -330,7 +343,7 @@
########################################################################
-# PC-BSD SPECIFC OPTIONS
+# PC-BSD SPECIFIC OPTIONS
########################################################################
Options for time-zones and NTP on the installed system
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list