mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-24 09:13:37 +02:00
pkg.sh: Evaluate pkg.run on Debian
pkg.run is not evaluated on Debian, fix that. For now it's hacked into pkg.sh, which is bound to be replaced by Python. The limited hassle is still worth the detour. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
a0b166748a
commit
ca7a5a5265
2 changed files with 74 additions and 24 deletions
|
|
@ -128,7 +128,7 @@ _cat <<- EOT
|
||||||
| mkdir -p \`dirname \$INSTALL_LOG\`
|
| mkdir -p \`dirname \$INSTALL_LOG\`
|
||||||
| > \$INSTALL_LOG
|
| > \$INSTALL_LOG
|
||||||
| \\\$(MAKE) ENV_PREFIX=\\\$(ENV_PREFIX) INSTALL_LOG=\\\$(INSTALL_LOG) install
|
| \\\$(MAKE) ENV_PREFIX=\\\$(ENV_PREFIX) INSTALL_LOG=\\\$(INSTALL_LOG) install
|
||||||
| PATH=$JWB_SCRIPT_DIR:\\\$(PATH) /bin/bash pkg.sh milk-install-log -p \\\$(ENV_PREFIX) -n \\\$(NAME) -t deb \$INSTALL_LOG \\\$(DEB_DIR)
|
| PATH=$JWB_SCRIPT_DIR:\\\$(PATH) /bin/bash pkg.sh -m $JWB_SCRIPT_DIR milk-install-log -p \\\$(ENV_PREFIX) -n \\\$(NAME) -t deb \$INSTALL_LOG \\\$(DEB_DIR)
|
||||||
| dh_installdirs
|
| dh_installdirs
|
||||||
|
|
|
|
||||||
|override_dh_install:
|
|override_dh_install:
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,21 @@ os()
|
||||||
/bin/bash $JWB_SCRIPT_DIR/get-os.sh
|
/bin/bash $JWB_SCRIPT_DIR/get-os.sh
|
||||||
}
|
}
|
||||||
|
|
||||||
|
os_cascade()
|
||||||
|
{
|
||||||
|
/usr/bin/python3 $JWB_SCRIPT_DIR/jw-pkg.py projects os-cascade
|
||||||
|
}
|
||||||
|
|
||||||
|
cfg_section()
|
||||||
|
{
|
||||||
|
ini_section "$inifile" $@
|
||||||
|
}
|
||||||
|
|
||||||
|
cfg_escape()
|
||||||
|
{
|
||||||
|
sed 's/\\/\\\\/g; s/\$/\\$/g; s/`/\\`/g'
|
||||||
|
}
|
||||||
|
|
||||||
scm_commit()
|
scm_commit()
|
||||||
{
|
{
|
||||||
case $SCM in
|
case $SCM in
|
||||||
|
|
@ -941,15 +956,6 @@ cmd_milk_install_log()
|
||||||
echo "$*" | sed "s/.*attr(\(LINK\|[0-9]\+\),\([^,]\+\),\([^,)]\+\)).*/\\$attr/"
|
echo "$*" | sed "s/.*attr(\(LINK\|[0-9]\+\),\([^,]\+\),\([^,)]\+\)).*/\\$attr/"
|
||||||
}
|
}
|
||||||
|
|
||||||
milk_install_log_init_postinst()
|
|
||||||
{
|
|
||||||
cat <<- EOT > $1
|
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
EOT
|
|
||||||
chmod 755 $1
|
|
||||||
}
|
|
||||||
|
|
||||||
cat_log()
|
cat_log()
|
||||||
{
|
{
|
||||||
cat $in | sed '
|
cat $in | sed '
|
||||||
|
|
@ -1048,20 +1054,61 @@ cmd_milk_install_log()
|
||||||
cat_log | grep "%config" | cleanup_line_deb | grep -ve $filter_devel > $out/conffiles.$name-run
|
cat_log | grep "%config" | cleanup_line_deb | grep -ve $filter_devel > $out/conffiles.$name-run
|
||||||
cat_log | grep "%config" | cleanup_line_deb | grep -e $filter_devel > $out/conffiles.$name-devel
|
cat_log | grep "%config" | cleanup_line_deb | grep -e $filter_devel > $out/conffiles.$name-devel
|
||||||
|
|
||||||
|
# Create maintainer scripts
|
||||||
for p in run devel; do
|
for p in run devel; do
|
||||||
postinst=$out/$name-$p.postinst
|
|
||||||
milk_install_log_init_postinst $postinst
|
local stage
|
||||||
cat $out/$name-$p.dirs $out/$name-$p.install | grep . | while read file dir; do
|
for stage in pre preun post postun; do
|
||||||
#echo read file \"$file\" >&2
|
|
||||||
file=`echo /$file | sed 's/inst-root\///; s%^//*%/%'`
|
case $stage in
|
||||||
#echo file is now \"$file\" >&2
|
pre) deb_stage=preinst;;
|
||||||
#echo grep \"$prefix/*$file$\" $in >&2
|
post) deb_stage=postinst;;
|
||||||
line=`grep $file$ $in`
|
preun) deb_stage=prerm;;
|
||||||
perm=`milk_install_log_spec_attr 1 "$line"`
|
postun) deb_stage=postrm;;
|
||||||
owner=`milk_install_log_spec_attr 2 "$line"`
|
esac
|
||||||
group=`milk_install_log_spec_attr 3 "$line"`
|
local script=$out/$name-$p.$deb_stage
|
||||||
echo "chown $owner:$group $file" >> $postinst
|
|
||||||
[ "$perm" = "LINK" ] || echo "chmod $perm $file" >> $postinst
|
cat <<- EOT > $script
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
EOT
|
||||||
|
chmod 755 $script
|
||||||
|
|
||||||
|
case $stage in
|
||||||
|
post)
|
||||||
|
cat $out/$name-$p.dirs $out/$name-$p.install | grep . | while read file dir; do
|
||||||
|
#echo read file \"$file\" >&2
|
||||||
|
file=`echo /$file | sed 's/inst-root\///; s%^//*%/%'`
|
||||||
|
#echo file is now \"$file\" >&2
|
||||||
|
#echo grep \"$prefix/*$file$\" $in >&2
|
||||||
|
line=`grep $file$ $in`
|
||||||
|
perm=`milk_install_log_spec_attr 1 "$line"`
|
||||||
|
owner=`milk_install_log_spec_attr 2 "$line"`
|
||||||
|
group=`milk_install_log_spec_attr 3 "$line"`
|
||||||
|
echo "chown $owner:$group $file" >> $script
|
||||||
|
[ "$perm" = "LINK" ] || echo "chmod $perm $file" >> $script
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo "== processing stage $stage: cfg_section pkg.$p.$stage" >&2
|
||||||
|
local os content=""
|
||||||
|
for os in '' `os_cascade`; do
|
||||||
|
local sec=pkg.$p.$stage head=""
|
||||||
|
if [ "$os" ]; then
|
||||||
|
sec="$sec.$os"
|
||||||
|
head="\n# --- $os\n"
|
||||||
|
fi
|
||||||
|
cfg_section $sec | grep -q . || continue
|
||||||
|
content="$content$head`cfg_section $sec`"
|
||||||
|
done
|
||||||
|
if [ "$content" ]; then
|
||||||
|
echo -e "$content" >&2
|
||||||
|
echo -e "\n$content" | cfg_escape >> $script
|
||||||
|
fi
|
||||||
|
cat $script | grep -v '^#!/bin\|^$' | grep -q . || rm $script
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
|
|
@ -1168,9 +1215,12 @@ while [ ${1:0:1} = - ]; do
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
[ "$JWB_SCRIPT_DIR" ] || JWB_SCRIPT_DIR=`dirname $0`
|
[ "$JWB_SCRIPT_DIR" ] || JWB_SCRIPT_DIR="$(dirname $0)"
|
||||||
[ "$PROJECT" ] || PROJECT=`abspath $TOPDIR | xargs basename`
|
[ "$PROJECT" ] || PROJECT=`abspath $TOPDIR | xargs basename`
|
||||||
|
|
||||||
|
inifile=$PROJECT_DESCR_FILE
|
||||||
|
. $JWB_SCRIPT_DIR/ini-tools.sh
|
||||||
|
|
||||||
cmd=$1
|
cmd=$1
|
||||||
shift
|
shift
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue