From 2c8eb6cce70c8fae5a38889642d049e0953058a3 Mon Sep 17 00:00:00 2001 From: Johannes Heimansberg <2845-0564@users.gitlab.alpinelinux.org> Date: Tue, 1 Sep 2020 12:05:14 +0200 Subject: [PATCH] testing/3proxy: fix init script and use supervise-daemon instead of start-stop-daemon There are a couple of issues with the start-stop-daemon call in the init script, that prevent it from working with 3proxy 0.8.13: - 3proxy does not understand the --pidfile and --user options that are passed to it by start-stop-daemon (are they meant for start-stop-daemon instead?) - Since 3proxy does not write its own pidfile by default, start-stop-daemon would need the -m option, so it would create the .pid file; instead of doing that supervise-daemon is now used instead, which avoids PID files altogether - Both start-stop-daemon and supervise-daemon get confused when passing a user name starting with a number via the --user option and interpret it as a numeric UID; to avoid this, the UID/GID of the "3proxy" user/group are now fetched with ``id -u``/``id -g`` and then the correct numeric UID and GID are passed --- testing/3proxy/3proxy.initd | 29 ++++++----------------------- testing/3proxy/APKBUILD | 4 ++-- 2 files changed, 8 insertions(+), 25 deletions(-) diff --git a/testing/3proxy/3proxy.initd b/testing/3proxy/3proxy.initd index 337904dbab36..2a0328af2fd5 100644 --- a/testing/3proxy/3proxy.initd +++ b/testing/3proxy/3proxy.initd @@ -1,29 +1,12 @@ #!/sbin/openrc-run -# -# Start 3proxy tiny proxy server. -# - -CONFFILE=/etc/${SVCNAME}/${SVCNAME}.cfg -PIDFILE=/var/run/${SVCNAME}.pid +supervisor="supervise-daemon" +command="/usr/bin/3proxy" +CONFFILE=/etc/$SVCNAME/$SVCNAME.cfg +command_args="$CONFFILE" +command_user="$(id -u 3proxy):$(id -g 3proxy)" +required_files="$CONFFILE" depend() { need net } -start() { - if [ ! -f "${CONFFILE}" ]; then - eerror "Configuration file ${CONFFILE} not found!" - return 1 - fi - - ebegin "Starting 3proxy" - start-stop-daemon --start --quiet --exec /usr/bin/3proxy --pidfile "${PIDFILE}" \ - -- --pidfile "${PIDFILE}" --user 3proxy.3proxy "${CONFFILE}" #2>/dev/null - eend $? -} - -stop() { - ebegin "Stopping 3proxy" - start-stop-daemon --stop --quiet --pidfile "${PIDFILE}" - eend $? -} diff --git a/testing/3proxy/APKBUILD b/testing/3proxy/APKBUILD index f7cda3a49045..24a144a76613 100644 --- a/testing/3proxy/APKBUILD +++ b/testing/3proxy/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: pkgname=3proxy pkgver=0.8.13 -pkgrel=0 +pkgrel=1 pkgdesc="Really tiny cross-platform proxy servers set" url="https://3proxy.ru" arch="all" @@ -31,4 +31,4 @@ package() { } sha512sums="94b4a2568917c1d720276e38050a13e144d3e92ff41edd02eeebac0a6c21e6a839a58ea7dcb3abc03370e0f18452c953cfd7ad15ebac87e66b78d94fa52fbd79 3proxy-0.8.13.tar.gz -b3ae325013d37a021439bcacb42f5fa51440873b68ea8c42ef30d87df73d47c4426f7f96acf05c6e877f967c66d7ee65663889f8163dd5cf1ffec89344cb49c4 3proxy.initd" +043fa5784623e29961ae92f5370598d420e55da6d04f6421b585ac050694982765d6b57ee0276a10738bc8ad0e49ddc4edf6ef288bb9c68e7da11b572066688e 3proxy.initd" -- GitLab