mirror of
https://github.com/beard7n/bsdports.git
synced 2026-04-09 18:11:15 +02:00
update
This commit is contained in:
61
net/xray/Makefile~
Normal file
61
net/xray/Makefile~
Normal file
@@ -0,0 +1,61 @@
|
||||
PORTNAME= xray
|
||||
DISTVERSIONPREFIX= v
|
||||
DISTVERSION= 25.1.30
|
||||
CATEGORIES= net
|
||||
|
||||
MAINTAINER= shen.elf@gmail.com
|
||||
COMMENT= Platform for building proxies to bypass network restrictions
|
||||
WWW= https://www.v2ray.com
|
||||
|
||||
USES= go:modules
|
||||
USE_GITHUB= yes
|
||||
USE_RC_SUBR= xray
|
||||
|
||||
GH_ACCOUNT= XTLS
|
||||
GH_PROJECT= Xray-core
|
||||
GH_TUPLE= #
|
||||
|
||||
GO_BUILDFLAGS= -ldflags='${STRIP} -w'
|
||||
GO_TARGET= ./main:xray
|
||||
GO_TESTFLAGS= -p 1 -tags json -timeout 30m
|
||||
|
||||
#USERS= v2ray
|
||||
#GROUPS= v2ray
|
||||
|
||||
OWNER= ${PORTNAME}
|
||||
GROUP= ${PORTNAME}
|
||||
OWNER_ID= 361
|
||||
GROUP_ID= 361
|
||||
|
||||
PKGDEINSTALL= ${WRKDIR}/pkg-deinstall
|
||||
PKGINSTALL= ${WRKDIR}/pkg-install
|
||||
USE_RC_SUBR= ${PORTNAME}
|
||||
SUB_FILES+= pkg-install pkg-deinstall
|
||||
|
||||
SUB_LIST+= OWNER=${OWNER}
|
||||
SUB_LIST+= GROUP=${GROUP}
|
||||
SUB_LIST+= OWNER_ID=${OWNER_ID}
|
||||
SUB_LIST+= GROUP_ID=${GROUP_ID}
|
||||
|
||||
#PLIST_SUB+= LOCALSTATEDIR=${LOCALSTATEDIR}
|
||||
#PLIST_SUB+= PREFIX=${PREFIX}
|
||||
|
||||
#SUB_LIST+= LOCALSTATEDIR=${LOCALSTATEDIR}
|
||||
SUB_LIST+= PREFIX=${PREFIX}
|
||||
|
||||
#LOCALSTATEDIR= /var
|
||||
#LAYOUT_FILE= ${WRKSRC}/config.layout
|
||||
|
||||
pre-build:
|
||||
cd ${WRKSRC} && go mod vendor
|
||||
|
||||
#post-install:
|
||||
# ${MKDIR} ${STAGEDIR}${DATADIR}
|
||||
# ${INSTALL_DATA} ${WRKSRC}/release/config/geoip.dat ${STAGEDIR}${DATADIR}/geoip.dat
|
||||
# ${INSTALL_DATA} ${WRKSRC}/release/config/geosite.dat ${STAGEDIR}${DATADIR}/geosite.dat
|
||||
# ${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
|
||||
# ${INSTALL_DATA} ${WRKSRC}/release/config/config.json ${STAGEDIR}${EXAMPLESDIR}/config.json.sample
|
||||
# ${INSTALL_DATA} ${WRKSRC}/release/config/vpoint_socks_vmess.json ${STAGEDIR}${EXAMPLESDIR}/vpoint_socks_vmess.json
|
||||
# ${INSTALL_DATA} ${WRKSRC}/release/config/vpoint_vmess_freedom.json ${STAGEDIR}${EXAMPLESDIR}/vpoint_vmess_freedom.json
|
||||
|
||||
.include <bsd.port.mk>
|
||||
45
net/xray/files/pkg-install.in~
Normal file
45
net/xray/files/pkg-install.in~
Normal file
@@ -0,0 +1,45 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -x
|
||||
|
||||
|
||||
case $2 in
|
||||
PRE-INSTALL)
|
||||
|
||||
GROUP="%%GROUP%%"
|
||||
OWNER="%%OWNER%%"
|
||||
GROUP_ID="%%GROUP_ID%%"
|
||||
OWNER_ID="%%OWNER_ID%%"
|
||||
|
||||
PKG_PREFIX="%%PREFIX%%"
|
||||
# LOCALSTATEDIR="%%LOCALSTATEDIR%%"
|
||||
|
||||
# PROXYDIR="%%LOCALSTATEDIR%%/cache/apache"
|
||||
# RUNDIR="%%LOCALSTATEDIR%%/run/apache"
|
||||
# LOGDIR="%%LOCALSTATEDIR%%/log/apache"
|
||||
# DATADIR="%%LOCALSTATEDIR%%/www/apache"
|
||||
|
||||
NAME="apache"
|
||||
SHELL="/usr/sbin/nologin"
|
||||
|
||||
|
||||
pw group add ${GROUP} -g ${GROUP_ID}
|
||||
pw group show ${GROUP}
|
||||
pw user add ${OWNER} -u ${OWNER_ID} \
|
||||
-g ${GROUP} \
|
||||
-d ${PKG_PREFIX} \
|
||||
-s "${SHELL}" -u ${OWNER_ID} \
|
||||
-c "${NAME}"
|
||||
pw group mod ${GROUP} -M ${OWNER}
|
||||
pw user show ${OWNER}
|
||||
pw group show ${GROUP}
|
||||
# for dir in ${LOGDIR} ${PROXYDIR} ${RUNDIR}; do
|
||||
# install -d -o ${OWNER} -g ${GROUP} -m 0750 ${dir}
|
||||
# done
|
||||
# install -d -o root -g wheel -m 0755 ${DATADIR}
|
||||
;;
|
||||
POST-INSTALL)
|
||||
;;
|
||||
esac
|
||||
exit 0
|
||||
#EOF
|
||||
47
net/xray/files/xray.in~
Normal file
47
net/xray/files/xray.in~
Normal file
@@ -0,0 +1,47 @@
|
||||
#!/bin/sh
|
||||
|
||||
# PROVIDE: xray
|
||||
# REQUIRE: LOGIN
|
||||
# KEYWORD: shutdown
|
||||
|
||||
# Add these lines to /etc/rc.conf.local or /etc/rc.conf to enable `xray':
|
||||
#
|
||||
# xray_enable (bool): Set to "NO" by default.
|
||||
# Set it to "YES" to enable xray
|
||||
# xray_config (path): Set to "%%PREFIX%%/etc/xray/config.json" by default
|
||||
# Set it to the xray server config
|
||||
# xray_logdir (path): Set to "/var/log/xray" by default.
|
||||
# Set it to the directory of xray log files
|
||||
# xray_env (str): Set to "" by default.
|
||||
# Set it to the desired environment variables
|
||||
|
||||
. /etc/rc.subr
|
||||
|
||||
name="xray"
|
||||
rcvar="${name}_enable"
|
||||
|
||||
: ${xray_enable="NO"}
|
||||
: ${xray_config="%%PREFIX%%/etc/$name/config.json"}
|
||||
: ${xray_logdir="/var/log/${name}"}
|
||||
: ${xray_env=""}
|
||||
: ${xray_user="%%USER%%"}
|
||||
: ${xray_group="%%GROUP%%"}
|
||||
|
||||
asset_env="XRAY_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} ${xray_env} ${procname} -config ${xray_config}"
|
||||
required_files="${xray_config}"
|
||||
|
||||
start_precmd="xray_startprecmd"
|
||||
|
||||
xray_startprecmd() {
|
||||
touch "${pidfile}"
|
||||
chown ${xray_user}:${xray_group} "${pidfile}"
|
||||
mkdir -p "${xray_logdir}"
|
||||
chown -R ${xray_user}:${xray_group} "${xray_logdir}"
|
||||
}
|
||||
|
||||
load_rc_config "$name"
|
||||
run_rc_command "$1"
|
||||
Reference in New Issue
Block a user