builder-web/packaging/debian/create_package.sh

40 lines
1.3 KiB
Bash
Raw Normal View History

2021-06-29 09:34:58 +00:00
#!/bin/sh -e
# only execute anything if either
# - running under orb with package = builder-web
# - not running under opam at all
if [ "$ORB_BUILDING_PACKAGE" != "builder-web" -a "$OPAM_PACKAGE_NAME" != "" ]; then
exit 0;
fi
basedir=$(realpath "$(dirname "$0")"/../..)
bdir=$basedir/_build/install/default/bin
tmpd=$basedir/_build/stage
rootdir=$tmpd/rootdir
bindir=$rootdir/usr/bin
systemddir=$rootdir/usr/lib/systemd/system
debiandir=$rootdir/DEBIAN
trap 'rm -rf $tmpd' 0 INT EXIT
mkdir -p "$bindir" "$debiandir" "$systemddir"
# stage app binaries
install $bdir/builder-web $bindir/builder-web
install $bdir/builder-migrations $bindir/builder-migrations
install $bdir/builder-db $bindir/builder-db
install $bdir/builder-viz $bindir/builder-viz
2021-06-29 09:34:58 +00:00
# service script
install -m 0644 $basedir/packaging/debian/builder-web.service $systemddir/builder-web.service
2021-06-29 09:34:58 +00:00
# install debian metadata
install -m 0644 $basedir/packaging/debian/control $debiandir/control
install -m 0644 $basedir/packaging/debian/changelog $debiandir/changelog
install -m 0644 $basedir/packaging/debian/copyright $debiandir/copyright
2021-11-12 10:18:40 +00:00
install $basedir/packaging/debian/postinst $debiandir/postinst
2021-06-29 09:34:58 +00:00
dpkg-deb --build $rootdir $basedir/builder-web.deb
echo 'bin: [ "builder-web.deb" ]' > $basedir/builder-web.install
2021-06-30 14:14:26 +00:00
echo 'doc: [ "README.md" ]' >> $basedir/builder-web.install