3 # $DragonFly: src/sbin/newbtconf/newbtconf.sh,v 1.2 2005/07/02 21:05:56 swildner Exp $
4 # Setup a new config directory
7 echo "usage: $0 <newconfig> [<baseconfig>]"
9 echo "usage: $0 revert"
14 FILES
="defaultdomain dntpd.conf fstab ifconfig.* inetd.conf mrouted.conf \
15 mygate myname netstart nsswitch.conf ntpd.conf \
16 rc.conf rc.conf.d resolv.conf"
18 if [ $dir = init
] ; then
19 if [ -d /etc
/etc.network
-o -e /etc
/etc.current
] ; then
20 echo "Error: multi-configuration already initialized"
26 ln -s $dir etc.current
27 ln -s $dir etc.default
29 if [ -f $i -o -d $i ] ; then
31 ln -s etc.current
/$i .
34 echo "/etc/$dir has now been created and populated."
38 if [ $dir = revert
] ; then
39 if [ ! -d /etc
/etc.current
] ; then
40 echo "Error: multi-configuration not initialized"
45 if [ -f $i -o -d $i ] ; then
50 echo "$i: not a symlink, skipping"
53 linkto
="${stat##*-> }"
57 echo "$i: does not symlink to etc.current, skipping"
65 ( cd etc.current
&& pax
-rw -pe $i /etc
)
74 if [ "`expr $dir : 'etc\.\(.*\)'`" != $dir ] ; then
77 if [ -e /etc
/$dir ] ; then
78 echo "Error: $dir already exists"
81 newname
=`expr $dir : 'etc.\(.*\)'`
82 if [ $# -lt 2 ] ; then
84 echo "Using current config as base for $newname"
89 if [ -z "`expr $orig : 'etc.\(.*\)'`" ] ; then
93 if [ ! -d /etc
/$orig ] ; then
94 echo "Original directory /etc/$orig does not exist."
97 mkdir
-m 755 /etc
/$dir
99 pax
-rw -pe .
/etc
/$dir
100 echo "/etc/$dir has now been created and populated."