diff options
Diffstat (limited to 'src/templatepkg')
-rwxr-xr-x | src/templatepkg | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/templatepkg b/src/templatepkg index 9c1f8bc..dc0323c 100755 --- a/src/templatepkg +++ b/src/templatepkg @@ -19,6 +19,7 @@ # COMMON="/usr/libexec/simplepkg/common.sh" +BASENAME="`basename $0`" if [ -f "$COMMON" ]; then source $COMMON @@ -31,24 +32,26 @@ fi APPEND="0" if [[ ! -z "$3" && "$1" == "-a" ]]; then ROOT="$3" - TEMPLATE="$BASE_CONF/$2.template" + search_template $2 --new APPEND="1" elif [[ ! -z "$2" && "$1" == "-a" ]]; then ROOT="/" - TEMPLATE="$BASE_CONF/$2.template" + search_template $2 --new APPEND="1" elif [[ ! -z "$2" ]]; then ROOT="$2" - TEMPLATE="$BASE_CONF/$1.template" + search_template $1 --new elif [[ ! -z "$1" ]]; then - TEMPLATE="$BASE_CONF/$1.template" + search_template $1 --new ROOT="/" else - echo "usage: `basename $0` [-a] <template> [root-dir]" - echo -e "\t-a: append packages into <$BASE_CONF/template.template>" + echo "usage: $BASENAME [-a] <template> [root-dir]" + echo -e "\t-a: append packages into a template" exit 1 fi +TEMPLATE="$BASE_TEMPLATE.template" + if [ ! -d "$ROOT/var/log/packages" ]; then echo $ROOT/var/log/packages: directory not found exit 1 |