summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Grennan <tgrennan@io.vyatta.com>2007-12-13 18:21:38 -0800
committerTom Grennan <tgrennan@io.vyatta.com>2007-12-13 18:21:38 -0800
commitc6a0c8078b8be141618fed1011229582f13ec30f (patch)
treec3c926daeac802eb834e2d7b05eea1ee42fd2b09
parent832dbf144bc019ec524e4163b716dd823ee26900 (diff)
downloadvyatta-cfg-c6a0c8078b8be141618fed1011229582f13ec30f.tar.gz
vyatta-cfg-c6a0c8078b8be141618fed1011229582f13ec30f.zip
support aufs and unionfs
-rw-r--r--etc/bash_completion.d/20vyatta-cfg12
-rwxr-xr-xscripts/xorp_tmpl_tool14
-rw-r--r--src/commit.c4
-rw-r--r--src/delete.c4
4 files changed, 27 insertions, 7 deletions
diff --git a/etc/bash_completion.d/20vyatta-cfg b/etc/bash_completion.d/20vyatta-cfg
index dc05cf1..ecf414d 100644
--- a/etc/bash_completion.d/20vyatta-cfg
+++ b/etc/bash_completion.d/20vyatta-cfg
@@ -935,12 +935,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'
@@ -970,3 +976,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/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 3fa77c5..d0d2517 100644
--- a/src/commit.c
+++ b/src/commit.c
@@ -1318,8 +1318,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);
}