1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-28 05:29:48 +00:00

net/shadowsocks-rust: Add RC scripts and config file

Suggested by:	Matthias Fechner <mfechner@freebsd.org>
This commit is contained in:
Yuri Victorovich 2024-02-19 15:08:20 -08:00
parent ddd7c2bdca
commit 1c86bd3eab
4 changed files with 79 additions and 5 deletions

View File

@ -1,7 +1,7 @@
PORTNAME= shadowsocks-rust
DISTVERSIONPREFIX= v
DISTVERSION= 1.18.1
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= net
MAINTAINER= yuri@FreeBSD.org
@ -12,6 +12,8 @@ LICENSE= MIT
LICENSE_FILE= ${WRKSRC}/LICENSE
USES= cargo
USE_RC_SUBR= sslocal-rust \
ssserver-rust
USE_GITHUB= yes
GH_ACCOUNT= shadowsocks
@ -411,13 +413,13 @@ OPENSSLLIB= /usr/lib
EXECUTABLES= sslocal ssmanager ssserver ssservice ssurl
.for e in ${EXECUTABLES}
PLIST_FILES+= bin/${e}
.endfor
post-install:
# strip binaries
.for e in ${EXECUTABLES}
@${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/${e}
.endfor
# install config file
${MKDIR} ${STAGEDIR}${ETCDIR}
${INSTALL_DATA} ${WRKSRC}/examples/config.json ${STAGEDIR}${ETCDIR}/config.json.sample
.include <bsd.port.mk>

View File

@ -0,0 +1,33 @@
#!/bin/sh
# PROVIDE: sslocal_rust
# REQUIRE: NETWORKING SERVERS
#
# Add the following lines to /etc/rc.conf to run sslocal:
# sslocal_rust_enable (bool): Set it to "YES" to enable sslocal.
# Default is "NO".
# sslocal_rust_args (string): Set it to the desired arguments to run sslocal.
# Default is "-c %%ETCDIR%%/config.json".
#
. /etc/rc.subr
name="sslocal_rust"
rcvar=sslocal_rust_enable
pidfile="/var/run/${name}.pid"
logfile="/var/log/${name}.log"
: ${sslocal_rust_enable="NO"}
: ${sslocal_rust_args="-c %%ETCDIR%%/config.json"}
procname=%%PREFIX%%/bin/sslocal
command="/usr/sbin/daemon"
command_args="-f -S \
-p ${pidfile} \
-o ${logfile} \
-t ${name}_sslocal \
%%PREFIX%%/bin/sslocal $sslocal_rust_args"
load_rc_config $name
run_rc_command "$1"

View File

@ -0,0 +1,33 @@
#!/bin/sh
# PROVIDE: ssserver_rust
# REQUIRE: NETWORKING SERVERS
#
# Add the following lines to /etc/rc.conf to run ssserver:
# ssserver_rust_enable (bool): Set it to "YES" to enable ssserver.
# Default is "NO".
# ssserver_rust_args (string): Set it to the desired arguments to run ssserver.
# Default is "-c %%ETCDIR%%/config.json".
#
. /etc/rc.subr
name="ssserver_rust"
rcvar=ssserver_rust_enable
pidfile="/var/run/${name}.pid"
logfile="/var/log/${name}.log"
: ${ssserver_rust_enable="NO"}
: ${ssserver_rust_args="-c %%ETCDIR%%/config.json"}
procname=%%PREFIX%%/bin/ssserver
command="/usr/sbin/daemon"
command_args="-f -S \
-p ${pidfile} \
-o ${logfile} \
-t ${name}_ssserver \
%%PREFIX%%/bin/ssserver $ssserver_rust_args"
load_rc_config $name
run_rc_command "$1"

View File

@ -0,0 +1,6 @@
bin/sslocal
bin/ssmanager
bin/ssserver
bin/ssservice
bin/ssurl
@sample %%ETCDIR%%/config.json.sample