Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 170080
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: voip herd <voip@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Natanael Copa <natanael.copa@gmail.com>
Add CC:
CC:
URL:
Summary:
Status Whiteboard:
Keywords:

Filename Description Type Creator Created Size Actions
00-unbash.patch 00-unbash.patch patch Natanael Copa 2007-03-09 13:19 0000 5.71 KB Details | Diff
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 170080 depends on: Show dependency tree
Bug 170080 blocks:
Votes: 0    Show votes for this bug    Vote for this bug

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.






View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   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

------- Comment #1 From Natanael Copa 2007-03-09 13:19:47 0000 -------
Created an attachment (id=112700) [details]
00-unbash.patch

The patch also replaces all [[ with [

------- Comment #2 From solar 2007-03-09 15:29:22 0000 -------
Just a note:

solar@here ~ $ echo FooBar | tr [:upper:] [:lower:]
FooBar
solar@here ~ $ echo FooBar | tr '[:upper:]' '[:lower:]'
foobar

------- Comment #3 From Natanael Copa 2007-03-09 15:36:28 0000 -------
(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?

------- Comment #4 From solar 2007-03-09 16:23:04 0000 -------
> 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.

------- Comment #5 From solar 2007-03-09 21:00:56 0000 -------
  09 Mar 2007; <solar@gentoo.org> files/1.2.0/asterisk.rc6:
  - posix compliant init.d script from Natanael Copa. bug 170080

Thanks.

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug