mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 03:53:32 +01:00
pkg.sh: Add option -W to log-install
This is like log-install -W, except that it installs a wrapper script instead of a link for executables Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
8f005bfb9a
commit
a4ef394a95
1 changed files with 41 additions and 2 deletions
|
|
@ -598,6 +598,37 @@ upload_pkg()
|
|||
fi
|
||||
}
|
||||
|
||||
install_exe_wrapper()
|
||||
{
|
||||
local from="`realpath $1`"
|
||||
local to="$2"
|
||||
local ext=${from##*.}
|
||||
local tmp=$to.tmp
|
||||
|
||||
case $ext in
|
||||
py)
|
||||
echo -e "#!/bin/bash\nexec /usr/bin/python \"$from\"" \"$to\" > "$tmp"
|
||||
;;
|
||||
pl)
|
||||
echo -e "#!/bin/bash\nexec /usr/bin/perl \"$from\"" \"$to\" > "$tmp"
|
||||
;;
|
||||
sh)
|
||||
echo -e "#!/bin/bash\n. \"$from\"" \"$to\" > "$tmp"
|
||||
;;
|
||||
*)
|
||||
if file "$from" | grep -qi executable; then
|
||||
echo -e "#!/bin/bash\n. \"$from\"" \"$to\" > "$tmp"
|
||||
else
|
||||
ln -sf $from $to
|
||||
return
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
chmod 755 "$tmp"
|
||||
mv "$tmp" $to
|
||||
}
|
||||
|
||||
cmd_build()
|
||||
{
|
||||
build_pkg
|
||||
|
|
@ -636,8 +667,9 @@ cmd_log_install()
|
|||
local c_prefix=
|
||||
local c_opmode=opmode_install
|
||||
local c_absolute=0
|
||||
local c_wrap=0
|
||||
|
||||
set -- `getopt 'DLi:a:f:l:bg:cdm:o:psS:vA' $*`
|
||||
set -- `getopt 'DLWi:a:f:l:bg:cdm:o:psS:vA' $*`
|
||||
|
||||
cfgfile_macro()
|
||||
{
|
||||
|
|
@ -690,6 +722,9 @@ cmd_log_install()
|
|||
;;
|
||||
-L)
|
||||
c_opmode=opmode_link;;
|
||||
-W)
|
||||
c_opmode=opmode_link
|
||||
c_wrap=1;;
|
||||
-A)
|
||||
c_absolute=1;;
|
||||
*)
|
||||
|
|
@ -736,7 +771,11 @@ cmd_log_install()
|
|||
fi
|
||||
check_create_parent $c_create_leading_dirs $c_target
|
||||
cd `dirname $c_target`
|
||||
ln -sf $c_source `basename $c_target`
|
||||
if [ "$c_wrap" = 1 ]; then
|
||||
install_exe_wrapper $c_source $c_target
|
||||
else
|
||||
ln -sf $c_source `basename $c_target`
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue