Index: head/www/gitlab-pages/Makefile =================================================================== --- head/www/gitlab-pages/Makefile (revision 468170) +++ head/www/gitlab-pages/Makefile (revision 468171) @@ -1,41 +1,42 @@ # $FreeBSD$ PORTNAME= gitlab-pages PORTVERSION= 0.7.1 +PORTREVISION= 1 CATEGORIES= www MAINTAINER= swills@FreeBSD.org COMMENT= Official GitLab Pages daemon LICENSE= MIT LICENSE_FILE= ${WRKSRC}/LICENSE BUILD_DEPENDS= go:lang/go USE_GITLAB= yes GL_ACCOUNT= gitlab-org # Find the here: https://gitlab.com/gitlab-org/gitlab-pages/tags GL_COMMIT= 4e11c8392935e1f4dbd96066f3cbb8d657afd874 PLIST_FILES= bin/gitlab-pages USE_RC_SUBR= gitlab_pages USERS= gitlab-pages GROUPS= gitlab-pages post-patch: @${MV} ${WRKSRC}/vendor ${WRKSRC}/src @${MKDIR} ${WRKSRC}/src/gitlab.com/gitlab-org @${LN} -s ${WRKSRC} ${WRKSRC}/src/gitlab.com/gitlab-org/gitlab-pages do-build: cd ${WRKSRC} && ${SETENV} GOCACHE=${WRKSRC}/go CGO_ENABLED=0 GO15VENDOREXPERIMENT=1 \ GOPATH=${WRKSRC} GOCACHE=off \ go build -o gitlab-pages \ --ldflags="-X main.VERSION=${PORTVERSION} -X main.REVISION=${GITHASH}" do-install: ${INSTALL_PROGRAM} ${WRKSRC}/gitlab-pages ${STAGEDIR}${PREFIX}/bin/gitlab-pages .include Index: head/www/gitlab-pages/files/gitlab_pages.in =================================================================== --- head/www/gitlab-pages/files/gitlab_pages.in (revision 468170) +++ head/www/gitlab-pages/files/gitlab_pages.in (revision 468171) @@ -1,69 +1,79 @@ #!/bin/sh # # $FreeBSD$ # # PROVIDE: gitlab_pages # REQUIRE: DAEMON NETWORKING # KEYWORD: shutdown # # Add the following line to /etc/rc.conf to enable gitlab_pages: # # gitlab_pages_enable (bool): Set to "NO" by default. # Set it to "YES" to enable gitlab-pages # gitlab_pages_dir (str): Set to "/var/tmp/gitlab_pages" by default. # Set it to directory to run gitlab-pages in # gitlab_pages_user (str): Set to "gitlab-pages" by default. # Set it to user to run gitlab_pages under # gitlab_pages_group (str): Set to "gitlab-pages" by default. # Set it to group to run gitlab-pages under +# gitlab_pages_logfile (str): Set to "/var/log/gitlab_pages.log" by default. +# Set it to file to send gitlab-pages logs to # . /etc/rc.subr name="gitlab_pages" rcvar="gitlab_pages_enable" load_rc_config $name : ${gitlab_pages_enable:="NO"} : ${gitlab_pages_dir:="/var/tmp/gitlab_pages"} : ${gitlab_pages_user:="gitlab-pages"} : ${gitlab_pages_group:="gitlab-pages"} +: ${gitlab_pages_logfile:="/var/log/gitlab_pages.log"} export HOME=${gitlab_pages_dir} export PATH=${PATH}:%%PREFIX%%/bin pidfile="/var/run/${name}.pid" -command="/usr/sbin/daemon" -command_args="-f -p ${pidfile} %%PREFIX%%/bin/gitlab-pages run" gitlab_pages_chdir="${gitlab_pages_dir}" procname=%%PREFIX%%/bin/gitlab-pages start_precmd="gitlab_pages_startprecmd" +start_cmd="gitlab_pages_startcmd" list_cmd="listfunc" register_cmd="registerfunc" listfunc() { + cd ${gitlab_pages_chdir} ; \ su -m ${gitlab_pages_user} -c "env HOME=${gitlab_pages_dir} %%PREFIX%%/bin/gitlab-pages list" } registerfunc() { + cd ${gitlab_pages_chdir} ; \ su -m ${gitlab_pages_user} -c "env HOME=${gitlab_pages_dir} %%PREFIX%%/bin/gitlab-pages register" } gitlab_pages_startprecmd() { if [ ! -e "${pidfile}" ]; then install -g ${gitlab_pages_group} -o ${gitlab_pages_user} -- /dev/null "${pidfile}"; fi if [ ! -d "${gitlab_pages_dir}" ]; then install -d -o "${gitlab_pages_user}" -g "${gitlab_pages_group}" "${gitlab_pages_dir}" fi +} + +gitlab_pages_startcmd() +{ + cd ${gitlab_pages_chdir} ; \ + daemon -u ${gitlab_pages_user} -p ${pidfile} /usr/local/bin/gitlab-pages ${gitlab_pages_args} run < /dev/null >> ${gitlab_pages_logfile} 2>> ${gitlab_pages_logfile} } extra_commands="list register" run_rc_command $1