Index: sysutils/Makefile =================================================================== --- sysutils/Makefile +++ sysutils/Makefile @@ -587,6 +587,7 @@ SUBDIR += kiconvtool SUBDIR += kldfind SUBDIR += kldpatch + SUBDIR += kleene-daemon SUBDIR += kopia SUBDIR += kops SUBDIR += kpmcore Index: sysutils/kleene-daemon/Makefile =================================================================== --- /dev/null +++ sysutils/kleene-daemon/Makefile @@ -0,0 +1,90 @@ +PORTNAME= kleene-daemon +DISTVERSIONPREFIX= v +DISTVERSION= 0.1.0 +DISTVERSIONSUFFIX= -rc.2 +CATEGORIES= sysutils + +MASTER_SITES+= https://builds.hex.pm/installs/1.16.0/:hex +DISTFILES+= hex-${_HEXPM_VERSION}.ez:hex + +MAINTAINER= lasse@philomath.dk +COMMENT= Kleene backend daemon for managing containers on FreeBSD +WWW= https://kleene.dev + +LICENSE= APACHE20 BSD2CLAUSE +LICENSE_COMB= multi + +BUILD_DEPENDS= ca_root_nss>0:security/ca_root_nss \ + mix:lang/elixir \ + rebar3:devel/rebar3 + +USES= gmake ssl +USE_GITHUB= yes + +GH_ACCOUNT= kleene-project +GH_PROJECT= kleened +# not required once kleene tags their RC +GH_TUPLE= kleene-project:kleened:6a67380:DEFAULT +USE_RC_SUBR= kleened + +MAKE_ENV+= ERL_LIBS='' \ + HEX_HOME=${WRKDIR}/.hex \ + HEX_OFFLINE=true \ + LANG=en_US_UTF-8 \ + LC_ALL=en_US.UTF-8 \ + MIX_ARCHIVES=${WRKDIR} \ + MIX_ENV=prod \ + MIX_HOME=${WRKDIR}/.mix \ + MIX_PATH=${WRKDIR}/.mix/archives/hex-${_HEXPM_VERSION}/hex-${_HEXPM_VERSION}/ebin \ + MIX_REBAR3=${LOCALBASE}/bin/rebar3 + +ETCDIR= ${PREFIX}/etc/kleened +SUB_FILES= pkg-message + +_HEXPM_VERSION= 2.1.1 +_HEX_DIR= ${WRKDIR}/.mix/archives/hex-${_HEXPM_VERSION} +_RELEASE_PATH= ${WRKSRC}/_build/prod/rel/kleened +_RELEASE_BINARIES= escript dialyzer erlexec beam.smp heart dyn_erl to_erl \ + erlc epmd run_erl typer inet_gethost erl_child_setup \ + ct_run erl_call yielding_c_fun + +.include + +post-extract: + ${MKDIR} ${_HEX_DIR} + ${MV} ${WRKDIR}/hex-* \ + ${_HEX_DIR}/ + +do-build: + (cd ${WRKSRC} && \ + env ${MAKE_ENV} ${LOCALBASE}/bin/mix do deps.compile, compile, \ + release) + +do-install: +# sample configs + ${MKDIR} ${STAGEDIR}${ETCDIR} + ${INSTALL_DATA} ${WRKSRC}/example/kleened_config.yaml \ + ${STAGEDIR}${ETCDIR}/config.yaml.sample + ${INSTALL_DATA} ${WRKSRC}/example/pf.conf.kleene \ + ${STAGEDIR}${ETCDIR}/pf.conf.kleene.sample +# the release + ${CP} -a ${WRKSRC}/_build/prod/rel/kleened ${STAGEDIR}${PREFIX}/libexec/ + ${INSTALL_PROGRAM} ${WRKSRC}/priv/bin/kleened_pty \ + ${STAGEDIR}${PREFIX}/libexec/kleened/bin/ + ${RM} ${STAGEDIR}${PREFIX}/libexec/kleened/bin/*.src +# strip binaries and objects + ${FIND} ${STAGEDIR}${PREFIX}/libexec/kleened/lib -type f -name \ + *.so -exec ${STRIP_CMD} {} \; +.for bin in ${_RELEASE_BINARIES} + ${STRIP_CMD} ${STAGEDIR}${PREFIX}/libexec/kleened/erts-*/bin/${bin} +.endfor + +post-install: + @cd ${STAGEDIR}${PREFIX} && \ + ${FIND} libexec/kleened/erts-* -type f -o -type l | \ + ${SORT} >> ${TMPPLIST} + @cd ${STAGEDIR}${PREFIX} && \ + ${FIND} libexec/kleened/lib/* -type f -o -type l | \ + ${SORT} >> ${TMPPLIST} + +.include Index: sysutils/kleene-daemon/distinfo =================================================================== --- /dev/null +++ sysutils/kleene-daemon/distinfo @@ -0,0 +1,5 @@ +TIMESTAMP = 1739535462 +SHA256 (hex-2.1.1.ez) = 59c163c3e4efe4bdbb7029cd494e30c09b87beebc99359c175960cc4101beada +SIZE (hex-2.1.1.ez) = 777696 +SHA256 (kleene-project-kleened-v0.1.0-rc.2-6a67380_GH0.tar.gz) = 1b2c8f859b1453f4a86735094f67eebe3d62713c4ff1bfea4f708f525b87f1ac +SIZE (kleene-project-kleened-v0.1.0-rc.2-6a67380_GH0.tar.gz) = 5048873 Index: sysutils/kleene-daemon/files/kleened.in =================================================================== --- /dev/null +++ sysutils/kleene-daemon/files/kleened.in @@ -0,0 +1,43 @@ +#!/bin/sh +# +# PROVIDE: kleened +# REQUIRE: LOGIN +# KEYWORD: shutdown +# +# Add this line to /etc/rc.conf.local or /etc/rc.conf +# to enable this service: +# +# kleened_enable (bool): Set to NO by default. +# Set it to YES to enable doormand. + +. /etc/rc.subr +name=kleened +rcvar=kleened_enable +extra_commands="init dryinit" + +LANG=en_US.UTF-8 +LC_ALL=en_US.UTF-8 +PATH="%%PREFIX%%/libexec/kleened/bin:${PATH}" + +command="%%PREFIX%%/libexec/kleened/bin/kleened" + +pidfile="/var/run/kleened.pid" +procname="$(/usr/bin/find %%PREFIX%%/libexec/kleened/erts-* -depth 1 -type d)/beam.smp" +start_cmd="${command} daemon" +init_cmd="kleened_init" +dryinit_cmd="kleened_dryinit" + +load_rc_config $name +: ${kleened_enable:=no} + +kleened_init() +{ + %%PREFIX%%/libexec/kleened/bin/kleened eval "Kleened.Core.Config.initialize_host(%{dry_run: false})" +} + +kleened_dryinit() +{ + %%PREFIX%%/libexec/kleened/bin/kleened eval "Kleened.Core.Config.initialize_host(%{dry_run: true})" +} + +run_rc_command "$1" Index: sysutils/kleene-daemon/files/pkg-message.in =================================================================== --- /dev/null +++ sysutils/kleene-daemon/files/pkg-message.in @@ -0,0 +1,33 @@ +[ +{ type: install + message: <