43 lines
999 B
Bash
Executable File
43 lines
999 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
opam init --disable-sandboxing --no-setup
|
|
|
|
eval $(opam env)
|
|
|
|
root=dist/root
|
|
rm -rf $root
|
|
mkdir -p $root/DEBIAN $root/etc $root/usr/lib/systemd/system
|
|
|
|
# build ocaml program
|
|
|
|
opam pin add ./talircd --kind=path --no-action --yes
|
|
opam install talircd --destdir=$root/usr --yes
|
|
|
|
# install helper files
|
|
|
|
install -m 644 talircd/deploy/talircd.service $root/usr/lib/systemd/system
|
|
install -m 644 talircd/deploy/talircd.conf $root/etc
|
|
|
|
# generate package control file
|
|
|
|
pkg=$(opam info talircd -fname)
|
|
ver="$(opam info talircd -fversion)"
|
|
rev=0
|
|
dsc="$(opam info talircd -fdescription)"
|
|
mtr="iitalics"
|
|
arch="$(dpkg-architecture -q DEB_TARGET_ARCH)"
|
|
|
|
control=$root/DEBIAN/control
|
|
|
|
set -x
|
|
|
|
echo "Package: ${pkg}" > $control
|
|
echo "Version: ${ver}" >> $control
|
|
echo "Description: ${dsc}" >> $control
|
|
echo "Maintainer: ${mtr}" >> $control
|
|
echo "Architecture: ${arch}" >> $control
|
|
|
|
# generate .deb
|
|
|
|
dpkg-deb --root-owner-group -b $root "dist/${pkg}_${ver}-${rev}_${arch}.deb"
|