aboutsummaryrefslogtreecommitdiff
path: root/trunk
diff options
context:
space:
mode:
Diffstat (limited to 'trunk')
-rw-r--r--trunk/lib/common.sh9
-rwxr-xr-xtrunk/simplepkg.SlackBuild11
-rwxr-xr-xtrunk/src/templatepkg25
3 files changed, 35 insertions, 10 deletions
diff --git a/trunk/lib/common.sh b/trunk/lib/common.sh
index 952f25d..ac89596 100644
--- a/trunk/lib/common.sh
+++ b/trunk/lib/common.sh
@@ -324,6 +324,8 @@ function search_default_template {
elif [ -f "$BASE_CONF/default.template" ]; then
TEMPLATE_BASE="$BASE_CONF/default"
echo $BASENAME using default template
+ elif [ -f "$BASE_CONF/defaults/templates/default/default.template" ]; then
+ TEMPLATE_BASE="$BASE_CONF/defaults/templates/default"
else
echo $BASENAME: error: default template not found
echo $BASENAME: please create a template using templatepkg
@@ -343,6 +345,11 @@ function search_template {
# - $BASE_CONF/templates/template_name.template
# - $BASE_CONF/templates/template_name/template_name.template
#
+ # also, there's a folder for "oficial" simplepkg templates,
+ # $BASE_CONF/defaults/templates/ and you can override any template
+ # in the default folder by placing a template with the same name
+ # in the template storage folders
+ #
if [ -f "$BASE_CONF/$1.template" ]; then
TEMPLATE_BASE="$BASE_CONF/$1"
@@ -350,6 +357,8 @@ function search_template {
TEMPLATE_BASE="$BASE_CONF/templates/$1"
elif [ -f "$BASE_CONF/templates/$1/$1.template" ]; then
TEMPLATE_BASE="$BASE_CONF/templates/$1/$1"
+ elif [ -f "$BASE_CONF/defaults/templates/$1/$1.template" ]; then
+ TEMPLATE_BASE="$BASE_CONF/defaults/templates/$1/$1"
else
if [ "$2" == "--new" ]; then
# we need to return the path for a new template
diff --git a/trunk/simplepkg.SlackBuild b/trunk/simplepkg.SlackBuild
index 3ef542c..2621e55 100755
--- a/trunk/simplepkg.SlackBuild
+++ b/trunk/simplepkg.SlackBuild
@@ -48,10 +48,10 @@ for file in $DOC_LIST; do
done
# especifico do simplepkg
-mkdir -p $PACK_DIR/etc/$PACKAGE/
-rsync -av --exclude=.svn templates/* $PACK_DIR/etc/$PACKAGE/templates/
-chmod +x $PACK_DIR/etc/$PACKAGE/templates/vserver/vserver.s/*.sh
-chmod +x $PACK_DIR/etc/$PACKAGE/templates/vserver-legacy/vserver-legacy.s/*.sh
+mkdir -p $PACK_DIR/etc/$PACKAGE/{defaults,templates}
+rsync -av --exclude=.svn templates/* $PACK_DIR/etc/$PACKAGE/defaults/templates/
+chmod +x $PACK_DIR/etc/$PACKAGE/defaults/templates/vserver/vserver.s/*.sh
+chmod +x $PACK_DIR/etc/$PACKAGE/defaults/templates/vserver-legacy/vserver-legacy.s/*.sh
cp conf/simplepkg.conf.new $PACK_DIR/etc/$PACKAGE
cp conf/repos.conf.new $PACK_DIR/etc/$PACKAGE
cp conf/generic.mkslackbuild.new $PACK_DIR/etc/$PACKAGE
@@ -68,5 +68,6 @@ makepkg -c y -l y ../simplepkg-$VERSION-$ARCH-$BUILD.tgz
cd ..
if [ "$CLEANUP" != "no" ]; then
- rm -rf $PACK_DIR
+ rm -rf $PACK_DIR
fi
+
diff --git a/trunk/src/templatepkg b/trunk/src/templatepkg
index 914f1aa..d2eea48 100755
--- a/trunk/src/templatepkg
+++ b/trunk/src/templatepkg
@@ -22,9 +22,9 @@ BASENAME="`basename $0`"
if [ -f "$COMMON" ]; then
source $COMMON
- eval_config `basename $0`
+ eval_config $BASENAME
else
- echo "error: file $COMMON found, check your `basename $0` installation"
+ echo "error: file $COMMON found, check your $BASENAME installation"
exit 1
fi
@@ -58,16 +58,22 @@ function usage {
echo ""
echo " in all cases (-c, -u and -a), jail-root defaults to /, if ommited"
echo ""
- exit 1
+ exit
+
+ # TODO: -i | --import
+ # -co | --checkout
+
+ # - importado o /etc/simplepkg/templates
+ # - importado apenas um template
+ # - nao importado nada
}
function template_create {
# create a new template
- # TODO: usar svn add $TEMPLATE_BASE ao inves de svn mkdir, etc?
- local template_base
+ local template_base info_commit
if [ ! -d "$TEMPLATE_BASE" ]; then
if use_svn && [ -d "`dirname $TEMPLATE_BASE`/.svn" ]; then
@@ -87,18 +93,26 @@ function template_create {
if ! svn_check $TEMPLATE.d; then
svn mkdir $TEMPLATE.d
+ info_commit="yes"
fi
if ! svn_check $TEMPLATE.s; then
svn mkdir $TEMPLATE.s
+ info_commit="yes"
fi
if ! svn_check $TEMPLATE.template; then
svn add $TEMPLATE.template
+ info_commit="yes"
fi
if ! svn_check $TEMPLATE.perms; then
svn add $TEMPLATE.perms
+ info_commit="yes"
+ fi
+
+ if [ "$info_commit" == "yes" ]; then
+ echo $BASENAME: please run jail-commit to add files under $file into the svn repository
fi
else
@@ -206,6 +220,7 @@ function template_add {
else
if [ -a "$jail/$file" ]; then
+ # TODO: use svn mkdir if needed
mkdir -p $TEMPLATE_BASE.d/`dirname $file`/
destination="`echo $TEMPLATE_BASE.d/$file | sed -e 's/\/$//'`"
cp -a $jail/$file $destination