FreeBSD packaging and rc script
This commit is contained in:
parent
5555c87afd
commit
c2377dedd7
4 changed files with 122 additions and 2 deletions
|
@ -7,9 +7,14 @@ bug-reports: "https://github.com/roburio/builder-web/issues"
|
||||||
license: "ISC"
|
license: "ISC"
|
||||||
|
|
||||||
build: [
|
build: [
|
||||||
["dune" "subst"] {pinned}
|
["dune" "subst"] {dev}
|
||||||
["dune" "build" "-p" name "-j" jobs]
|
["dune" "build" "-p" name "-j" jobs]
|
||||||
["dune" "runtest" "-p" name "-j" jobs] {with-test}
|
["dune" "runtest" "-p" name "-j" jobs] {with-test}
|
||||||
|
["sh" "packaging/FreeBSD/create_package.sh"] {os = "freebsd"}
|
||||||
|
]
|
||||||
|
|
||||||
|
install: [
|
||||||
|
["cp" "builder_web.txz" "%{bin}%/"] {os = "freebsd"}
|
||||||
]
|
]
|
||||||
|
|
||||||
depends: [
|
depends: [
|
||||||
|
@ -37,5 +42,5 @@ depends: [
|
||||||
synopsis: "Web interface for builder"
|
synopsis: "Web interface for builder"
|
||||||
|
|
||||||
pin-depends: [
|
pin-depends: [
|
||||||
["builder.dev" "git+https://git.data.coop/reynir/builder.git"]
|
["builder.dev" "git+https://github.com/roburio/builder.git"]
|
||||||
]
|
]
|
||||||
|
|
27
packaging/FreeBSD/MANIFEST
Normal file
27
packaging/FreeBSD/MANIFEST
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
name: builder_web
|
||||||
|
version: %%VERSION_NUM%%
|
||||||
|
origin: local/builder_web
|
||||||
|
comment: Builder web service
|
||||||
|
www: https://git.robur.io/robur/builder-web
|
||||||
|
maintainer: Robur <team@robur.coop>
|
||||||
|
prefix: /usr/local
|
||||||
|
licenselogic: single
|
||||||
|
licenses: [ISCL]
|
||||||
|
flatsize: %%FLATSIZE%%
|
||||||
|
categories: [local]
|
||||||
|
deps {
|
||||||
|
gmp {
|
||||||
|
origin = "math/gmp";
|
||||||
|
},
|
||||||
|
libev {
|
||||||
|
origin = "devel/libev";
|
||||||
|
},
|
||||||
|
sqlite3 {
|
||||||
|
origin = "databases/sqlite3";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
desc = <<EOD
|
||||||
|
A web server serving and accepting reproducible builds
|
||||||
|
|
||||||
|
EOD;
|
48
packaging/FreeBSD/create_package.sh
Executable file
48
packaging/FreeBSD/create_package.sh
Executable file
|
@ -0,0 +1,48 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
basedir=$(realpath "$(dirname "$0")"/../..)
|
||||||
|
pdir=$basedir/packaging/FreeBSD
|
||||||
|
bdir=$basedir/_build/install/default/bin
|
||||||
|
#tmptmpl=$(basename "$0")
|
||||||
|
#tmpd=$(mktemp -t "$tmptmpl")
|
||||||
|
tmpd=$basedir/_build/stage
|
||||||
|
manifest=$tmpd/+MANIFEST
|
||||||
|
rootdir=$tmpd/rootdir
|
||||||
|
sbindir=$rootdir/usr/local/sbin
|
||||||
|
rcdir=$rootdir/usr/local/etc/rc.d
|
||||||
|
libexecdir=$rootdir/usr/local/libexec
|
||||||
|
|
||||||
|
trap 'rm -rf $tmpd' 0 INT EXIT
|
||||||
|
|
||||||
|
mkdir -p "$rootdir"/usr/local/sbin \
|
||||||
|
"$rootdir"/usr/local/libexec \
|
||||||
|
"$rootdir"/usr/local/etc/rc.d
|
||||||
|
|
||||||
|
# stage service scripts
|
||||||
|
install -U $pdir/rc.d/builder_web $rcdir/builder_web
|
||||||
|
|
||||||
|
# stage app binaries
|
||||||
|
install -U $bdir/builder-web $libexecdir/builder-web
|
||||||
|
|
||||||
|
install -U $bdir/builder-migrations $sbindir/builder-migrations
|
||||||
|
install -U $bdir/builder-db $sbindir/builder-db
|
||||||
|
|
||||||
|
# create +MANIFEST
|
||||||
|
flatsize=$(find "$rootdir" -type f -exec stat -f %z {} + |
|
||||||
|
awk 'BEGIN {s=0} {s+=$1} END {print s}')
|
||||||
|
|
||||||
|
sed -e "s:%%FLATSIZE%%:${flatsize}:" "$pdir/MANIFEST" > "$manifest"
|
||||||
|
|
||||||
|
{
|
||||||
|
printf '\nfiles {\n'
|
||||||
|
find "$rootdir" -type f -exec sha256 -r {} + | sort |
|
||||||
|
awk '{print " " $2 ": \"" $1 "\"," }'
|
||||||
|
find "$rootdir" -type l | sort |
|
||||||
|
awk "{print \" \"\$1 \": -,\"}"
|
||||||
|
printf '}\n'
|
||||||
|
} | sed -e "s:${rootdir}::" >> "$manifest"
|
||||||
|
|
||||||
|
export SOURCE_DATE_EPOCH=$(git log -1 --pretty=format:%ct)
|
||||||
|
pkg create -r "$rootdir" -M "$manifest" -o $basedir/
|
||||||
|
mv $basedir/builder_web-*.txz $basedir/builder_web.txz
|
||||||
|
rm $basedir/builder-web.install
|
40
packaging/FreeBSD/rc.d/builder_web
Executable file
40
packaging/FreeBSD/rc.d/builder_web
Executable file
|
@ -0,0 +1,40 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# $FreeBSD$
|
||||||
|
#
|
||||||
|
# PROVIDE: builder_web
|
||||||
|
# REQUIRE: LOGIN
|
||||||
|
# KEYWORD: shutdown
|
||||||
|
#
|
||||||
|
# Define these builder_web_* variables in one of these files
|
||||||
|
# /etc/rc.conf
|
||||||
|
# /etc/rc.conf.local
|
||||||
|
# /etc/rc.conf.d/builder_web
|
||||||
|
# /usr/local/etc/rc.conf.d/builder_web
|
||||||
|
#
|
||||||
|
# builder_web_flags:
|
||||||
|
# Default: ""
|
||||||
|
#
|
||||||
|
|
||||||
|
. /etc/rc.subr
|
||||||
|
|
||||||
|
name=builder_web
|
||||||
|
rcvar=${name}_enable
|
||||||
|
desc="Builder web service"
|
||||||
|
load_rc_config $name
|
||||||
|
start_cmd="builder_web_start"
|
||||||
|
|
||||||
|
: ${builder_web_enable:="NO"}
|
||||||
|
: ${builder_web_flags:=""}
|
||||||
|
: ${builder_web_user:="builder"}
|
||||||
|
|
||||||
|
pidfile="/var/run/builder_web.pid"
|
||||||
|
procname="/usr/local/libexec/builder-web"
|
||||||
|
|
||||||
|
builder_web_start () {
|
||||||
|
echo "Starting ${name}."
|
||||||
|
/usr/sbin/daemon -S -p "${pidfile}" -u "${builder_web_user}" \
|
||||||
|
"${procname}" ${builder_web_flags}
|
||||||
|
}
|
||||||
|
|
||||||
|
run_rc_command "$1"
|
Loading…
Reference in a new issue