opam-graph/packaging/debian/create_package.sh

33 lines
1,010 B
Bash
Raw Permalink 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"
# 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
2022-07-21 08:22:14 +00:00
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"