From owner-freebsd-bugs@FreeBSD.ORG Fri Feb 11 15:10:10 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 640411065693 for ; Fri, 11 Feb 2011 15:10:10 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 406038FC24 for ; Fri, 11 Feb 2011 15:10:10 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p1BFAACk073795 for ; Fri, 11 Feb 2011 15:10:10 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p1BFAAF3073794; Fri, 11 Feb 2011 15:10:10 GMT (envelope-from gnats) Resent-Date: Fri, 11 Feb 2011 15:10:10 GMT Resent-Message-Id: <201102111510.p1BFAAF3073794@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Kris Moore Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 253F8106564A for ; Fri, 11 Feb 2011 15:08:40 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 1350B8FC0A for ; Fri, 11 Feb 2011 15:08:40 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p1BF8dIi037683 for ; Fri, 11 Feb 2011 15:08:39 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id p1BF8dUL037682; Fri, 11 Feb 2011 15:08:39 GMT (envelope-from nobody) Message-Id: <201102111508.p1BF8dUL037682@red.freebsd.org> Date: Fri, 11 Feb 2011 15:08:39 GMT From: Kris Moore To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: bin/154685: bin: usr.sbin/pc-sysinstall - Add Extract-Only option for pc-sysinstall X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Feb 2011 15:10:10 -0000 >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: