[PC-BSD Commits] r6256 - pcbsd/trunk/pc-sysinstall/backend
svn at pcbsd.org
svn at pcbsd.org
Tue Feb 16 07:57:33 PST 2010
Author: kris
Date: 2010-02-16 07:57:33 -0800 (Tue, 16 Feb 2010)
New Revision: 6256
Modified:
pcbsd/trunk/pc-sysinstall/backend/functions-parse.sh
pcbsd/trunk/pc-sysinstall/backend/functions-upgrade.sh
pcbsd/trunk/pc-sysinstall/backend/parseconfig.sh
Log:
Added new ability to merge the old loader.conf with the new loader.conf when doing an upgrade, which
fixes issues with upgrading ZFS, and keeps any specified modules the user has enabled / disabled
Modified: pcbsd/trunk/pc-sysinstall/backend/functions-parse.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-parse.sh 2010-02-16 15:05:44 UTC (rev 6255)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-parse.sh 2010-02-16 15:57:33 UTC (rev 6256)
@@ -126,3 +126,41 @@
fi
};
+
+# Function which merges the contents of a new config into the specified old one
+# Only works with <val>= type configurations
+merge_config()
+{
+ OLDCFG="${1}"
+ NEWCFG="${2}"
+ FINALCFG="${3}"
+
+ # Copy our oldcfg to the new one, which will be used as basis
+ cp ${OLDCFG} ${FINALCFG}
+
+ # Remove blank lines from new file
+ cat ${NEWCFG} | sed '/^$/d' > ${FINALCFG}.tmp
+
+ # Set our marker if we've found any
+ FOUNDMERGE="NO"
+
+ while read newline
+ do
+ echo ${newline} | grep "^#" >/dev/null 2>/dev/null
+ if [ "$?" != "0" ] ; then
+ VAL="`echo ${newline} | cut -d '=' -f 1`"
+ cat ${OLDCFG} | grep ${VAL} >/dev/null 2>/dev/null
+ if [ "$?" != "0" ] ; then
+ if [ "${FOUNDMERGE}" = "NO" ] ; then
+ echo "" >> ${FINALCFG}
+ echo "# Auto-merged values from newer ${NEWCFG}" >> ${FINALCFG}
+ FOUNDMERGE="YES"
+ fi
+ echo "${newline}" >> ${FINALCFG}
+ fi
+ fi
+ done < ${FINALCFG}.tmp
+ rm ${FINALCFG}.tmp
+
+};
+
Modified: pcbsd/trunk/pc-sysinstall/backend/functions-upgrade.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-upgrade.sh 2010-02-16 15:05:44 UTC (rev 6255)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-upgrade.sh 2010-02-16 15:57:33 UTC (rev 6256)
@@ -193,6 +193,17 @@
};
+# Function which merges some configuration files with the new defaults
+merge_old_configs()
+{
+
+ # Merge the loader.conf with old
+ cp ${FSMNT}/boot/loader.conf ${FSMNT}/boot/loader.conf.new
+ merge_config "${FSMNT}/boot/loader.conf.preUpgrade" "${FSMNT}/boot/loader.conf.new" "${FSMNT}/boot/loader.conf"
+ rm ${FSMNT}/boot/loader.conf.new
+
+};
+
# Function which unmounts all the mounted file-systems
unmount_upgrade()
{
Modified: pcbsd/trunk/pc-sysinstall/backend/parseconfig.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/parseconfig.sh 2010-02-16 15:05:44 UTC (rev 6255)
+++ pcbsd/trunk/pc-sysinstall/backend/parseconfig.sh 2010-02-16 15:57:33 UTC (rev 6256)
@@ -123,6 +123,9 @@
# Now run any commands specified
run_commands
+ # Merge any old configuration files
+ merge_old_configs
+
# All finished, unmount the file-systems
unmount_upgrade
More information about the Commits
mailing list