diff options
author | Kerin Millar <kfm@plushkava.net> | 2022-07-01 21:01:32 +0100 |
---|---|---|
committer | Joonas Niilola <juippis@gentoo.org> | 2022-07-03 09:06:43 +0300 |
commit | e565ecb9cc44e7af96faf0f1b50c2a5a142dc7ca (patch) | |
tree | 70ed85131ebfd9bf6645b279c53928f9c75e55cc /media-video | |
parent | Revert "media-video/mjpg-streamer: fix init script's non-POSIX features" (diff) | |
download | gentoo-e565ecb9cc44e7af96faf0f1b50c2a5a142dc7ca.tar.gz gentoo-e565ecb9cc44e7af96faf0f1b50c2a5a142dc7ca.tar.bz2 gentoo-e565ecb9cc44e7af96faf0f1b50c2a5a142dc7ca.zip |
media-video/mjpg-streamer: Avoid non-POSIX features in runscript
Use [ rather than [[ (SC3010). Don't use += (SC3024). Don't use string
replacing forms of parameter expansion (SC3060); instead use tr(1).
Closes: https://bugs.gentoo.org/848474
Signed-off-by: Kerin Millar <kfm@plushkava.net>
Signed-off-by: Joonas Niilola <juippis@gentoo.org>
Diffstat (limited to 'media-video')
-rw-r--r-- | media-video/mjpg-streamer/files/mjpg-streamer.initd | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/media-video/mjpg-streamer/files/mjpg-streamer.initd b/media-video/mjpg-streamer/files/mjpg-streamer.initd index e7116dba01d2..3b307e777c94 100644 --- a/media-video/mjpg-streamer/files/mjpg-streamer.initd +++ b/media-video/mjpg-streamer/files/mjpg-streamer.initd @@ -3,7 +3,7 @@ # Distributed under the terms of the GNU General Public License v2 MJPG_STREAMER_PIDFILE="${MJPG_STREAMER_PIDFILE:-/var/run/${SVCNAME}.pid}" -MY_NAME=${SVCNAME//-/_} +MY_NAME=$(printf %s "${SVCNAME}" | tr - _) depend() { use logger @@ -11,17 +11,16 @@ depend() { } checkconfig() { - local vars + set -- - [[ ${INPUT_PLUGIN} ]] || vars+=\ INPUT_PLUGIN - [[ ${OUTPUT_PLUGIN} ]] || vars+=\ OUTPUT_PLUGIN - [[ ${MJPG_STREAMER_USER} ]] || vars+=\ MJPG_STREAMER_USER - [[ ${MJPG_STREAMER_GROUP} ]] || vars+=\ MJPG_STREAMER_GROUP - vars="${vars# }" + [ "${INPUT_PLUGIN}" ] || set -- "$@" INPUT_PLUGIN + [ "${OUTPUT_PLUGIN}" ] || set -- "$@" OUTPUT_PLUGIN + [ "${MJPG_STREAMER_USER}" ] || set -- "$@" MJPG_STREAMER_USER + [ "${MJPG_STREAMER_GROUP}" ] || set -- "$@" MJPG_STREAMER_GROUP - if [[ ${vars} ]]; then + if [ $# -gt 0 ]; then eerror "Required variables in /etc/conf.d/${SVCNAME} are not set:" - eerror " ${vars// /, }" + eerror " $(IFS=,; printf %s "$*")" return 1 fi @@ -31,7 +30,7 @@ checkconfig() { start() { checkconfig || return $? ebegin "Starting ${SVCNAME}" - start-stop-daemon --start --exec /usr/bin/${MY_NAME} \ + start-stop-daemon --start --exec "/usr/bin/${MY_NAME}" \ --user "${MJPG_STREAMER_USER}" \ --group "${MJPG_STREAMER_GROUP}" -w 100 -b -m \ --pidfile "${MJPG_STREAMER_PIDFILE}" \ @@ -42,7 +41,7 @@ start() { stop() { ebegin "Stopping ${SVCNAME}" - start-stop-daemon --stop --exec /usr/bin/${MY_NAME} \ + start-stop-daemon --stop --exec "/usr/bin/${MY_NAME}" \ --pidfile "${MJPG_STREAMER_PIDFILE}" eend $? } |