diff options
author | rhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58> | 2007-03-21 01:46:54 +0000 |
---|---|---|
committer | rhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58> | 2007-03-21 01:46:54 +0000 |
commit | 200dd72cd3b98677e7c689b4c48a30c37d35efff (patch) | |
tree | 3135d8f41f3280b5fc2414cd9b1a3f72732e6c24 /trunk/src | |
parent | 12ed80743223cde6d233fa191839737c6253cf4d (diff) | |
download | simplepkg-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/src')
-rwxr-xr-x | trunk/src/jail-commit | 72 | ||||
-rwxr-xr-x | trunk/src/jail-update | 8 |
2 files changed, 46 insertions, 34 deletions
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 |