diff --git a/www/opengist/Makefile b/www/opengist/Makefile index 1a9bb3d10c02..774ef5113162 100644 --- a/www/opengist/Makefile +++ b/www/opengist/Makefile @@ -1,87 +1,89 @@ PORTNAME= opengist PORTVERSION= 1.11.1 DISTVERSIONPREFIX= v PORTREVISION= 1 CATEGORIES= www textproc MASTER_SITES= LOCAL/fox/:js DISTFILES= opengist-${DISTVERSION}-node_modules.tgz:js MAINTAINER= fox@FreeBSD.org COMMENT= Self-hosted pastebin powered by Git, open-source alternative to Github Gist. WWW= https://opengist.io/ LICENSE= AGPLv3 BROKEN_i386= fails to build ONLY_FOR_ARCHS= aarch64 amd64 BUILD_DEPENDS= npm${NODEJS_SUFFIX}>0:www/npm${NODEJS_SUFFIX} RUN_DEPENDS= git:devel/git USES= go:modules nodejs:20,build USE_GITHUB= nodefault GH_ACCOUNT= thomiceli GH_PROJECT= opengist USE_RC_SUBR= opengist GO_MODULE= github.com/thomiceli/opengist GO_ENV+= GOTOOLCHAIN=local+path GO_TARGET= . GO_BUILDFLAGS= -tags fs_embed \ -ldflags="-X github.com/thomiceli/opengist/internal/config.OpengistVersion=v${DISTVERSION}" -GROUP= opengist -USER= opengist +GROUPS= opengist +USERS= opengist post-extract: @${RLN} ${WRKDIR}/node_modules ${WRKSRC}/node_modules post-patch: @${REINPLACE_CMD} -e 's|opengist.db|file:/var/db/${PORTNAME}/opengist.db|g' \ ${WRKSRC}/config.yml pre-build: cd ${WRKSRC} && \ ${SETENV} ${MAKE_ENV} npx --offline vite -c public/vite.config.js \ build cd ${WRKSRC} && \ ${SETENV} ${MAKE_ENV} EMBED=1 npx --offline postcss 'public/assets/embed-*.css' \ -c public/postcss.config.js --replace post-install: ${MKDIR} ${STAGEDIR}${PREFIX}/etc/${PORTNAME} ${INSTALL_DATA} ${WRKSRC}/config.yml \ ${STAGEDIR}${PREFIX}/etc/${PORTNAME}/config.yml.sample ${MKDIR} ${STAGEDIR}/var/db/${PORTNAME} + ${CHOWN} opengist:opengist ${STAGEDIR}/var/db/${PORTNAME} ${MKDIR} ${STAGEDIR}/var/run/${PORTNAME} + ${CHOWN} opengist:opengist ${STAGEDIR}/var/run/${PORTNAME} ${MKDIR} ${STAGEDIR}${WWWDIR}/assets cd ${WRKSRC} && \ ${INSTALL_DATA} public/assets/* \ ${STAGEDIR}${WWWDIR}/assets cd ${WRKSRC} && \ ${INSTALL_DATA} public/manifest.json \ ${STAGEDIR}${WWWDIR} # # To update the opengist-${DISTVERSION}-node_modules.tgz archive: # 1. Comment out the DISTFILES and post-extract lines # 2. Run 'make makesum regenerate-node_modules-distfile clean' # 3. Upload the archive # 4. Uncomment the lines from step #1 # 5. Run 'make makesum' # regenerate-node_modules-distfile: patch cd ${WRKSRC} && \ ${RM} -r node_modules && \ ${MAKE_ENV} npm install --prefix ${WRKSRC} --os freebsd --cpu \ arm64 esbuild@0.18.20 && \ ${MAKE_ENV} npm install --prefix ${WRKSRC} --os freebsd --cpu \ amd64 esbuild@0.18.20 && \ ${MAKE_ENV} npm install --prefix ${WRKSRC} && \ ${TAR} czf ${DISTDIR}/opengist-${DISTVERSION}-node_modules.tgz \ node_modules && \ ${ECHO} "Please upload the file ${DISTDIR}/opengist-${DISTVERSION}-node_modules.tgz" .include diff --git a/www/opengist/files/opengist.in b/www/opengist/files/opengist.in index 8249f946c892..be31988b3d7a 100644 --- a/www/opengist/files/opengist.in +++ b/www/opengist/files/opengist.in @@ -1,76 +1,72 @@ #!/bin/sh # PROVIDE: opengist # REQUIRE: LOGIN NETWORKING # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf to run opengist: # # opengist_enable (bool): Set it to "YES" to enable opengist server. # Default is "NO". # opengist_home (str): Set the home directory for opengist server. # Default is "%%WWWDIR%%". # opengist_user (str): Set the user for running opengist server. # Default is "opengist". # opengist_config_file (str): Set config file location for opengist server. # Default is "%%PREFIX%%/etc/${name}/config.yml". # opengist_syslog_output_enable (bool): Set it to "YES" for enabling output to syslogd(8) # Default is "NO" # opengist_syslog_output_priority (str): Set logging priority. # Default is "info" # opengist_syslog_output_facility (str): Set logging facility # Default is "daemon" . /etc/rc.subr name=opengist rcvar=opengist_enable load_rc_config ${name} : ${opengist_enable:="NO"} : ${opengist_user:="opengist"} : ${opengist_files:="/var/db/opengist/"} : ${opengist_home:="%%WWWDIR%%"} : ${opengist_config_file:="%%PREFIX%%/etc/${name}/config.yml"} : ${opengist_syslog_output_enable:="NO"} : ${opengist_syslog_output_priority:="info"} : ${opengist_syslog_output_facility:="daemon"} if checkyesno opengist_syslog_output_enable; then opengist_syslog_output_flags="-t ${name} -T ${name}" if [ -n "${opengist_syslog_output_priority}" ]; then opengist_syslog_output_flags="${opengist_syslog_output_flags} -s ${opengist_syslog_output_priority}" fi if [ -n "${opengist_syslog_output_facility}" ]; then opengist_syslog_output_flags="${opengist_syslog_output_flags} -l ${opengist_syslog_output_facility}" fi fi pidfile=/var/run/opengist/${name}.pid procname="%%PREFIX%%/bin/${name}" -start_cmd="${name}_start" start_precmd="${name}_precmd" opengist_precmd() { if [ ! -f ${opengist_config_file} ]; then echo ${opengist_config_file} missing. return 1 fi } -opengist_start() { - echo "Starting opengist." - /usr/sbin/daemon -f ${opengist_syslog_output_flags} -p ${pidfile} \ - /usr/bin/env -i \ - "PATH=%%PREFIX%%/bin:${PATH}" \ - ${procname} -c ${opengist_config_file} -} +command="/usr/sbin/daemon" +command_args="-f ${opengist_syslog_output_flags} -p ${pidfile} \ + /usr/bin/env -i \"PATH=%%PREFIX%%/bin:${PATH}\" \ + ${procname} -c ${opengist_config_file}" cd ${opengist_home} run_rc_command "$1"