summaryrefslogtreecommitdiff
path: root/packages/sysconf/files/sysconfsetup
diff options
context:
space:
mode:
authorRod Whitby <rod@whitby.id.au>2007-03-25 11:38:45 +0000
committerRod Whitby <rod@whitby.id.au>2007-03-25 11:38:45 +0000
commitfa2a25a2700d2211fa302a27cb180ce8475f9cd8 (patch)
treeec0b69f6bea7008f533e0f3b75f287f171fc3a01 /packages/sysconf/files/sysconfsetup
parent93a28f8e6f88b974630f36d59c7f273e12f6a3be (diff)
sysconf: A general utility for storing network configuration and CONFFILES in a flash partition
Diffstat (limited to 'packages/sysconf/files/sysconfsetup')
-rw-r--r--packages/sysconf/files/sysconfsetup59
1 files changed, 59 insertions, 0 deletions
diff --git a/packages/sysconf/files/sysconfsetup b/packages/sysconf/files/sysconfsetup
new file mode 100644
index 0000000000..7b91a0e331
--- /dev/null
+++ b/packages/sysconf/files/sysconfsetup
@@ -0,0 +1,59 @@
+#!/bin/sh
+# This script is run once when the system first boots. Its sole
+# purpose is to create /etc/default/sysconf (the overall system
+# configuration file) and other files derived from this.
+#
+# The script runs immediately after S10checkroot.sh - this is the
+# point at which the rootfs will be mounted rw even if the kernel
+# booted with it ro.
+#
+# rm or mv the file (/etc/default/sysconf) to recreate it, run this
+# script with the reload option to overwrite the system files. The
+# configuration files described in sysconf_reload (in
+# /sbin/sysconf) will be overwritten on reload.
+#
+# start: standard startup, do a complete (auto) restore if necessary
+# reinit: always do a complete auto restore
+# reload: just reload sysconf (no config files!)
+#
+# /etc/default/functions contains useful utility functions - it's
+# in a separate file so that it can be loaded by any script
+# load_functions "source"
+# load the functions in '/sbin/source' - relies on /sbin/source being
+# a shell script and having support for this function.
+
+# load_functions "source"
+# load the functions in '/sbin/source' - relies on /sbin/source being
+# a shell script and having support for this function.
+load_functions(){
+ test -n "$1" -a -x "/sbin/$1" && . "/sbin/$1" || {
+ echo "$0: /sbin/$1: script not found" >&2
+ return 1
+ }
+}
+
+load_functions sysconf || exit 1
+
+case "$1" in
+start) test -s /etc/default/sysconf || {
+ if sysconf_read
+ then
+ if sysconf_valid
+ then
+ sysconf_restore auto
+ else
+ sysconf_reload
+ fi
+ else
+ sysconf_default
+ sysconf_reload
+ fi
+ };;
+
+reload) test -s /etc/default/sysconf || sysconf_read || sysconf_default
+ sysconf_reload;;
+
+reinit) sysconf_restore auto;;
+
+*) ;;
+esac