Bug 170080 - asterisk init.d scipt without bash
|
Bug#:
170080
|
Product: Gentoo Linux
|
Version: unspecified
|
Platform: All
|
|
OS/Version: Linux
|
Status: RESOLVED
|
Severity: enhancement
|
Priority: P2
|
|
Resolution: FIXED
|
Assigned To: voip@gentoo.org
|
Reported By: natanael.copa@gmail.com
|
|
Component: Ebuilds
|
|
|
URL:
|
|
Summary: asterisk init.d scipt without bash
|
|
Keywords:
|
|
Status Whiteboard:
|
|
Opened: 2007-03-09 10:23 0000
|
asterisk init.d script uses bash specific features.
Its trivial to make it run with busybox ash for embedded:
diff -ruN data.orig/etc/init.d/asterisk data/etc/init.d/asterisk
--- data.orig/etc/init.d/asterisk 2006-12-20 10:13:39 +0000
+++ data/etc/init.d/asterisk 2006-12-21 13:30:39 +0000
@@ -174,7 +174,7 @@
fi
if [[ -n "${ASTERISK_USER}" ]]; then
- USER=${ASTERISK_USER/:*/}
+ USER=$(echo $ASTERISK_USER | sed 's/:.*//')
GROUP=$(echo $ASTERISK_USER | awk -F: '/.*:.*/ { print $2 }')
if [[ -n "${USER}" ]]; then
ASTERISK_OPTS="${ASTERISK_OPTS} -U ${USER}"
@@ -191,15 +191,17 @@
if [[ "$(echo ${ASTERISK_WRAPPER} | tr [:upper:] [:lower:])" != "yes"
]]; then
start-stop-daemon --start --exec /usr/sbin/asterisk \
${OPTS} -- ${ASTERISK_OPTS}
+ result=$?
else
asterisk_run_loop ${ASTERISK_OPTS} 2>/dev/null &
+ result=$?
fi
if [[ $result -eq 0 ]]; then
# 2 seconds should be enough for asterisk to start
- sleep 2
-
- result=$(is_running)
+ sleep 2
+ is_running
+ result=$?
fi
eend $result
Just a note:
solar@here ~ $ echo FooBar | tr [:upper:] [:lower:]
FooBar
solar@here ~ $ echo FooBar | tr '[:upper:]' '[:lower:]'
foobar
(In reply to comment #2)
> Just a note:
>
> solar@here ~ $ echo FooBar | tr [:upper:] [:lower:]
> FooBar
> solar@here ~ $ echo FooBar | tr '[:upper:]' '[:lower:]'
> foobar
>
what shell is that?
# busybox ash
$ echo FooBar | tr [:upper:] [:lower:]
foobar
Should I submit a new patch?
> what shell is that?
default shell was bash
But I get the same behavior in both busybox and bash where it needs single
ticks.
> Should I submit a new patch?
naa. I'll see if stkn is ok with me commiting your update. I or he will fix it
then.