diff --git a/net/v2ray/Makefile b/net/v2ray/Makefile index 5a3e6e50cad3..9d65cb147ee3 100644 --- a/net/v2ray/Makefile +++ b/net/v2ray/Makefile @@ -1,39 +1,40 @@ PORTNAME= v2ray DISTVERSIONPREFIX= v DISTVERSION= 5.46.0 +PORTREVISION= 1 CATEGORIES= net MAINTAINER= alven@FreeBSD.org COMMENT= Platform for building proxies to bypass network restrictions WWW= https://www.v2fly.org/ \ https://github.com/v2fly/v2ray-core/ LICENSE= MIT LICENSE_FILE= ${WRKSRC}/LICENSE USES= cpe go:modules CPE_VENDOR= v2fly CPE_PRODUCT= v2ray-core USE_GITHUB= yes GH_ACCOUNT= v2fly GH_PROJECT= v2ray-core USE_RC_SUBR= v2ray GO_MOD_DIST= github # https://github.com/v2fly/v2ray-core/issues/3187 GO_MODULE= github.com/v2fly/v2ray-core GO_TARGET= ./main:v2ray GO_TESTFLAGS= -p 1 -tags json -timeout 30m SUB_LIST= GROUP="${GROUPS}" \ USER="${USERS}" USERS= v2ray GROUPS= v2ray post-install: ${MKDIR} ${STAGEDIR}${ETCDIR} cd ${WRKSRC}/release/config/ && \ ${INSTALL_DATA} vpoint*.json ${STAGEDIR}${ETCDIR} && \ ${INSTALL_DATA} config.json ${STAGEDIR}${ETCDIR}/config.json.sample .include diff --git a/net/v2ray/files/v2ray.in b/net/v2ray/files/v2ray.in index c39895054532..3778a4846d06 100644 --- a/net/v2ray/files/v2ray.in +++ b/net/v2ray/files/v2ray.in @@ -1,47 +1,47 @@ #!/bin/sh # PROVIDE: v2ray # REQUIRE: LOGIN # KEYWORD: shutdown # Add these lines to /etc/rc.conf.local or /etc/rc.conf to enable `v2ray': # # v2ray_enable (bool): Set to "NO" by default. # Set it to "YES" to enable v2ray # v2ray_config (path): Set to "%%PREFIX%%/etc/v2ray/config.json" by default # Set it to the v2ray server config # v2ray_logdir (path): Set to "/var/log/v2ray" by default. # Set it to the directory of v2ray log files # v2ray_env (str): Set to "" by default. # Set it to the desired environment variables . /etc/rc.subr name="v2ray" rcvar="${name}_enable" +load_rc_config ${name} : ${v2ray_enable="NO"} : ${v2ray_config="%%PREFIX%%/etc/$name/config.json"} : ${v2ray_logdir="/var/log/${name}"} : ${v2ray_env=""} : ${v2ray_user="%%USER%%"} : ${v2ray_group="%%GROUP%%"} asset_env="V2RAY_LOCATION_ASSET=%%PREFIX%%/share/$name" pidfile="/var/run/$name.pid" procname="%%PREFIX%%/bin/$name" command="/usr/sbin/daemon" command_args="-c -p ${pidfile} /usr/bin/env ${asset_env} ${v2ray_env} ${procname} run -config ${v2ray_config}" required_files="${v2ray_config}" start_precmd="v2ray_startprecmd" v2ray_startprecmd() { touch "${pidfile}" chown ${v2ray_user}:${v2ray_group} "${pidfile}" mkdir -p "${v2ray_logdir}" chown -R ${v2ray_user}:${v2ray_group} "${v2ray_logdir}" } -load_rc_config "$name" run_rc_command "$1"