summaryrefslogtreecommitdiffstats
path: root/etc/defaults
diff options
context:
space:
mode:
Diffstat (limited to 'etc/defaults')
-rw-r--r--etc/defaults/rc.conf35
1 files changed, 23 insertions, 12 deletions
diff --git a/etc/defaults/rc.conf b/etc/defaults/rc.conf
index dd8a03b..9ce5d1d 100644
--- a/etc/defaults/rc.conf
+++ b/etc/defaults/rc.conf
@@ -7,10 +7,9 @@
# instead and you will be able to update these defaults later without
# spamming your local configuration information.
#
-# A common mistake is to copy the contents of this file into one of the
-# ${rc_conf_files} files (e.g. /etc/rc.conf). That does not work, because
-# this file ends up recursing on itself. The ${rc_conf_files} files should
-# only contain values which override values set in this file.
+# The ${rc_conf_files} files should only contain values which override
+# values set in this file. This eases the upgrade path when defaults
+# are changed and new features are added.
#
# All arguments must be in double or single quotes.
#
@@ -289,14 +288,26 @@ update_motd="YES" # update version info in /etc/motd (or NO)
start_vinum="" # set to YES to start vinum
##############################################################
-### Allow local configuration override at the very end here ##
+### Define source_rc_confs, the mechanism used by /etc/rc.* ##
+### scripts to source rc_conf_files overrides safely. ##
##############################################################
-#
-#
-for i in ${rc_conf_files}; do
- if [ -f $i ]; then
- . $i
- fi
-done
+if [ -z "${source_rc_confs_defined}" ]; then
+ source_rc_confs_defined=yes
+ source_rc_confs ( ) {
+ local i sourced_files
+ for i in ${rc_conf_files}; do
+ case ${sourced_files} in
+ *:$i:*)
+ ;;
+ *)
+ sourced_files="${sourced_files}:$i:"
+ if [ -r $i ]; then
+ . $i
+ fi
+ ;;
+ esac
+ done
+ }
+fi
OpenPOWER on IntegriCloud