diff --git a/builder-web.opam b/builder-web.opam index 365a27e..7819bd7 100644 --- a/builder-web.opam +++ b/builder-web.opam @@ -7,9 +7,14 @@ bug-reports: "https://github.com/roburio/builder-web/issues" license: "ISC" build: [ - ["dune" "subst"] {pinned} + ["dune" "subst"] {dev} ["dune" "build" "-p" name "-j" jobs] ["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: [ @@ -37,5 +42,5 @@ depends: [ synopsis: "Web interface for builder" pin-depends: [ - ["builder.dev" "git+https://git.data.coop/reynir/builder.git"] + ["builder.dev" "git+https://github.com/roburio/builder.git"] ] diff --git a/packaging/FreeBSD/MANIFEST b/packaging/FreeBSD/MANIFEST new file mode 100644 index 0000000..ee73d59 --- /dev/null +++ b/packaging/FreeBSD/MANIFEST @@ -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 +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 = < "$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 diff --git a/packaging/FreeBSD/rc.d/builder_web b/packaging/FreeBSD/rc.d/builder_web new file mode 100755 index 0000000..b1cc177 --- /dev/null +++ b/packaging/FreeBSD/rc.d/builder_web @@ -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"