aboutsummaryrefslogtreecommitdiff
path: root/src/jail-update
diff options
context:
space:
mode:
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2006-09-19 16:56:25 +0000
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2006-09-19 16:56:25 +0000
commit397f31fcb0b47000c6e5c5c4aaf441970ce06e3a (patch)
tree0df0e0bbc0ef9d4f2a388d4bd634e8683e9a36af /src/jail-update
parenta5ad04283516a7ff72cfd33f3221cfd3c10c3b5b (diff)
downloadsimplepkg-397f31fcb0b47000c6e5c5c4aaf441970ce06e3a.tar.gz
simplepkg-397f31fcb0b47000c6e5c5c4aaf441970ce06e3a.tar.bz2
simplepkg 0.4.9pre2
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@5 04377dda-e619-0410-9926-eae83683ac58
Diffstat (limited to 'src/jail-update')
-rwxr-xr-xsrc/jail-update62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/jail-update b/src/jail-update
new file mode 100755
index 0000000..f6635b5
--- /dev/null
+++ b/src/jail-update
@@ -0,0 +1,62 @@
+#!/bin/bash
+#
+# jail-update: update config files from a jail to a template
+# feedback: rhatto@riseup.net | gpl
+#
+# Jail-update is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or any later version.
+#
+# Jail-update is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place - Suite 330, Boston, MA 02111-1307, USA
+#
+
+COMMON="/usr/libexec/simplepkg/common.sh"
+
+if [ -f "$COMMON" ]; then
+ source $COMMON
+else
+ echo "error: file $COMMON found, check your `basename $0` installation"
+ exit 1
+fi
+
+if [ -f $JAIL_LIST ]; then
+ for jailpath in `cat $JAIL_LIST`; do
+ jail="`basename $jailpath`"
+ echo updating $jailpath...
+ if [ -d "$BASE_CONF/$jail.d" ] || [ -a "$BASE_CONF/$jail.template" ]; then
+ templatepkg -a $jail $jailpath
+ cd $BASE_CONF/$jail.d
+ for file in `find`; do
+ if [[ -f "$file" && -f "$jailpath/$file" ]]; then
+ if ! diff $file $jailpath/$file; then
+ echo updating $file
+ cp -f $jailpath/$file $file
+ fi
+ fi
+ done
+ fi
+ done
+fi
+
+# main jail
+if [ -a "$BASE_CONF/main.template" ]; then
+ echo updating main installation...
+ templatepkg -a main
+fi
+if [ -d "$BASE_CONF/main.d" ]; then
+ cd $BASE_CONF/main.d
+ for file in `find`; do
+ if [[ -f "$file" && -f "/$file" ]]; then
+ if ! diff $file /$file; then
+ echo updating $file
+ cp -f /$file $file
+ fi
+ fi
+ done
+fi