diff options
author | Yixun Lan <dlan@gentoo.org> | 2020-04-07 22:08:04 +0800 |
---|---|---|
committer | Yixun Lan <dlan@gentoo.org> | 2020-04-07 22:20:29 +0800 |
commit | d72647710c1f67bffde1559a4463cf19b42ade69 (patch) | |
tree | 768f6f37796531ecdf794fc8b7bcf4efdcefb7fe /net-proxy | |
parent | net-proxy/trojan: drop old versions (diff) | |
download | gentoo-d72647710c1f67bffde1559a4463cf19b42ade69.tar.gz gentoo-d72647710c1f67bffde1559a4463cf19b42ade69.tar.bz2 gentoo-d72647710c1f67bffde1559a4463cf19b42ade69.zip |
net-proxy/trojan: add multi instances support
enable running multi instances while using openrc.
Package-Manager: Portage-2.3.89, Repoman-2.3.20
Signed-off-by: Yixun Lan <dlan@gentoo.org>
Diffstat (limited to 'net-proxy')
-rw-r--r-- | net-proxy/trojan/files/trojan.initd | 15 | ||||
-rw-r--r-- | net-proxy/trojan/trojan-1.14.1.ebuild | 14 | ||||
-rw-r--r-- | net-proxy/trojan/trojan-1.15.1.ebuild | 14 |
3 files changed, 39 insertions, 4 deletions
diff --git a/net-proxy/trojan/files/trojan.initd b/net-proxy/trojan/files/trojan.initd index cee794ad4d72..2990245430db 100644 --- a/net-proxy/trojan/files/trojan.initd +++ b/net-proxy/trojan/files/trojan.initd @@ -1,10 +1,17 @@ #!/sbin/openrc-run -# Copyright 1999-2019 Gentoo Authors +# Copyright 1999-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -TJ_CONFIG="/etc/trojan/config.json" -TJ_PIDFILE="/run/trojan.pid" -TJ_LOG="/var/log/trojan.log" +TJ_NAME=${SVCNAME##*.} +if [ -n "${TJ_NAME}" -a "${SVCNAME}" != "trojan" ]; then + TJ_PIDFILE="/run/trojan.${TJ_NAME}.pid" + TJ_CONFIG="/etc/trojan/${TJ_NAME}.json" + TJ_LOG="/var/log/trojan.${TJ_NAME}.log" +else + TJ_PIDFILE="/run/trojan.pid" + TJ_CONFIG="/etc/trojan/config.json" + TJ_LOG="/var/log/trojan.log" +fi depend() { need net diff --git a/net-proxy/trojan/trojan-1.14.1.ebuild b/net-proxy/trojan/trojan-1.14.1.ebuild index aa4fa9f95beb..21f494f1364d 100644 --- a/net-proxy/trojan/trojan-1.14.1.ebuild +++ b/net-proxy/trojan/trojan-1.14.1.ebuild @@ -45,3 +45,17 @@ src_install() { src_test() { cmake_src_test -j1 } + +pkg_postinst() { + elog "Running Trojan with multi instances" + elog "" + + elog "Prepare /etc/trojan/\${blah}.json first" + elog "Config with Openrc" + elog " ln -s /etc/init.d/trojan{,.\${blah}}" + elog " rc-update add trojan.\${blah} default" + elog "" + elog "Config with Systemd" + elog " systemctl enable trojan.\${blah}" + elog "" +} diff --git a/net-proxy/trojan/trojan-1.15.1.ebuild b/net-proxy/trojan/trojan-1.15.1.ebuild index aa4fa9f95beb..21f494f1364d 100644 --- a/net-proxy/trojan/trojan-1.15.1.ebuild +++ b/net-proxy/trojan/trojan-1.15.1.ebuild @@ -45,3 +45,17 @@ src_install() { src_test() { cmake_src_test -j1 } + +pkg_postinst() { + elog "Running Trojan with multi instances" + elog "" + + elog "Prepare /etc/trojan/\${blah}.json first" + elog "Config with Openrc" + elog " ln -s /etc/init.d/trojan{,.\${blah}}" + elog " rc-update add trojan.\${blah} default" + elog "" + elog "Config with Systemd" + elog " systemctl enable trojan.\${blah}" + elog "" +} |