LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-08-2008, 12:35 AM   #31
Jurrian
Member
 
Registered: Sep 2008
Posts: 58

Original Poster
Rep: Reputation: 15

Hi,

I tried to start bash, with the following output:

# /bin/bash -sc /etc/profile


BusyBox v1.9.1 (2008-04-11 15:22:42 EDT) built-in shell (ash)
Enter 'help' for a list of built-in commands.

/bin/sh: /etc/profile: Permission denied

So that wasn't of any help.

You are saying that because I use telnet, the rcS script is not working perfectly. So whenever I minicom to the board, should it work correctly then?

And there are enough possibilities to rebuild the kernel, so ruining my ass is not the worst thing to happen, as long as the board keeps living

You're saying I should change the /bin/bash in you're small script right? Though I can rebuild, I don't want to if not needed.

Thanx for help again,

Jurrian
 
Old 10-08-2008, 12:51 AM   #32
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 61
Re: telnet. No, I was saying that because telnetd is responsible for launching login, which wipes out ALL environment variables, the shell started by login does not inherit any environment variables you set inside rcS. And because the shell created by login is not a login shell, your profiles are not read. Thus, no way to pass your environment variable. The only way I could see was to modify the telnetd program to call login -p instead of just login, which allows you to pass environment variables.

Alternatively, you could modify either the login program, or the shell program.

I don't know what your getty's will do - there is a configuration file that instructs those getty's on what to do. Check the documentation for busybox regarding gettydefs.

No need to rebuild a kernel - this is a simple problem with the programs indicated thus far.

Now, with all this said, you might want to ask once for good measure on the busybox forums or mailing list. Perhaps they will give you an easy answer I didn't find.
 
Old 10-08-2008, 12:55 AM   #33
Jurrian
Member
 
Registered: Sep 2008
Posts: 58

Original Poster
Rep: Reputation: 15
I have send an e-mail trough the mailing list, and I am waiting for response.

I am going to try to add the lines to /bin/sh now.

Thanx,

Jurrian
 
Old 10-08-2008, 12:57 AM   #34
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 61
I found this thread for you:

http://busybox.net/lists/busybox/2007-July.txt

Search "set some environmental"

But the responses appear to me that you've already tried this. Let us know what you find.
 
Old 10-08-2008, 01:05 AM   #35
Jurrian
Member
 
Registered: Sep 2008
Posts: 58

Original Poster
Rep: Reputation: 15
edititing the bin/bash file (which linked me to change the bin/sh file), actually did the trick.

To prevent me from ruining the /bin/sh file however, I want to create a link in that script to another script in which I can set my variables correct.

Would that be like

ENV = ~/.loginscript
export ENV??

Or would that not work?
 
Old 10-08-2008, 01:09 AM   #36
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 61
I'm not sure I understand - is /bin/bash a script, that runs another shell subsequently? If so, please show the contents of /bin/bash. I hadn't considered that /bin/bash was just a script, as that would be very unusual.
 
Old 10-08-2008, 01:13 AM   #37
Jurrian
Member
 
Registered: Sep 2008
Posts: 58

Original Poster
Rep: Reputation: 15
My /bin/bash:

# cat /bin/bash
#!/bin/sh ## original

#Setting DISPLAY variable and TSLIB_DEVICE

DISPLAY=:0
export DISPLAY

TSLIB_TSDEVICE=/dev/event0
export TSLIB_TSDEVICE

exec /bin/sh $* ## original

Could you tell me how to create the link as mentioned in my previous post?
 
Old 10-08-2008, 01:18 AM   #38
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 61
Great, this should work fine.

If /bin/bash is a symlink or hard link to /bin/sh, then they are one and the same as far as execution is concerned.

You can just add your lines:

ENV = ~/.loginscript
export ENV??

to the file.

If you want two different files, one /bin/bash and one /bin/sh, which different content, you need to delete either the symlink, or the /bin/bash hard link. Then, copy /bin/sh to /bin/bash, and make your changes to /bin/bash.
 
Old 10-08-2008, 01:28 AM   #39
Jurrian
Member
 
Registered: Sep 2008
Posts: 58

Original Poster
Rep: Reputation: 15
Well, it worked, until I replaced with the link.

This are my files, what am I doing wrong?

# cat ~/.loginscript
#Setting DISPLAY correct

DISPLAY=:0
export DISPLAY

#Set TSLIB_TSDEVICE correct

TSLIB_TSDEVICE=/dev/event0
export TSLIB_TSDEVICE


# cat /bin/bash
#!/bin/sh

#Creating a link to script that gets executed on boot

ENV = ~/.loginscript
export ENV

exec /bin/sh $*
 
Old 10-08-2008, 01:44 AM   #40
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 61
Variable assignments do not accept spaces:

ENV=~/.loginscript

Perhaps you really want to just source the login script:

Code:
. ~/.loginscript

exec /bin/sh $*
Use proper terminology - you are not "creating a link", you are setting an environment variable.
 
Old 10-08-2008, 01:55 AM   #41
Jurrian
Member
 
Registered: Sep 2008
Posts: 58

Original Poster
Rep: Reputation: 15
removing the spaces works, however . ~/loginscript doesn't work, when booting I get:

/bin/bash: .: line 8: can't open //.loginscript

Every 5 seconds, a ctrl c stops it and I can login, but no variables anymore, I also tried .~/loginscript without succes.
 
Old 10-08-2008, 02:02 AM   #42
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 61
Sorry - edited.

Is the ~/.loginscript in the correct home directory for the given user?

Last edited by Mr. C.; 10-08-2008 at 02:03 AM.
 
Old 10-08-2008, 02:12 AM   #43
Jurrian
Member
 
Registered: Sep 2008
Posts: 58

Original Poster
Rep: Reputation: 15
there's only a root user, so I suppose it is.
 
Old 10-08-2008, 02:21 AM   #44
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 61
The command :

. filename

reads the contents of filename into the current shell context. The command is a dot, followed by a single argument filename.

Using /bin/sh as a shell, can you successfully run the command? :

Code:
. ~/.loginscript
 
Old 10-08-2008, 02:26 AM   #45
Jurrian
Member
 
Registered: Sep 2008
Posts: 58

Original Poster
Rep: Reputation: 15
I couldn't run the command, it said I wasn't allowed, so I edited the rights with chmod 777, and I could run it. After rebooting I still get the error

/bin/bash: .: line 8: can't open //.loginscript

After ctrl + c and login the commands are set however, how come I still get the error message?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to check in a script whether the shell is login or non login? frankie_DJ Programming 7 10-21-2015 10:09 AM
login script btaylor1988 Linux - Server 8 09-12-2007 08:22 AM
Need a login script stefaandk Linux - Newbie 4 01-05-2006 04:24 PM
login script nin881 Slackware 3 06-11-2005 02:21 AM
Login script unclejessie77 Programming 5 02-24-2005 12:30 PM


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

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration