diff options
author | Renato Botelho <renato@netgate.com> | 2017-09-28 09:35:39 -0300 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2017-09-28 09:36:04 -0300 |
commit | 2c57d58cf229fa8683c8f6c329831224ee366429 (patch) | |
tree | f97be13e976ff3be18904c6500da56ac1ac79237 /usr.sbin/bsdinstall | |
parent | 69c23db2a299f86f1824787b57d89235f74c04e8 (diff) | |
download | FreeBSD-src-2c57d58cf229fa8683c8f6c329831224ee366429.zip FreeBSD-src-2c57d58cf229fa8683c8f6c329831224ee366429.tar.gz |
Try to guess target disk when there is only one
Diffstat (limited to 'usr.sbin/bsdinstall')
-rwxr-xr-x | usr.sbin/bsdinstall/scripts/auto | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/usr.sbin/bsdinstall/scripts/auto b/usr.sbin/bsdinstall/scripts/auto index d5cbd3f..57fe739 100755 --- a/usr.sbin/bsdinstall/scripts/auto +++ b/usr.sbin/bsdinstall/scripts/auto @@ -102,6 +102,33 @@ dialog_workaround() ############################################################ MAIN +# Try to be smart and detect target disk when there is only one +skip_disks="" +for label in FreeBSD pfSense; do + disk=$(glabel status | grep ${label}_Install | awk '{print $3}' \ + | sed 's/p[0-9]*//') + [ -z "$disk" ] \ + && continue + skip_disks="${skip_disks}${skip_disks:+ }${disk}" +done +target_disk="" +for disk in $(sysctl -n kern.disks); do + skip="" + for skip_disk in "${skip_disks}"; do + if [ "${disk}" = "${skip_disk}" ]; then + skip=1 + break + fi + done + [ -n "${skip}" ] \ + && continue + if [ -n "${target_disk}" ]; then + target_disk="" + break + fi + target_disk="${disk}" +done + f_dprintf "Began Installation at %s" "$( date )" rm -rf $BSDINSTALL_TMPETC @@ -280,6 +307,8 @@ case "$PARTMODE" in "Auto (UFS)") # Guided if [ -e /dev/mirror/pfSenseMirror ]; then bsdinstall scriptedpart mirror/pfSenseMirror || error "Partitioning error" + elif [ -n "${target_disk}" ]; then + bsdinstall scriptedpart "${target_disk}" || error "Partitioning error" else bsdinstall autopart || error "Partitioning error" fi @@ -400,9 +429,9 @@ fi #bsdinstall rootpass || error "Could not set root password" trap true SIGINT # This section is optional -if [ "$NETCONFIG_DONE" != yes ]; then +#if [ "$NETCONFIG_DONE" != yes ]; then # bsdinstall netconfig # Don't check for errors -- the user may cancel -fi +#fi #bsdinstall time #bsdinstall services #bsdinstall hardening |