/etc/init.d/canna, from app-i18n/canna-3.7_p3 uses bashism for argument parsing and fails with (at least) dash, which I am using for /bin/sh Reproducible: Always Steps to Reproduce: 1. emerge app-i18n/canna dash 2. have /bin/sh point to /bin/dash 3. /etc/init.d/canna start Actual Results: Syntax error: Bad substitution Expected Results: 15:32 /etc/init.d [0]0 # ./canna start * Starting canna ... [ ok ] 15:32 /etc/init.d [0]0 # ./canna stop I have fixed it locally by changing the bash-style command substitution with grep. I will post my diff in the next post (although I am no POSIX-shell expert, so the baselayout team may have a better way of doing it). And I use [ -n "$TEST" ] and [ -z "$TEST" ] but I do not know whether this is POSIX-compliant.
Created attachment 130462 [details, diff] diff canna.old canna
(In reply to comment #1) > Created an attachment (id=130462) [edit] > diff canna.old canna > PS: if you do not go with my patch, be careful that one test is testing if the option is *present* and the other one if the option is *absent*.
ugh, dont do anything like that grep has the ability to function silently and return proper exit code, so you want to do: if echo "${CANNASERVER_OPT}" | grep -qs -e"-u" ; then also, in the future, post *unified* diffs, not context diffs
Created attachment 130480 [details, diff] diff -u canna.old canna (SpanKY) I did not about this grep feature, it is nice! thank you. So here is the update using SpanKY's way and diff -u; that should be it.
Why use grep? Use a case statement to save on forking an external binary case "${CANNASERVER_OPTS}" in *-syslog*) ;; *) case "${CANNASERVER_OPTS}" in *-u*) ;; *) ;; esac ;; esac However, all the above do inexact pattern matching, so you may want something like this local have_syslog=false have_u=false eval set -- "${CANNASERVER_OPTS}" for opt in "$@"; do case "${opt}" in -syslog) have_syslog=true;; -u) have_u=true;; esac done And then use those vars accordingly.
fixed in 3.7_p3-r1.