LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-29-2009, 01:49 AM   #1
mickle026
LQ Newbie
 
Registered: Aug 2009
Posts: 4

Rep: Reputation: 0
bash scripting - help?


Can anyone tell me how i can 'export' a directory to use another via programs - I will be extremely grateful.

I will explain.

I am testing some software on a ppc device that has software already on it which i don't want to remove. Its kernel runs, then proprietry interface (similar to nano-x runs), I want to kill the nano-x and run my software.

I have my software in another folder and want to use my share folder instead of the one in the one in the rom. I can run my app, by killing rcS and the interface, then run mine, but its looking for files in /share and i dont want it to. Its not a matter of recoding my app because it uses lots of shared libraries that also look in /share.

I have all other files working fine but instead of the machine reading /share (which is read only) I want to tell the machine that /share is located /mmc_card/share. I cannot backup the folder and symlinking it because its read only (the only user is root so its not a matter of running chown - the hardware is read only)

I can find lots of information of exporting environment variables such as:
EXPORT myfile=`/home/user/app.so'

but i want to
EXPORT /share=`/mmc_media/share'

so that all systems see /mmc_media/share as if its actually /share.

Can I do this in bash??

thanks
 
Old 08-29-2009, 02:02 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Did you try it?
I think you will find that the statement "export /share=....." simply creates and exports a variable named "/share", and not an entry in the filesystem tree.

I missed why you cannot make a link---root can create symlinks regardless of how permissions are set (I'm pretty sure......)
 
Old 08-29-2009, 02:13 AM   #3
mickle026
LQ Newbie
 
Registered: Aug 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by pixellany View Post
Did you try it?
I think you will find that the statement "export /share=....." simply creates and exports a variable named "/share", and not an entry in the filesystem tree.

I missed why you cannot make a link---root can create symlinks regardless of how permissions are set (I'm pretty sure......)
Yeah I agree with that, but the filesystem is in a rom (read only memory) , it cannot be changed with chown or chmod without changing on the pc, creating new firmware and flashing the device. So no i cannot be linked directly.

export /share=`.....`

gives error:209 .. I cant remember exactly (as im not connected to the device at the moment) but it says the syntax is wrong. I think i cannot use '/' there on the left of the brackets.

Its the filesystem tree i want to "dummy" as /mmc_media/share..

thanks for the reply though
 
Old 08-29-2009, 03:09 AM   #4
Disillusionist
Senior Member
 
Registered: Aug 2004
Location: England
Distribution: Ubuntu
Posts: 1,039

Rep: Reputation: 98
What about using chroot?

I realise that this is a lot more work than what you were probably looking for, but it should allow you to do what you need.
 
Old 08-29-2009, 04:26 AM   #5
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
A bash variable name must conform to the OpenGroup's definition of "name" which is a word consisting solely of underscores, digits, and alphabetics from the portable character set. The first character of a name is not a digit. This does not include "/".
 
Old 08-29-2009, 04:29 AM   #6
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by mickle026 View Post
... but its looking for files in /share and i dont want it to. Its not a matter of recoding my app because it uses lots of shared libraries that also look in /share.
"As ye sow, so shall ye reap". Sorry.
 
Old 08-29-2009, 08:16 AM   #7
mickle026
LQ Newbie
 
Registered: Aug 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Disillusionist View Post
What about using chroot?

I realise that this is a lot more work than what you were probably looking for, but it should allow you to do what you need.
Im going to look into that later today, thanks for the suggestion. I have never used it, therefore dont know anything (at present) about it.

Changing the root path is probably my only solution, and its not a problem to link back to things that were in the orignal root path.

Thanks again for the suggestion.
 
Old 08-29-2009, 02:30 PM   #8
mickle026
LQ Newbie
 
Registered: Aug 2009
Posts: 4

Original Poster
Rep: Reputation: 0
chroot is not is the toolbox (busybox) of the flash, so its also not an option unless I can find it cross compiled individually.

I found a script for rom devices involving setting up a loop device and faking the memory partition elsewhere, im going to take a look at that.

thanks
 
Old 08-29-2009, 05:12 PM   #9
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Perhaps you might consider flashing a more capable version of busybox. (Unless space considerations preclude it.)

The version of busybox on my Fedora 11 system (busybox.anacondia) implements both ln and chroot, which leads me to suspect that your busybox capabilities depend on the options you select when you compile it.

Note that the above is speculation on my part, not actual knowledge.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading a bash variable in bash scripting problem freeindy Programming 3 11-27-2008 02:29 AM
need help on bash scripting stympman Linux - Newbie 3 10-20-2008 06:20 PM
help bash scripting sh4d0w13 Linux - Newbie 5 08-15-2005 02:02 AM
Bash scripting Gunslinger_ROL Programming 5 09-28-2004 11:37 AM
BASH Scripting ? eroica Programming 3 06-07-2004 07:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration