summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/vyatta-cfg.postinst.in3
-rw-r--r--etc/bash_completion.d/20vyatta-cfg12
-rwxr-xr-xetc/init.d/vyatta-ofr71
-rwxr-xr-xscripts/vyatta-load-config.pl6
-rwxr-xr-xscripts/vyatta-save-config.pl9
-rwxr-xr-xscripts/xorp_tmpl_tool14
-rw-r--r--src/commit.c4
-rw-r--r--src/delete.c4
8 files changed, 35 insertions, 88 deletions
diff --git a/debian/vyatta-cfg.postinst.in b/debian/vyatta-cfg.postinst.in
index 80ddb8c..3fce13b 100644
--- a/debian/vyatta-cfg.postinst.in
+++ b/debian/vyatta-cfg.postinst.in
@@ -3,6 +3,9 @@
prefix=@prefix@
sysconfdir=@sysconfdir@
+mkdir -m 0775 -p $sysconfdir/config $prefix/config
+chgrp quaggavty $sysconfdir/config $prefix/config
+
update-rc.d vyatta-ofr defaults 90 >/dev/null
# do we want to start vyatta-ofr here in postinst?
diff --git a/etc/bash_completion.d/20vyatta-cfg b/etc/bash_completion.d/20vyatta-cfg
index 78f2e0a..bc9088f 100644
--- a/etc/bash_completion.d/20vyatta-cfg
+++ b/etc/bash_completion.d/20vyatta-cfg
@@ -941,12 +941,18 @@ make_vyatta_config_dir ()
sudo chgrp ${DEF_GROUP} $1
}
+if grep -q union=aufs /proc/cmdline || grep -q aufs /proc/filesystems ; then
+ export UNIONFS=aufs
+else
+ export UNIONFS=unionfs
+fi
+
make_vyatta_config_dir $VYATTA_ACTIVE_CONFIGURATION_DIR
make_vyatta_config_dir $VYATTA_CHANGES_ONLY_DIR
make_vyatta_config_dir $VYATTA_CONFIG_TMP
if [ ! -d $VYATTA_TEMP_CONFIG_DIR ]; then
make_vyatta_config_dir $VYATTA_TEMP_CONFIG_DIR
- sudo mount -t unionfs -o dirs=${VYATTA_CHANGES_ONLY_DIR}=rw:/opt/vyatta/config/active=ro unionfs ${VYATTA_TEMP_CONFIG_DIR}
+ sudo mount -t $UNIONFS -o dirs=${VYATTA_CHANGES_ONLY_DIR}=rw:/opt/vyatta/config/active=ro $UNIONFS ${VYATTA_TEMP_CONFIG_DIR}
fi
# disallow 'Ctrl-D' exit, since we need special actions on 'exit'
@@ -976,3 +982,7 @@ complete -F vyatta_config_complete edit
complete -F vyatta_config_complete exit
complete -F vyatta_run_complete run
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 4
+# End:
diff --git a/etc/init.d/vyatta-ofr b/etc/init.d/vyatta-ofr
index 96770f6..aaa31b2 100755
--- a/etc/init.d/vyatta-ofr
+++ b/etc/init.d/vyatta-ofr
@@ -69,53 +69,6 @@ have_rl_system () {
test -x $vyatta_sbindir/rl-system.init
}
-use_floppy () {
- _fd_=/media/floppy
-
- if have_rl_system ; then
-## only do this if we have the rl-system package
-## if we donot discover an fd device, try loading the floppy module
- grep -q fd /proc/devices || modprobe -q floppy 2>/dev/null
- if grep -q fd /proc/devices ; then
- if awk -- '$1 ~ /\/dev\/fd/ { exit 1 }' /proc/mounts
- then
- mkdir -p $_fd_
- mount -t ext2 /dev/fd0 $_fd_ -o sync 2>/dev/null
- test $? -eq 32 && mount -t vfat /dev/fd0 $_fd_ 2>/dev/null
- fi
- fi
- fi
- test -d ${_fd_}/config
-}
-
-setup_configdir() {
- [ -f $BOOTFILE ] && return 0
- mkdir -m 0775 -p ${vyatta_sysconfdir}/config
- chgrp ${GROUP} ${vyatta_sysconfdir}/config
- if [ -d ~root/vyatta/config ] ; then
- mount -o bind ~root/vyatta/config $vyatta_sysconfdir/config
- elif use_floppy ; then
- mount -o bind /media/floppy/config $vyatta_sysconfdir/config
- else
- mkdir -m 0775 -p ~root/vyatta/config
- chgrp ${GROUP} ~root/vyatta ~root/vyatta/config
- mount -o bind ~root/vyatta/config $vyatta_sysconfdir/config
- fi
-}
-
-setup_rclocal () {
- [ -f /etc/rc.local ] || touch /etc/rc.local
- if [ -f ~root/vyatta/rc.local ]; then
- mount -o bind ~root/vyatta/rc.local /etc/rc.local
- elif [ -f /media/floppy/rc.local ]; then
- mount -o bind /media/floppy/rc.local /etc/rc.local
- fi
-}
-
-restore_rclocal () {
- umount /etc/rc.local >& /dev/null
-}
-
# if necessary, provide initial config
init_bootfile () {
if [ ! -f $BOOTFILE ] ; then
@@ -150,28 +103,10 @@ load_bootfile ()
fi
}
-# this handles the "config dir" (/opt/vyatta/config), which is different
-# from the directory for config files (/opt/vyatta/etc/config).
-mount_cfg_dir ()
-{
- if [ ! -d ${vyatta_configdir} ] ; then
- mkdir -m 0775 -p ${vyatta_configdir}
- chgrp ${GROUP} ${vyatta_configdir}
- fi
- mount -o nosuid,nodev -t tmpfs none ${vyatta_configdir}
-}
-
-unmount_cfg_dir ()
-{
- umount ${vyatta_configdir}
-}
-
start ()
{
log_daemon_msg "Starting Vyatta Router"
- setup_configdir
- setup_rclocal
- mount_cfg_dir
+ mount -o nosuid,nodev -t tmpfs none ${vyatta_configdir}
init_bootfile
migrate_bootfile
for s in ${subinit[@]} ; do
@@ -179,7 +114,6 @@ start ()
${vyatta_sbindir}/${s}.init start || (log_end_msg $? && return)
done
load_bootfile
- echo -n $BOOTFILE > ${vyatta_sysconfdir}/bootfile_path
log_end_msg $?
}
@@ -193,8 +127,7 @@ stop()
${vyatta_sbindir}/${s}.init stop
let status\|=$?
done
- unmount_cfg_dir
- restore_rclocal
+ umount ${vyatta_configdir}
log_end_msg $status
}
diff --git a/scripts/vyatta-load-config.pl b/scripts/vyatta-load-config.pl
index a6f037a..d011a65 100755
--- a/scripts/vyatta-load-config.pl
+++ b/scripts/vyatta-load-config.pl
@@ -8,11 +8,7 @@ use VyattaConfigLoad;
my $etcdir = $ENV{vyatta_sysconfdir};
my $sbindir = $ENV{vyatta_sbindir};
-my $bootpath = '';
-if (-r "$etcdir/bootfile_path") {
- $bootpath = `cat $etcdir/bootfile_path`;
-}
-$bootpath =~ s/\/[^\/]+$//;
+my $bootpath = $etcdir . "/config";
if ($#ARGV != 0) {
print "Usage: load <config_file_name>\n";
diff --git a/scripts/vyatta-save-config.pl b/scripts/vyatta-save-config.pl
index 26b8eec..bad7c45 100755
--- a/scripts/vyatta-save-config.pl
+++ b/scripts/vyatta-save-config.pl
@@ -5,19 +5,14 @@ use lib "/opt/vyatta/share/perl5/";
use VyattaConfigOutput;
my $etcdir = "/opt/vyatta/etc";
-my $bootfile = '';
-if (-r "$etcdir/bootfile_path") {
- $bootfile = `cat $etcdir/bootfile_path`;
-}
-my $bootpath = $bootfile;
-$bootpath =~ s/\/[^\/]+$//;
+my $bootpath = $etcdir . "/config";
+my $save_file = $bootpath . "/config.boot";
if ($#ARGV > 0) {
print "Usage: save [config_file_name]\n";
exit 1;
}
-my $save_file = "$bootfile";
if (defined($ARGV[0])) {
$save_file = $ARGV[0];
if (!($save_file =~ /^\//)) {
diff --git a/scripts/xorp_tmpl_tool b/scripts/xorp_tmpl_tool
index 54c87bb..014a53b 100755
--- a/scripts/xorp_tmpl_tool
+++ b/scripts/xorp_tmpl_tool
@@ -1,5 +1,11 @@
#!/bin/bash
+if grep -q union=aufs /proc/cmdline || grep -q aufs /proc/filesystems ; then
+ export UNIONFS=aufs
+else
+ export UNIONFS=unionfs
+fi
+
UMASK_SAVE_G=`umask`
umask 0111
XORPLOGFILE=/tmp/xorp_tmpl_tool.log
@@ -36,7 +42,7 @@ export VYATTA_TEMP_CONFIG_DIR=/opt/vyatta/config/tmp/new_config_$VTID;
if [ ! -d $VYATTA_TEMP_CONFIG_DIR ]
then
mkdir -p $VYATTA_TEMP_CONFIG_DIR
- sudo mount -t unionfs -o dirs=${VYATTA_CHANGES_ONLY_DIR}=rw:/opt/vyatta/config/active=ro unionfs ${VYATTA_TEMP_CONFIG_DIR}
+ sudo mount -t $UNIONFS -o dirs=${VYATTA_CHANGES_ONLY_DIR}=rw:/opt/vyatta/config/active=ro $UNIONFS ${VYATTA_TEMP_CONFIG_DIR}
fi
## cli ENV_TMP_DIR
@@ -110,7 +116,7 @@ case "$1" in
sudo umount ${VYATTA_TEMP_CONFIG_DIR}
sudo rm -rf $VYATTA_CHANGES_ONLY_DIR/* $VYATTA_CHANGES_ONLY_DIR/.modified
- sudo mount -t unionfs -o dirs=${VYATTA_CHANGES_ONLY_DIR}=rw:/opt/vyatta/config/active=ro unionfs ${VYATTA_TEMP_CONFIG_DIR}
+ sudo mount -t $UNIONFS -o dirs=${VYATTA_CHANGES_ONLY_DIR}=rw:/opt/vyatta/config/active=ro $UNIONFS ${VYATTA_TEMP_CONFIG_DIR}
RET_STATUS=0
;;
end_loading)
@@ -150,3 +156,7 @@ echo "ret=${RET_STATUS}" >> ${XORPLOGFILE}
umask ${UMASK_SAVE_G}
exit $RET_STATUS
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 4
+# End:
diff --git a/src/commit.c b/src/commit.c
index 400328e..b2e1c8a 100644
--- a/src/commit.c
+++ b/src/commit.c
@@ -1334,8 +1334,8 @@ static int fin_commit(boolean ok)
static char format4[]="rm -rf %s/{.*,*} >&/dev/null ; /bin/true"; /*cdirp*/
static char format5[]="rm -rf %s/{.*,*} >&/dev/null ; /bin/true"; /*adirp*/
static char format6[]="mv -f %s/* -t %s";/*tmpp, adirp*/
- static char format7[]="sudo mount -t unionfs -o dirs=%s=rw:%s=ro"
- " unionfs %s"; /*cdirp, adirp, mdirp*/
+ static char format7[]="sudo mount -t $UNIONFS -o dirs=%s=rw:%s=ro"
+ " $UNIONFS %s"; /*cdirp, adirp, mdirp*/
int m_len = strlen(get_mdirp());
int t_len = strlen(get_tmpp());
int c_len = strlen(get_cdirp());
diff --git a/src/delete.c b/src/delete.c
index 1b7b62e..b62a697 100644
--- a/src/delete.c
+++ b/src/delete.c
@@ -28,8 +28,8 @@ static void remove_rf(boolean do_umount)
command = my_malloc(strlen(get_mdirp()) + strlen(get_cdirp()) +
strlen(get_mdirp()) + 100,
"delete");
- sprintf(command, "sudo mount -t unionfs -o dirs=%s=rw:%s=ro:"
- " unionfs %s", get_cdirp(), get_adirp(), get_mdirp());
+ sprintf(command, "sudo mount -t $UNIONFS -o dirs=%s=rw:%s=ro:"
+ " $UNIONFS %s", get_cdirp(), get_adirp(), get_mdirp());
system(command);
free(command);
}