create deb package deployment infrastructure
This commit is contained in:
parent
7d8669867c
commit
59b79167a4
|
@ -1,13 +1,32 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
export OPAMROOTISOK=1
|
||||
|
||||
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
|
||||
|
||||
opam pin add ./talircd --kind=path --no-action --yes
|
||||
opam install talircd --destdir=dist
|
||||
opam install talircd --destdir=$root/usr --yes
|
||||
|
||||
pkg=$(opam info talircd -fname)
|
||||
ver="$(opam info talircd -fversion)"
|
||||
rev=0
|
||||
dsc="$(opam info talircd -fdescription)"
|
||||
mtr="iitalics"
|
||||
control=$root/DEBIAN/control
|
||||
|
||||
#opam install talircd --destdir=dist --yes
|
||||
set -x
|
||||
|
||||
echo "Package: ${pkg}" > $control
|
||||
echo "Version: ${ver}" >> $control
|
||||
echo "Description: ${dsc}" >> $control
|
||||
echo "Maintainer: ${mtr}" >> $control
|
||||
echo "Architecture: all" >> $control
|
||||
|
||||
install -m 644 talircd/deploy/talircd.service $root/usr/lib/systemd/system
|
||||
install -m 644 talircd/deploy/talircd.conf $root/etc
|
||||
|
||||
dpkg-deb --root-owner-group -b $root "dist/${pkg}_${ver}-${rev}_all.deb"
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
MACHINE=${MACHINE:-talircd-build}
|
||||
PROJECT_ROOT=${PROJECT_ROOT:-$(git rev-parse --show-toplevel)}
|
||||
DIST_DIR=${DIST_DIR:-${PROJECT_ROOT}/_dist}
|
||||
|
||||
set -x
|
||||
|
||||
mkdir -p "${DIST_DIR}"
|
||||
|
||||
sudo systemd-nspawn -q \
|
||||
--machine ${MACHINE} \
|
||||
--bind-ro ${PROJECT_ROOT}:/root/talircd \
|
||||
--bind ${DIST_DIR}:/root/dist \
|
||||
--chdir /root \
|
||||
/root/talircd/deploy/_run.sh
|
|
@ -8,13 +8,9 @@ DIST_DIR=${DIST_DIR:-${PROJECT_ROOT}/_dist}
|
|||
CODENAME=bullseye
|
||||
MIRROR=${MIRROR:-http://debian.csail.mit.edu/debian/}
|
||||
|
||||
COMMAND=${1:-build}
|
||||
|
||||
set -x
|
||||
|
||||
function init() {
|
||||
# TODO: fakeroot ?
|
||||
|
||||
set -x
|
||||
sudo debootstrap \
|
||||
--include=ocaml-base,ocaml,opam,ca-certificates,git,rsync \
|
||||
--components=main,contrib \
|
||||
|
@ -22,31 +18,43 @@ function init() {
|
|||
}
|
||||
|
||||
function cleanall() {
|
||||
set -x
|
||||
sudo rm -rf ${MACHINE_PATH}
|
||||
}
|
||||
|
||||
function clean() {
|
||||
sudo systemd-nspawn -q \
|
||||
--machine ${MACHINE} \
|
||||
rm -rf /root/.opam
|
||||
}
|
||||
function in_container() {
|
||||
set -x
|
||||
mkdir -p ${DIST_DIR}
|
||||
|
||||
function build() {
|
||||
sudo systemd-nspawn -q \
|
||||
--machine ${MACHINE} \
|
||||
--bind-ro ${PROJECT_ROOT}:/root/talircd \
|
||||
--bind ${DIST_DIR}:/root/dist \
|
||||
--chdir /root \
|
||||
/root/talircd/deploy/_build.sh
|
||||
--bind ${DIST_DIR}:/root/dist:rootidmap \
|
||||
-E OPAMROOTISOK=1 \
|
||||
"$@"
|
||||
}
|
||||
|
||||
case $1 in
|
||||
function clean() {
|
||||
rm -rf ${DIST_DIR}/root
|
||||
in_container rm -rf /root/.opam
|
||||
}
|
||||
|
||||
function build() {
|
||||
in_container --chdir /root /root/talircd/deploy/_build.sh
|
||||
}
|
||||
|
||||
function shell() {
|
||||
in_container
|
||||
}
|
||||
|
||||
case ${1:-build} in
|
||||
init) init ;;
|
||||
build) build ;;
|
||||
clean) clean ;;
|
||||
cleanall) cleanall ;;
|
||||
shell) shell ;;
|
||||
*)
|
||||
echo "$1"
|
||||
echo "invalid command $1"
|
||||
esac
|
||||
|
||||
# mkdir -p "${DIST_DIR}"
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
IRC_MOTD=/usr/share/talircd/motd
|
||||
IRC_HOSTNAME=irc.tali.software
|
||||
IRC_PORT=6667
|
||||
LOG_LEVEL=debug
|
|
@ -0,0 +1,9 @@
|
|||
[Unit]
|
||||
Description=tali IRCd
|
||||
ConditionPathExists=/etc/talircd.conf
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
ExecStart=/usr/bin/talircd
|
||||
KillSignal=SIGTERM
|
||||
EnvironmentFile=/etc/talircd.conf
|
|
@ -0,0 +1,4 @@
|
|||
(install
|
||||
(package talircd)
|
||||
(files (motd.txt as motd))
|
||||
(section share))
|
|
@ -1,12 +0,0 @@
|
|||
[Unit]
|
||||
Description=tali IRCd
|
||||
|
||||
[Service]
|
||||
Environment=IRC_HOSTNAME=irc.tali.software
|
||||
Environment=IRC_MOTD=/usr/local/share/talircd/motd
|
||||
#Environment=IRC_PORT=6667
|
||||
#Environment=LOG_LEVEL=DEBUG
|
||||
|
||||
Type=notify
|
||||
KillSignal=SIGTERM
|
||||
ExecStart=/usr/local/bin/talircd
|
Loading…
Reference in New Issue