mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 03:53:32 +01:00
create-mkdebian.sh: Re-add create-mkdebian.sh
pkg.sh's operating system abstraction doesn't make much sense with the debian compatibilty script removed, so add it back. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
3842e98e11
commit
7a315442d4
1 changed files with 159 additions and 0 deletions
159
scripts/create-mkdebian.sh
Normal file
159
scripts/create-mkdebian.sh
Normal file
|
|
@ -0,0 +1,159 @@
|
|||
#!/bin/bash
|
||||
|
||||
cfg_section()
|
||||
{
|
||||
ini_section "$inifile" $@
|
||||
}
|
||||
|
||||
cfg_value()
|
||||
{
|
||||
ini_value "$inifile" $@
|
||||
}
|
||||
|
||||
# -- here we go
|
||||
|
||||
echo "== running $0" "$@" >&2
|
||||
|
||||
export LANG=POSIX
|
||||
dir=`dirname $0`
|
||||
inifile="$1"
|
||||
. $dir/ini-tools.sh
|
||||
|
||||
cat << EOT
|
||||
format_depends()
|
||||
{
|
||||
echo "\$@" | sed 's/ */,/g; s/,\([><=]\+\),*/\1/g; s/, *,*/,/g; s/, *$//; s/^ *,//; s/\([><=]\+\)\([0-9.-]\+\)/ (\1\2) /g'
|
||||
}
|
||||
|
||||
#changelog()
|
||||
#{
|
||||
# #dch -c /dev/stdout --create -v \$VERSION-\$RELEASE --package \$NAME
|
||||
#cat << EOF
|
||||
#\$NAME (\$VERSION-\$RELEASE) UNRELEASED; urgency=medium
|
||||
#
|
||||
# * Initial release. (Closes: #XXXXXX)
|
||||
#
|
||||
# -- Jan Lindemann <jan@janware.com> `date -R`
|
||||
#
|
||||
#EOF
|
||||
#}
|
||||
|
||||
compat()
|
||||
{
|
||||
echo -n 9
|
||||
}
|
||||
|
||||
control()
|
||||
{
|
||||
cat << EOF
|
||||
Source: \$NAME
|
||||
Maintainer: Jan Lindemann <jan@janware.com>
|
||||
Section: `cfg_value global.group`
|
||||
Priority: optional
|
||||
Standards-Version: 3.9.2
|
||||
Build-Depends: debhelper (>= 9)
|
||||
EOT
|
||||
|
||||
cfg_value global.subpackages | grep -q run && cat << EOT
|
||||
|
||||
Package: \$NAME-run
|
||||
Architecture: any
|
||||
Depends: \`format_depends "\${shlibs:Depends}, \${misc:Depends}, \$REQUIRES_RUN"\`
|
||||
# untested:
|
||||
Conflicts: \`format_depends "\$CONFLICTS_RUN"\`
|
||||
Description: `cfg_value summary`
|
||||
`cfg_value description | sed 's/^/ /'`
|
||||
EOT
|
||||
|
||||
cfg_value global.subpackages | grep -q devel && cat << EOT
|
||||
|
||||
Package: \$NAME-devel
|
||||
Architecture: any
|
||||
Depends: \`format_depends "\$NAME-run = \$VERSION-\$RELEASE, \$REQUIRES_DEVEL"\`
|
||||
# untested:
|
||||
Conflicts: \`format_depends "\$CONFLICTS_DEVEL"\`
|
||||
Description: \$NAME Development Package
|
||||
Development tools for \$NAME-run
|
||||
EOT
|
||||
|
||||
cat << EOT
|
||||
EOF
|
||||
}
|
||||
|
||||
copyright()
|
||||
{
|
||||
echo -n "Copyright (c) `date +'%Y'`, janware GmbH"
|
||||
}
|
||||
|
||||
format()
|
||||
{
|
||||
echo "3.0 (quilt)"
|
||||
}
|
||||
|
||||
rules()
|
||||
{
|
||||
cat << "EOF"
|
||||
#!/usr/bin/make -f
|
||||
|
||||
# tip from https://pkg-perl.alioth.debian.org/debhelper.html
|
||||
# PACKAGE = \$(firstword \$(shell dh_listpackages))
|
||||
# TMP = \$(CURDIR)/debian/\$(PACKAGE)
|
||||
|
||||
NAME = \$(shell pwd | xargs basename | sed 's/-[0-9.-]\+//')
|
||||
DEB_DIR = \$\$(pwd)/debian
|
||||
ENV_PREFIX = \$\$(pwd)/debian/tmp/inst-root
|
||||
EOF
|
||||
|
||||
echo INSTALL_LOG = \$INSTALL_LOG
|
||||
|
||||
cat << "EOF"
|
||||
%:
|
||||
EOF
|
||||
echo -e "\tdh \$""@"
|
||||
cat << EOF
|
||||
|
||||
override_dh_auto_test:
|
||||
|
||||
override_dh_installdirs:
|
||||
@echo "running override_dh_installdirs ($@)"
|
||||
#dh_installdirs
|
||||
|
||||
override_dh_auto_install:
|
||||
@echo "running override_dh_auto_install ($@)"
|
||||
mkdir -p \`dirname \$INSTALL_LOG\`
|
||||
> \$INSTALL_LOG
|
||||
\\\$(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)
|
||||
dh_installdirs
|
||||
|
||||
override_dh_install:
|
||||
dh_install --sourcedir=./debian/tmp/inst-root
|
||||
|
||||
override_dh_shlibdeps:
|
||||
LD_LIBRARY_PATH=lib:\\\$(LD_LIBRARY_PATH) dh_shlibdeps
|
||||
|
||||
override_dh_auto_clean:
|
||||
|
||||
override_dh_compress:
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
mkdir -p debian
|
||||
#dch --create --empty
|
||||
cd debian
|
||||
|
||||
for file in compat control copyright format rules; do
|
||||
test -e \$file && continue
|
||||
\$file > \$file
|
||||
done
|
||||
|
||||
chmod 755 rules
|
||||
|
||||
cd ..
|
||||
|
||||
dch --create --newversion \$VERSION-\$RELEASE --controlmaint --package \$NAME --force-distribution --distribution \$DISTRIBUTION "Release built by $0"
|
||||
|
||||
echo "Produced by $0, the output should be in the \"debian\" sub-directory."
|
||||
EOT
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue