mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-29 16:02:49 +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
|
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()
|
cmd_log_install()
|
||||||
{
|
{
|
||||||
local args="$*"
|
local args="$*"
|
||||||
|
|
@ -588,6 +602,7 @@ cmd_log_install()
|
||||||
local c_format=rpm
|
local c_format=rpm
|
||||||
local c_logfile=install.log
|
local c_logfile=install.log
|
||||||
local c_mode_dir=false
|
local c_mode_dir=false
|
||||||
|
local c_create_leading_dirs=false
|
||||||
local c_group=`id -gn`
|
local c_group=`id -gn`
|
||||||
local c_owner=`whoami`
|
local c_owner=`whoami`
|
||||||
local c_suffix=
|
local c_suffix=
|
||||||
|
|
@ -595,7 +610,7 @@ cmd_log_install()
|
||||||
local c_opmode=opmode_install
|
local c_opmode=opmode_install
|
||||||
local c_absolute=0
|
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()
|
cfgfile_macro()
|
||||||
{
|
{
|
||||||
|
|
@ -627,7 +642,7 @@ cmd_log_install()
|
||||||
-d)
|
-d)
|
||||||
c_mode_dir=true;;
|
c_mode_dir=true;;
|
||||||
-D)
|
-D)
|
||||||
;;
|
c_create_leading_dirs=true;;
|
||||||
-g)
|
-g)
|
||||||
c_group=$2
|
c_group=$2
|
||||||
shift;;
|
shift;;
|
||||||
|
|
@ -673,9 +688,11 @@ cmd_log_install()
|
||||||
|
|
||||||
opmode_install)
|
opmode_install)
|
||||||
if [ -L "$c_source" ]; then
|
if [ -L "$c_source" ]; then
|
||||||
|
check_create_parent $c_create_leading_dirs $c_target
|
||||||
cp -d $c_source $c_target || exit $?
|
cp -d $c_source $c_target || exit $?
|
||||||
else
|
else
|
||||||
install $args || exit $?
|
[ "$c_create_leading_dirs" ] && local opts=-D
|
||||||
|
install $opts $args || exit $?
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
@ -690,6 +707,7 @@ cmd_log_install()
|
||||||
else
|
else
|
||||||
c_source=`basename $c_source`
|
c_source=`basename $c_source`
|
||||||
fi
|
fi
|
||||||
|
check_create_parent $c_create_leading_dirs $c_target
|
||||||
cd `dirname $c_target`
|
cd `dirname $c_target`
|
||||||
ln -sf $c_source `basename $c_target`
|
ln -sf $c_source `basename $c_target`
|
||||||
;;
|
;;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue