jw-pkg compile-templates: Support options -ogm

Make jw-pkg compile-templates support options -o owner, -g group
and -m mode

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2018-11-11 12:27:23 +00:00
commit 2e42b36728

View file

@ -46,23 +46,6 @@ EOT
[ "$1" ] && exit $1
}
get_opts()
{
set -- `getopt $opts $*`
while [ "$1" != -- ] ; do
case "$1" in
-v)
opt_verbose=true
;;
*)
eusage
;;
esac
shift
done
shift
}
create_ldconfig_state()
{
echo "=== automatically created by $myname update script"
@ -185,9 +168,29 @@ cmd_compile_templates()
local mode=600
local conf_patt="^[ ]*# *conf:"
# TODO: allow default target file attributes to be specified in options
umask 0077
while [ ${1:0:1} = '-' ]; do
case "$1" in
-o)
owner="$2"
shift
;;
-m)
mode="$2"
shift
;;
-g)
group="$2"
shift
;;
*)
usage 1
;;
esac
shift
done
local f
cmd_list_templates "$@" | while read f; do
local base=`echo $f | sed "s/$ext_from_re$//"`
@ -227,9 +230,21 @@ longname=$0
opts="v"
template_exts=".jw-tmpl"
while [ ${1:0:1} = '-' ]; do
case "$1" in
-v)
opt_verbose=true
shift
;;
*)
usage 1
;;
esac
shift
done
cmd="$1"
shift
get_opts $*
case $cmd in
@ -313,5 +328,4 @@ help)
*)
usage 1
;;
esac