diff options
Diffstat (limited to 'usr.sbin/bsdinstall/scripts')
-rwxr-xr-x | usr.sbin/bsdinstall/scripts/auto | 16 | ||||
-rwxr-xr-x | usr.sbin/bsdinstall/scripts/copy_configxml_from_usb | 18 |
2 files changed, 27 insertions, 7 deletions
diff --git a/usr.sbin/bsdinstall/scripts/auto b/usr.sbin/bsdinstall/scripts/auto index 7cda433..e2e3d52 100755 --- a/usr.sbin/bsdinstall/scripts/auto +++ b/usr.sbin/bsdinstall/scripts/auto @@ -465,6 +465,22 @@ trap error SIGINT # SIGINT is bad again bsdinstall config || error "Failed to save config" bsdinstall copy_configxml_from_usb +# If the user recovered a config.xml from an existing disk or provided one on +# a USB disk, then copy this config.xml to the chroot +if [ -r /tmp/recovered_config/config.xml ] ; then + /bin/cp -r /tmp/recovered_config/config.xml ${BSDINSTALL_CHROOT}/cf/conf/ + # Set a flag to let the installed system know this may need extra processing + /usr/bin/touch ${BSDINSTALL_CHROOT}/cf/conf/installer_copied_config + # Only set the package sync flag if the restored config.xml contains active packages + if [ `/usr/bin/grep -c '<package>' ${BSDINSTALL_CHROOT}/cf/conf/config.xml` -gt 0 ]; then + /usr/bin/touch ${BSDINSTALL_CHROOT}/cf/conf/needs_package_sync_after_reboot + fi + # If there is an existing configuration, then there is no need to run the wizard. + if [ -r ${BSDINSTALL_CHROOT}/cf/conf/trigger_initial_wizard ]; then + rm -f ${BSDINSTALL_CHROOT}/cf/conf/trigger_initial_wizard + fi +fi + if [ -n "$DISTDIR_IS_UNIONFS" ]; then umount -f $BSDINSTALL_DISTDIR fi diff --git a/usr.sbin/bsdinstall/scripts/copy_configxml_from_usb b/usr.sbin/bsdinstall/scripts/copy_configxml_from_usb index b022a0a..d682311 100755 --- a/usr.sbin/bsdinstall/scripts/copy_configxml_from_usb +++ b/usr.sbin/bsdinstall/scripts/copy_configxml_from_usb @@ -25,24 +25,28 @@ # SUCH DAMAGE. # # $FreeBSD$ +recovery_mount=/tmp/mnt_recovery +recovery_dir=/tmp/recovered_config +mkdir -p ${recovery_mount} +mkdir -p ${recovery_dir} look_for_config_xml_config_msdos() { - mkdir -p /tmp/mnt/cf + mkdir -p ${recovery_mount} echo -n "Looking for config.xml on " for try_device in `/sbin/gpart show -p | /usr/bin/egrep '(fat32|\!11|\!12|\!14)' | /usr/bin/awk '{print $3;}'`; do if [ ! -e /dev/${try_device} ]; then continue fi echo -n "${try_device}: " - if /sbin/mount -t msdosfs /dev/${try_device} /tmp/mnt/cf 2>/dev/null ; then + if /sbin/mount -t msdosfs /dev/${try_device} ${recovery_mount} 2>/dev/null ; then echo -n "[found msdos] " # look for config.xml - if [ -r /tmp/mnt/cf/conf/config.xml ]; then + if [ -r ${recovery_mount}/conf/config.xml ]; then echo -n "[config.xml on ${try_device}] " return 0 else echo -n "[no config.xml on ${try_device}, unmounting] " - /sbin/umount /tmp/mnt/cf + /sbin/umount ${recovery_mount} fi fi done @@ -51,9 +55,9 @@ look_for_config_xml_config_msdos() { # Try to locate an existing config.xml file if look_for_config_xml_config_msdos ; then - /bin/cp -r /tmp/mnt/cf/conf/config.xml $BSDINSTALL_CHROOT/cf/conf/ - /sbin/umount /tmp/mnt/cf/ 2>&1 - echo -n "[Copied config.xml file] " + /bin/cp -r ${recovery_mount}/conf/config.xml ${recovery_dir} + /sbin/umount ${recovery_mount} 2>&1 + echo -n "[Copied config.xml file to recovery area] " else echo -n "[Could not locate an existing config.xml file!] " fi |