3 # Setup a new config directory
6 echo "usage: $0 <newconfig> [<baseconfig>]"
8 echo "usage: $0 revert"
13 FILES
="defaultdomain fstab ifconfig.* inetd.conf mrouted.conf \
14 mygate myname netstart nsswitch.conf ntp.conf \
15 rc.conf rc.conf.d resolv.conf"
17 if [ $dir = init
] ; then
18 if [ -d /etc
/etc.network
-o -e /etc
/etc.current
] ; then
19 echo "Error: multi-configuration already initialized"
25 ln -s $dir etc.current
26 ln -s $dir etc.default
28 if [ -f $i -o -d $i ] ; then
30 ln -s etc.current
/$i .
33 echo "/etc/$dir has now been created and populated."
37 if [ $dir = revert
] ; then
38 if [ ! -d /etc
/etc.current
] ; then
39 echo "Error: multi-configuration not initialized"
44 if [ -f $i -o -d $i ] ; then
49 echo "$i: not a symlink, skipping"
52 linkto
="${stat##*-> }"
56 echo "$i: does not symlink to etc.current, skipping"
64 ( cd etc.current
&& pax
-rw -pe $i /etc
)
73 if [ "`expr $dir : 'etc\.\(.*\)'`" != $dir ] ; then
76 if [ -e /etc
/$dir ] ; then
77 echo "Error: $dir already exists"
80 newname
=`expr $dir : 'etc.\(.*\)'`
81 if [ $# -lt 2 ] ; then
83 echo "Using current config as base for $newname"
88 if [ -z "`expr $orig : 'etc.\(.*\)'`" ] ; then
92 if [ ! -d /etc
/$orig ] ; then
93 echo "Original directory /etc/$orig does not exist."
96 mkdir
-m 755 /etc
/$dir
98 pax
-rw -pe .
/etc
/$dir
99 echo "/etc/$dir has now been created and populated."