opam-graph/packaging/debian/create_package.sh

28 lines
768 B
Bash
Raw Normal View History

2022-07-21 08:22:14 +00:00
#!/bin/sh -e
# only execute anything if either
2022-07-27 08:15:22 +00:00
# - running under orb with package = opam-graph
2022-07-21 08:22:14 +00:00
# - not running under opam at all
if [ "$ORB_BUILDING_PACKAGE" != "opam-graph" -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
debiandir=$rootdir/DEBIAN
trap 'rm -rf $tmpd' 0 INT EXIT
2022-07-27 08:15:22 +00:00
mkdir -p "$debiandir" "$bindir"
2022-07-21 08:22:14 +00:00
install "$bdir/opam-graph" "$bindir/opam-graph"
ARCH=$(dpkg-architecture -q DEB_TARGET_ARCH)
sed -i -e "s/^Architecture:.*/Architecture: ${ARCH}/" "$debiandir"/control
2022-07-27 08:15:22 +00:00
dpkg-deb --build "$rootdir" "$basedir"/opam-graph.deb
echo 'bin: [ "opam-graph.deb" ]' > "$basedir/opam-graph.install"