Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (4) </ [1] 2 3 4 >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: linuxrc, How to use bash in linuxrc not ash?< Next Oldest | Next Newest >
MrUmunhum Offline





Group: Members
Posts: 23
Joined: Feb. 2006
Posted: Nov. 21 2006,12:47 QUOTE

I am trying to change linuxrc to use bash and not ash.  It is not working.
I have added bash to the /static dir and changed the first line in linuxrc from sh
to bash.

ash only supports a few commands and the parsing is broken.

any ideas?
Back to top
Profile PM 
^thehatsrule^ Offline





Group: Members
Posts: 3275
Joined: July 2006
Posted: Nov. 21 2006,14:57 QUOTE

Quote
It is not working.
What goes wrong?

If you have /static/bash then you should also replace the symlink from sh to point to it.  The scripts could be called by sh which would override the shebang.  Of course the easiest way to tell if whatever you're doing will work would be to replace ash completely.

Quote
and the parsing is broken.
parsing of..?

Anyhow, reason for ash: fast(er) boot.
Back to top
Profile PM 
MrUmunhum Offline





Group: Members
Posts: 23
Joined: Feb. 2006
Posted: Nov. 21 2006,19:54 QUOTE

Quote (^thehatsrule^ @ Nov. 21 2006,09:57)
Quote
It is not working.
What goes wrong?

If you have /static/bash then you should also replace the symlink from sh to point to it.  The scripts could be called by sh which would override the shebang.  Of course the easiest way to tell if whatever you're doing will work would be to replace ash completely.

Quote
and the parsing is broken.
parsing of..?

Anyhow, reason for ash: fast(er) boot.

Parsing like:

 junk=${CMDLINE}
 junk="${junk##parm=}"      <== fails here
 junk="${junk%%[     ]*}"

What I am doing is making a linuxrc that supports PXE booting with NFS mounting of KNOPPIX FS.

I am currently stick on getting the NFS mount to work.  I have loaded nfs.o,
lockd.o and sunrpc.o, but something is missing and the NFS mount fails.

Since the console to ttyS0 fails, it is hard to debug my code.  Ash is very limited and the messages falls off of the screen.

The failure is a kernel panic after failure to change to /initrd ( I think ).
Back to top
Profile PM 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Nov. 21 2006,20:31 QUOTE

I think junk="${junk##parm=}" can be rewritten for ash like this:
junk=`echo ${junk} | sed 's/parm=//'`
...or something similar...i just pulled this out of my butt.

You're also going to have trouble with ${junk%%[     ]*}:
junk=`echo ${junk} | sed 's/ *$//'` (guessing again...not sure what "[   ]*" is)

These issues are not a result of ash being broken, but are because bash has added features that are not available in ash.  The string manipulation above is an example of bash-specific script.


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
^thehatsrule^ Offline





Group: Members
Posts: 3275
Joined: July 2006
Posted: Nov. 21 2006,21:03 QUOTE

Ah yes.. the 'bash-isms'

If you really don't care about about speed and efficiency I suppose you could try to use bash instead.

Otherwise, I'd suggest for you to replace whatever scripting you're doing with replacement commands or use another implementation.  If you decide to go this way, you could paste out your script (or snippets of) to show what you're trying to do with the code and we can try to help.
Back to top
Profile PM 
18 replies since Nov. 21 2006,12:47 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (4) </ [1] 2 3 4 >/
reply to topic new topic new poll
Quick Reply: linuxrc

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code