mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 12:03:31 +01:00
pkg.sh: Add support for -D to pkg.sh log-install
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
7a533561a4
commit
9f336078c5
1 changed files with 21 additions and 3 deletions
|
|
@ -581,6 +581,20 @@ cmd_upload()
|
|||
upload_pkg
|
||||
}
|
||||
|
||||
check_create_parent()
|
||||
{
|
||||
[ "$1" != "true" ] && return 0
|
||||
local dir=`dirname -z "$2" | xargs -0 realpath -m`
|
||||
local path=`realpath -m "$2"`
|
||||
if [ "$dir" -a "$dir" != "$path" ]; then
|
||||
mkdir -p "$dir" || {
|
||||
echo "failed to create parent dir of \"$1\""
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
cmd_log_install()
|
||||
{
|
||||
local args="$*"
|
||||
|
|
@ -588,6 +602,7 @@ cmd_log_install()
|
|||
local c_format=rpm
|
||||
local c_logfile=install.log
|
||||
local c_mode_dir=false
|
||||
local c_create_leading_dirs=false
|
||||
local c_group=`id -gn`
|
||||
local c_owner=`whoami`
|
||||
local c_suffix=
|
||||
|
|
@ -595,7 +610,7 @@ cmd_log_install()
|
|||
local c_opmode=opmode_install
|
||||
local c_absolute=0
|
||||
|
||||
set -- `getopt 'Li:a:f:l:bg:cdm:o:psS:vA' $*`
|
||||
set -- `getopt 'DLi:a:f:l:bg:cdm:o:psS:vA' $*`
|
||||
|
||||
cfgfile_macro()
|
||||
{
|
||||
|
|
@ -627,7 +642,7 @@ cmd_log_install()
|
|||
-d)
|
||||
c_mode_dir=true;;
|
||||
-D)
|
||||
;;
|
||||
c_create_leading_dirs=true;;
|
||||
-g)
|
||||
c_group=$2
|
||||
shift;;
|
||||
|
|
@ -673,9 +688,11 @@ cmd_log_install()
|
|||
|
||||
opmode_install)
|
||||
if [ -L "$c_source" ]; then
|
||||
check_create_parent $c_create_leading_dirs $c_target
|
||||
cp -d $c_source $c_target || exit $?
|
||||
else
|
||||
install $args || exit $?
|
||||
[ "$c_create_leading_dirs" ] && local opts=-D
|
||||
install $opts $args || exit $?
|
||||
fi
|
||||
;;
|
||||
|
||||
|
|
@ -690,6 +707,7 @@ cmd_log_install()
|
|||
else
|
||||
c_source=`basename $c_source`
|
||||
fi
|
||||
check_create_parent $c_create_leading_dirs $c_target
|
||||
cd `dirname $c_target`
|
||||
ln -sf $c_source `basename $c_target`
|
||||
;;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue