diff options
author | rhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58> | 2007-02-08 23:58:09 +0000 |
---|---|---|
committer | rhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58> | 2007-02-08 23:58:09 +0000 |
commit | f7595585fae0e0844877ad111388837aaf74028b (patch) | |
tree | c8d1d2804b91b31afcc8a7df68396da3561dbdd3 /src/mkjail | |
parent | 3a77360e6a7f41db20c126a6a91d46591b0390d0 (diff) | |
download | simplepkg-f7595585fae0e0844877ad111388837aaf74028b.tar.gz simplepkg-f7595585fae0e0844877ad111388837aaf74028b.tar.bz2 |
changing template location procedures
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@163 04377dda-e619-0410-9926-eae83683ac58
Diffstat (limited to 'src/mkjail')
-rwxr-xr-x | src/mkjail | 47 |
1 files changed, 24 insertions, 23 deletions
@@ -18,9 +18,10 @@ # COMMON="/usr/libexec/simplepkg/common.sh" +BASENAME="`basename $0`" function usage { - echo "usage: [ROOT=/otherroot] `basename $0` <jail-name> [template]" + echo "usage: [ARCH=arch] [VERSION=version] [ROOT=/otherroot] $BASENAME <jail-name> [template]" exit 1 } @@ -38,47 +39,47 @@ else eval_config `basename $0` -u fi -if [[ ! -z "$2" && -f "$BASE_CONF/$2.template" ]]; then - TEMPLATE="$BASE_CONF/$2.template" -elif [[ ! -z "$2" && ! -f "$BASE_CONF/$2.template" ]]; then - echo template $2 not found, using default template - TEMPLATE="$BASE_CONF/default.template" -elif [[ -z "$2" && -f "$BASE_CONF/default.template" ]]; then - TEMPLATE="$BASE_CONF/default.template" - echo using default template +if [ ! -z "$2" ]; then + search_template $2 + result="$?" else - echo `basename $0` error: no templates found - echo please create a template using templatepkg + result="$?" + search_default_template +fi + +if [ "$result" != "0" ]; then exit 1 fi +TEMPLATE="$TEMPLATE_BASE.template" + if [ ! -d "$JAIL_ROOT/$server" ]; then mkdir -p $JAIL_ROOT/$server else if [ ! -z "`ls $JAIL_ROOT/$server | grep -v 'lost+found'`" ]; then - echo error: folder $JAIL_ROOT/$server already exists and seens to be not empty - echo probably the jail $1 already exists + echo $BASENAME: error: folder $JAIL_ROOT/$server already exists and seens to be not empty + echo $BASENAME: probably the jail $1 already exists exit 1 fi fi -echo "instaling packages into $JAIL_ROOT/$server using $TEMPLATE..." +echo "$BASENAME: instaling packages into $JAIL_ROOT/$server using $TEMPLATE..." install_packages -TEMPLATE="`echo $TEMPLATE | sed -e 's/\.template$//'`" -echo "copying template files..." -if [ -d "$TEMPLATE.d" ]; then - rsync -av $TEMPLATE.d/ $JAIL_ROOT/$server/ +echo "$BASENAME: copying template files..." +if [ -d "$TEMPLATE_BASE.d" ]; then + rsync -av $TEMPLATE_BASE.d/ $JAIL_ROOT/$server/ fi -echo "executing template scripts..." +echo "$BASENAME: executing template scripts..." if [ -d "$TEMPLATE.s" ]; then for script in `ls $TEMPLATE.s/`; do - if [ -x "$TEMPLATE.s/$script" ]; then - exec $TEMPLATE.s/$script $JAIL_ROOT $server + if [ -x "$TEMPLATE_BASE.s/$script" ]; then + exec $TEMPLATE_BASE.s/$script $JAIL_ROOT $server fi done fi -echo "$JAIL_ROOT/$server" >> $JAIL_LIST -echo "done creating $server jail" +echo $JAIL_ROOT/$server >> $JAIL_LIST +echo $BASENAME: done creating $server jail + |