aboutsummaryrefslogtreecommitdiff
path: root/trunk
diff options
context:
space:
mode:
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2007-03-21 01:46:54 +0000
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2007-03-21 01:46:54 +0000
commit200dd72cd3b98677e7c689b4c48a30c37d35efff (patch)
tree3135d8f41f3280b5fc2414cd9b1a3f72732e6c24 /trunk
parent12ed80743223cde6d233fa191839737c6253cf4d (diff)
downloadsimplepkg-200dd72cd3b98677e7c689b4c48a30c37d35efff.tar.gz
simplepkg-200dd72cd3b98677e7c689b4c48a30c37d35efff.tar.bz2
some changes on jail-commit, small changes in common.sh and jail-update
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@208 04377dda-e619-0410-9926-eae83683ac58
Diffstat (limited to 'trunk')
-rw-r--r--trunk/lib/common.sh1
-rwxr-xr-xtrunk/src/jail-commit72
-rwxr-xr-xtrunk/src/jail-update8
3 files changed, 47 insertions, 34 deletions
diff --git a/trunk/lib/common.sh b/trunk/lib/common.sh
index 28ee8ea..38e9468 100644
--- a/trunk/lib/common.sh
+++ b/trunk/lib/common.sh
@@ -431,6 +431,7 @@ function copy_template_files {
echo "$BASENAME: copying template files..."
if [ -d "$TEMPLATE_BASE.d" ]; then
if [ "$TEMPLATES_UNDER_SVN" == "1" ]; then
+ svn update
rsync -av --exclude=.svn $TEMPLATE_BASE.d/ $JAIL_ROOT/$server/
else
rsync -av $TEMPLATE_BASE.d/ $JAIL_ROOT/$server/
diff --git a/trunk/src/jail-commit b/trunk/src/jail-commit
index b318f94..59fccad 100755
--- a/trunk/src/jail-commit
+++ b/trunk/src/jail-commit
@@ -25,6 +25,13 @@ else
exit 1
fi
+function usage {
+
+ echo $BASENAME: commit a jail configuration into a template
+ echo usage: $BASENAME [<jail-path> [template]]
+
+}
+
function template_merge {
# copy differences between the jail
@@ -57,40 +64,53 @@ function template_merge {
function template_svn_commit {
if use_svn; then
- cd `basedir $TEMPLATE_BASE`
- svn commit -m "changes for `date`"
+ cd `basedir $TEMPLATE_BASE`
+ svn commit -m "changes for `date`"
fi
}
-# TODO: command line parsing: with no arguments, jail-commit
-# does exactly what it does now, but we also need to add
-# options to choose just one jail to commit; perhaps
-# make this similar to jail-update command line behaviour.
+function do_commit {
+
+ # commit jail changes to a repository
+ # usage: do_commit <jailpath> [template]
+
+ local jailpath template
+
+ jailpath="$1"
+ jail="`basename $jailpath`"
+
+ if [ ! -z "$2" ]; then
+ template="$2"
+ else
+ template="$jail"
+ fi
-if [ -f $JAIL_LIST ]; then
- for jailpath in `cat $JAIL_LIST`; do
- jail="`basename $jailpath`"
- search_template $jail --update
- if [ "$?" == "0" ]; then
+ search_template $template --update
+ if [ "$?" == "0" ]; then
+ if [ "$jailpath" == "/" ]; then
+ echo updating main installation...
+ else
echo updating $jailpath...
- if [ -d "$TEMPLATE_BASE.d" ] || [ -a "$TEMPLATE_BASE.template" ]; then
- templatepkg -u $jail $jailpath
- template_merge $jailpath
- template_svn_commit $TEMPLATE_BASE
- fi
fi
- done
-fi
+ if [ -d "$TEMPLATE_BASE.d" ] || [ -a "$TEMPLATE_BASE.template" ]; then
+ templatepkg -u $jail $jailpath
+ template_merge $jailpath
+ template_svn_commit $TEMPLATE_BASE
+ fi
+ fi
+
+}
-# main jail
-search_template main --update
-if [ "$?" == "0" ]; then
- if [ -a "$TEMPLATE_BASE.template" ] || [ -a "$TEMPLATE_BASE.template" ]; then
- echo updating main installation...
- templatepkg -u main
- template_merge /
- template_svn_commit $TEMPLATE_BASE
+if [ ! -z "$1" ]; then
+ do_commit $1 $2
+else
+ if [ -f $JAIL_LIST ]; then
+ for jailpath in `cat $JAIL_LIST`; do
+ do_commit $jailpath
+ done
fi
+ # main jail
+ do_commit / main
fi
diff --git a/trunk/src/jail-update b/trunk/src/jail-update
index 09d1555..471591b 100755
--- a/trunk/src/jail-update
+++ b/trunk/src/jail-update
@@ -50,14 +50,6 @@ if [ "$?" != "0" ]; then
exit 1
fi
-if [ -d "$TEMPLATE_BASE.d" ]; then
- true
-fi
-
-if [ -s "$TEMPLATE_BASE.perms" ]; then
-
-fi
-
copy_template_files $1
set_jail_perms $1