| Summary: | app-i18n/canna - initscript uses bashisms | ||
|---|---|---|---|
| Product: | Gentoo Linux | Reporter: | Mathias Laurin <Mathias.Laurin+gentoo> |
| Component: | New packages | Assignee: | CJK Team <cjk> |
| Status: | RESOLVED FIXED | ||
| Severity: | minor | ||
| Priority: | High | ||
| Version: | unspecified | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Package list: | Runtime testing required: | --- | |
| Attachments: |
diff canna.old canna
diff -u canna.old canna (SpanKY) |
||
|
Description
Mathias Laurin
2007-09-10 06:39:31 UTC
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. |