Index: sysutils/nomad/Makefile =================================================================== --- sysutils/nomad/Makefile (revision 510384) +++ sysutils/nomad/Makefile (working copy) @@ -3,6 +3,7 @@ PORTNAME= nomad DISTVERSIONPREFIX= v DISTVERSION= 0.9.5 +PORTREVISION= 1 CATEGORIES= sysutils MAINTAINER= jhixson@FreeBSD.org @@ -18,24 +19,44 @@ USE_GITHUB= yes GH_ACCOUNT= hashicorp GH_SUBDIR= src/github.com/hashicorp/nomad -USE_RC_SUBR= nomad USERS= nomad GROUPS= nomad +ETCDIR= ${PREFIX}/etc/${PORTNAME}.d +NOMAD_DATADIR= /var/db/${PORTNAME} + +SUB_LIST= ETCDIR=${ETCDIR} \ + USERS=${USERS} \ + GROUPS=${GROUPS} \ + NOMAD_DATADIR=${NOMAD_DATADIR} + +PLIST_FILES= bin/nomad \ + ${ETCDIR}/client.hcl.sample \ + ${ETCDIR}/server.hcl.sample + +USE_RC_SUBR= nomad + do-build: @cd ${WRKSRC}/src/github.com/hashicorp/nomad && \ - ${SETENV} ${MAKE_ENV} ${BUILD_ENV} GOPATH=${WRKSRC} go build -v -x -tags ui \ - -ldflags "-X main.GitDescribe=${DISTVERSIONFULL}" -o bin/nomad + ${SETENV} ${MAKE_ENV} CGO_ENABLED=1 ${BUILD_ENV} GOPATH=${WRKSRC} go build -tags ui \ + -ldflags "-X github.com/hashicorp/nomad/version.GitDescribe=${DISTVERSIONFULL}" -o bin/nomad do-install: + @${MKDIR} ${STAGEDIR}${ETCDIR} + @${MKDIR} ${STAGEDIR}${NOMAD_DATADIR} + @${MKDIR} ${STAGEDIR}${NOMAD_DATADIR}/plugins ${INSTALL_PROGRAM} ${WRKSRC}/src/github.com/hashicorp/nomad/bin/nomad ${STAGEDIR}${PREFIX}/bin/nomad - @${MKDIR} ${STAGEDIR}${PREFIX}/etc/nomad ${INSTALL_DATA} ${WRKSRC}/src/github.com/hashicorp/nomad/dist/client.hcl \ - ${STAGEDIR}${PREFIX}/etc/nomad/client.hcl.sample + ${STAGEDIR}${ETCDIR}/client.hcl.sample ${INSTALL_DATA} ${WRKSRC}/src/github.com/hashicorp/nomad/dist/server.hcl \ - ${STAGEDIR}${PREFIX}/etc/nomad/server.hcl.sample + ${STAGEDIR}${ETCDIR}/server.hcl.sample +post-install: + @${ECHO_CMD} "@dir(${USERS},${GROUPS},750) ${ETCDIR}" >> ${TMPPLIST} + @${ECHO_CMD} "@dir(${USERS},${GROUPS},750) ${NOMAD_DATADIR}" >> ${TMPPLIST} + @${ECHO_CMD} "@dir(${USERS},${GROUPS},750) ${NOMAD_DATADIR}/plugins" >> ${TMPPLIST} + .include .if ${COMPILER_TYPE} == clang Index: sysutils/nomad/files/nomad.in =================================================================== --- sysutils/nomad/files/nomad.in (revision 510384) +++ sysutils/nomad/files/nomad.in (working copy) @@ -6,21 +6,20 @@ # REQUIRE: LOGIN # KEYWORD: shutdown # -# Add the following lines to /etc/rc.conf.local or /etc/rc.conf -# to enable this service: +# Add nomad_enable="YES" to /etc/rc.conf to enable Nomad # -# nomad_enable (bool): Set to NO by default. -# Set it to YES to enable nomad. -# nomad_debug (bool): Set to NO by default. -# Set it to YES to enable nomad debugging to syslog. -# nomad_user (user): Set user to run nomad. -# Default is "nomad". -# nomad_group (group): Set group to run nomad. -# Default is "nomad". -# nomad_dir (dir): Set dir to run nomad in. -# Default is "/var/tmp/nomad". -# nomad_env (dir): Set environment variables used with nomad -# Default is "". +# Additional variables you can define are: +# +# nomad_debug: Set it to YES to enable Nomad debugging to syslog +# Default: NO +# nomad_user: Username to run Nomad +# Default: %%USERS%% +# nomad_datadir: Directory used to store agent state +# Default: %%NOMAD_DATADIR%% +# nomad_env: Set environment variables used with Nomad +# Default: +# nomad_args: Additional command-line options +# Default: . /etc/rc.subr @@ -29,33 +28,23 @@ load_rc_config $name -: ${nomad_enable:="NO"} -: ${nomad_debug:="NO"} -: ${nomad_user:="nomad"} -: ${nomad_group:="nomad"} -: ${nomad_dir:="/var/tmp/nomad"} -: ${nomad_env:=""} +: ${nomad_enable:=NO} +: ${nomad_debug:=NO} +: ${nomad_user:=%%USERS%%} +: ${nomad_datadir:=%%NOMAD_DATADIR%%} +: ${nomad_pidfile:=/var/run/nomad.pid} -pidfile=/var/run/nomad.pid +if checkyesno nomad_debug; then + nomad_syslog_flags="-T ${name}" +fi + +pidfile=${nomad_pidfile} +required_dirs="%%ETCDIR%% ${nomad_datadir}" + procname="%%PREFIX%%/bin/nomad" command="/usr/sbin/daemon" -nomad_command="/usr/bin/env ${nomad_env} ${procname} agent -data-dir=${nomad_dir} ${nomad_args}" -command_args="-f -p ${pidfile} ${nomad_command}" +command_nomad="/usr/bin/env ${nomad_env} ${procname} agent -data-dir=${nomad_datadir} -config=%%ETCDIR%% ${nomad_args}" +command_args="-f -p ${pidfile} -u ${nomad_user} -t ${name} ${nomad_syslog_flags} ${command_nomad}" +unset nomad_user -start_precmd=nomad_startprecmd - -nomad_startprecmd() -{ - if [ ! -e ${pidfile} ]; then - install -o ${nomad_user} -g ${nomad_group} /dev/null ${pidfile}; - fi - - if [ ! -d ${nomad_dir} ]; then - install -d -o ${nomad_user} -g ${nomad_group} ${nomad_dir} - fi - if [ "${nomad_debug}" != "NO" ]; then - command_args="-S -T ${name} -p ${pidfile} ${nomad_command}" - fi -} - run_rc_command "$1" Index: sysutils/nomad/files/patch-vendor__github.com__docker__docker__pkg__mount__mountinfo_freebsd.go =================================================================== --- sysutils/nomad/files/patch-vendor__github.com__docker__docker__pkg__mount__mountinfo_freebsd.go (nonexistent) +++ sysutils/nomad/files/patch-vendor__github.com__docker__docker__pkg__mount__mountinfo_freebsd.go (working copy) @@ -0,0 +1,11 @@ +--- vendor/github.com/docker/docker/pkg/mount/mountinfo_freebsd.go.orig 2019-08-21 17:31:04 UTC ++++ vendor/github.com/docker/docker/pkg/mount/mountinfo_freebsd.go +@@ -37,7 +37,7 @@ func parseMountTable(filter FilterFunc) ([]*Info, erro + + if filter != nil { + // filter out entries we're not interested in +- skip, stop = filter(p) ++ skip, stop = filter(&mountinfo) + if skip { + continue + } Property changes on: sysutils/nomad/files/patch-vendor__github.com__docker__docker__pkg__mount__mountinfo_freebsd.go ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: sysutils/nomad/files/patch-vendor__github.com__hashicorp__go-syslog__builtin.go =================================================================== --- sysutils/nomad/files/patch-vendor__github.com__hashicorp__go-syslog__builtin.go (nonexistent) +++ sysutils/nomad/files/patch-vendor__github.com__hashicorp__go-syslog__builtin.go (working copy) @@ -0,0 +1,11 @@ +--- vendor/github.com/hashicorp/go-syslog/builtin.go.orig 2019-08-21 17:31:04 UTC ++++ vendor/github.com/hashicorp/go-syslog/builtin.go +@@ -199,7 +199,7 @@ func (n *netConn) close() error { + // local machine using a Unix domain socket. + func unixSyslog() (conn serverConn, err error) { + logTypes := []string{"unixgram", "unix"} +- logPaths := []string{"/dev/log", "/var/run/syslog"} ++ logPaths := []string{"/dev/log", "/var/run/syslog", "/var/run/log"} + for _, network := range logTypes { + for _, path := range logPaths { + conn, err := net.DialTimeout(network, path, localDeadline) Property changes on: sysutils/nomad/files/patch-vendor__github.com__hashicorp__go-syslog__builtin.go ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: sysutils/nomad/files/patch-vendor_github.com_docker_docker_pkg_mount_mountinfo__freebsd.go =================================================================== --- sysutils/nomad/files/patch-vendor_github.com_docker_docker_pkg_mount_mountinfo__freebsd.go (revision 510384) +++ sysutils/nomad/files/patch-vendor_github.com_docker_docker_pkg_mount_mountinfo__freebsd.go (nonexistent) @@ -1,11 +0,0 @@ ---- vendor/github.com/docker/docker/pkg/mount/mountinfo_freebsd.go.orig 2019-04-09 15:51:37 UTC -+++ vendor/github.com/docker/docker/pkg/mount/mountinfo_freebsd.go -@@ -37,7 +37,7 @@ func parseMountTable(filter FilterFunc) ([]*Info, erro - - if filter != nil { - // filter out entries we're not interested in -- skip, stop = filter(p) -+ //skip, stop = filter(p) - if skip { - continue - } Property changes on: sysutils/nomad/files/patch-vendor_github.com_docker_docker_pkg_mount_mountinfo__freebsd.go ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: sysutils/nomad/pkg-plist =================================================================== --- sysutils/nomad/pkg-plist (revision 510384) +++ sysutils/nomad/pkg-plist (nonexistent) @@ -1,3 +0,0 @@ -bin/nomad -@sample %%ETCDIR%%/client.hcl.sample -@sample %%ETCDIR%%/server.hcl.sample Property changes on: sysutils/nomad/pkg-plist ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property