summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMohit Mehta <mohit@vyatta.com>2011-05-11 11:30:45 -0700
committerMohit Mehta <mohit@vyatta.com>2011-05-11 11:30:45 -0700
commit4d7fedd8dca4022c1266e16796fd03132d7d2634 (patch)
tree4a3d06149528b2e86310fe1c93dbb6452466d5fe /scripts
parentdba5705ec29dc535a91cea4527ff82254fc07e05 (diff)
downloadvyatta-cfg-system-4d7fedd8dca4022c1266e16796fd03132d7d2634.tar.gz
vyatta-cfg-system-4d7fedd8dca4022c1266e16796fd03132d7d2634.zip
Fix Bug 7012 make /config available with init-floppy
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/init-floppy29
1 files changed, 22 insertions, 7 deletions
diff --git a/scripts/init-floppy b/scripts/init-floppy
index 16e12915..9f5301d8 100755
--- a/scripts/init-floppy
+++ b/scripts/init-floppy
@@ -64,7 +64,7 @@ config_notice="\rSaving config... \c"
config__error="\rError: Couldn't save config in $fd/config/config.boot"
bind___notice="\rRedirecting config directory...\c"
bind____error="\rError: redirect to floppy"
-saved__notice="\rYour configuration was saved in: $fd/config/config.boot"
+saved__notice="\rYour configuration directory was saved to: $fd/config"
mkdir -p $fd
@@ -92,16 +92,31 @@ echo "$mount__notice"
/bin/mount /dev/fd0 $fd -t ext2 -o sync,noatime,noexec,nosuid,nodev &>/dev/null || \
failure "$mount___error"
-/bin/mkdir $fd/config
-/bin/chmod 777 $fd/config
-
-echo "$config_notice"
-${vyatta_sbindir}/vyatta-save-config.pl $fd/config/config.boot &>/dev/null || \
- failure "$config__error"
+#
+# Check to make sure we have enough space to copy the config dir
+#
+fd_space_avail=`df -k $fd | tail -1 | awk '{ print $4 }'`
+space_needed=`du -s ${vyatta_sysconfdir}/config | awk '{ print $1 }'`
+
+if [ $fd_space_avail -gt $space_needed ]; then
+ echo "$config_notice"
+ /bin/mkdir $fd/config
+ /usr/bin/find ${vyatta_sysconfdir}/config -maxdepth 1 -mindepth 1 \
+ -exec /bin/cp '-a' '{}' "$fd/config" ';'
+ /bin/chgrp -R vyattacfg $fd/config
+ /bin/chmod -R 775 $fd/config
+else
+ echo 'Not enough space to save current configuration directory'
+ failure "$config__error"
+fi
echo "$bind___notice"
/bin/mount -o bind $fd/config ${vyatta_sysconfdir}/config &>/dev/null || \
failure "$bind____error"
+# also, bind mount config directory to /config
+/bin/mkdir -p /config
+/bin/mount -o bind $fd/config /config &>/dev/null || \
+ failure "$bind____error"
echo "$saved__notice"