some bash help

BoBB plug-discuss@lists.plug.phoenix.az.us
Sat, 1 Mar 2003 14:02:44 -0700


Yeah after a little while of being frustrated I figured that might be
the problem so I wrote this and it worked fine :)

[ -f /home/bob/.splash ] && \
        [ -f /proc/splash ] && \
                for TTY in `/usr/bin/seq 0 5`; \
                        do /usr/bin/splash -s -u $TTY /usr/share/bootsplash-0.4/console.cfg; \
                done; \
        [ -f /home/bob/.splash ] && /bin/rm /home/bob/.splash; \

And I set local.start to touch /home/bob/.splash and chmod it to 666 so
I can remove it when I login as a user. Now I've got cool looking boot
messages and a cool looking console :)

On Sat, Mar 01, 2003 at 08:34:09AM -0700, Bill Jonas wrote:
> On Fri, Feb 28, 2003 at 04:07:38PM -0700, BoBB wrote:
> > if [ $SPLASH ]
> > then
> >         [ -f /proc/splash ] && \
> > 		# switch to a usable image on all consoles \
> > 		for TTY in `/usr/bin/seq 0 5`; \
> > 	        	do /usr/bin/splash -s -u $TTY /usr/share/bootsplash-0.4/console.cfg; \
> > 		done; \
> > 	export SPLASH=""
> > fi
> 
> $SPLASH only gets set in the user's login shell's environment.
> 
> Think of it this way: init is the parent of a getty, which runs the
> login program, which executes your shell if it's satisfied that you
> belong on the system (ie, you give it a valid username and password
> combination).  Your shell runs, sources /etc/profile (and your personal
> .profile or .bash_profile), which has commands that set up your
> environment.  In the mean time, the getty/login instances running on
> other virtual consoles are unaffected by the change of environment in
> this one shell, and init (which respawns the getty when you log out and
> your shell exits) isn't either.
> 
> Perhaps a better way to do it would be to create a file upon login.  If
> there will be other users on the system, this could get a little ugly,
> as /tmp and /var/tmp have the sticky bit set, thus denying users the
> privilege of deleting files created by other users.
> 
> In any case, that's why it doesn't work.
> 
> > #!/bin/bash
> > if [ $SPLASH ]
> > then
> >         echo works
> > fi
> > 	
> > and it works as expected, export SPLASH="" causes it to do nothing,
> > export SPLASH="yes" prints 'works' anyone have any ideas?
> 
> $SPLASH, again, is only affected in your one particular login
> environment by the things you do in that environment.  So yes, that
> script will work as expected when started by hand.
> 
> I'd suggest either touching /var/tmp/splash and removing it when you log
> out, or making that file world-writable and writing a value to it.
> (Perhaps you could do something like "num=`cat /var/tmp/splash`; echo
> $[$num+1] >/var/tmp/splash" and do $num-1 upon logout.  That way you
> could see how many users are logged in.  Just an idea.
> 
> -- 
> Bill Jonas    *    bill@billjonas.com    *    http://www.billjonas.com/
> "It's a dangerous business, Frodo, going out your front door.  You step
> into the Road,  and if you don't keep your feet,  there  is  no knowing
> where you might be swept off to."  --  Bilbo Baggins



-- 
/*  BoBB
 *  AIM: Jodokast49 ICQ: 151495596
 *  Jabber: BoBB@jabber.com
 *  http://knightsofchaos.com/~BoBB/new/
 */