export PRINTER=lp in bootlocal.sh not working


Forum: Other Help Topics
Topic: export PRINTER=lp in bootlocal.sh not working
started by: jhsu

Posted by jhsu on July 04 2008,05:24
I'm having a series of printer problems.  I'll focus on just one here.  And no, the people on the printer forum weren't able to explain this.

As instructed, I put the command "export PRINTER=lp" in the opt/bootlocal.sh file so that I wouldn't have to type it up manually every time I booted up.

Why does DSL refuse to execute this command when I boot up?  I know that it's not being executed, because typing "env" in a shell shows NO "PRINTER=lp" in the output.

The commands I put in opt/powerdown.sh do execute when I power down.  So why aren't the commands I put in opt/bootlocal.sh executing as well when i start up?

Posted by Juanito on July 04 2008,05:33
Wouldn't you need to put "export PRINTER=lp" somewhere where it would be exported system-wide? .bashrc maybe?
Posted by roberts on July 04 2008,05:50
You should put that export in .bash_profile or .bashrc

.bashrc is run everytime you start a shell
.bash_profile is when you login in.

You can see examples of other exports by looking at those two files.

Posted by ^thehatsrule^ on July 04 2008,07:00
You know you could just bump your old threads... might be helpful to visit them too - will also explain your questions.  Even though bootlocal was initial suggestion, other files (such as the same advice given above) were also given as suggestions.  But I guess some things never seem to get done :P

Just to exactly make sure where variables can be propagated from, I just edited a couple files and used the mydsl system in a DSL 4.3 system.
Conclusion: it should work in
Code Sample
/etc/profile
~/.bash_profile
~/.bashrc
/etc/bash.bashrc
~/.xinitrc
where the top of the list is probably the better one to use - unless you just want it for the current user.

fwiw, /etc/bashrc did not work.  My guess is that bash.bashrc took precedence.

If you do not know how to edit (any of) these files, do not hesitate to ask.

Posted by jhsu on July 04 2008,16:33
Now I'm confused.  Is the export command supposed to be in .bash_profile, bash.bashrc, .xinitrc, or .bashrc?  Exactly what are these files for?  Some of these files are in more than one directory, so which is the appropriate one to edit?

What's the startup mechanism, and why is there so much confusing information?  All I want here is to get a certain command to execute AUTOMATICALLY EVERY TIME I boot up.

I'd make the changes right now, but I'm currently in a long download that I can't interrupt right now.

Posted by ^thehatsrule^ on July 04 2008,17:38
Quote
Is the export command supposed to be in .bash_profile, bash.bashrc, .xinitrc, or .bashrc? <snip> Some of these files are in more than one directory, so which is the appropriate one to edit?
Quote
Conclusion: it should work in <snip> where the top of the list is probably the better one to use - unless you just want it for the current user.


Quote
Exactly what are these files for? <snip> What's the startup mechanism, and why is there so much confusing information?
If you really want to know, looking up the bash manpage could be a good place to start.

Quote
All I want here is to get a certain command to execute AUTOMATICALLY EVERY TIME I boot up.
You're trying to set a environmental variable that propagates (which is different).

Posted by jhsu on July 04 2008,18:08
OK, I see that /etc/bashrc is the file.  I know this is the file that executes automatically, because I see it contains:
alias which="type -path"
alias dir="ls"

And typing "alias" confirms that these aliases were set.

So how do I edit the file given that I'm not allowed to do so?  The file permissions for the file and directory shouldn't be stopping me (full permission provided), so what's the problem?

Posted by ^thehatsrule^ on July 04 2008,18:36
Quote
OK, I see that /etc/bashrc is the file.
Where do you see /etc/bashrc in the previously posted list?  Did you read through the whole post?

Posted by jhsu on July 04 2008,19:41
Why isn't anyone here able to give a straight answer?  All I'm trying to do is figure out what file to put the command "export PRINTER=lp" so that it automatically executes every time so I don't have to do it manually.  And that's only ONE step of several more steps I need to be able to print without having to go through the setup mumbo jumbo EVERY TIME.

I don't know what you expect me to do.  The pdf document on printing leaves out some important details.  The book provides even fewer details.  Everyone here gives cryptic and incomplete instructions.  Does anyone have any idea of what's going on?  I'm starting to get the impression that nobody really understands the printing mechanism in DSL but is unwilling to say so.

Posted by ^thehatsrule^ on July 04 2008,20:49
OK, I guess being new to a shell environment can be hard at times, but you must realize that the docs, etc. are mostly out-of-sync with the current DSL versions.  I won't comment on the rest of your post.

Here's a script to do some implementation that may work.  (OK, I'm assuming you know how to use one though).  Just off the top of my head though - not tested.  And its probably best to run it as root.
Code Sample
#!/bin/sh
tmp=`mktemp -d ${TMPDIR}/myprofile.XXXXXX `
cd $tmp
mkdir etc
cat /etc/profile > etc/profile
printf "PRINTER=lp\nexport PRINTER\n" >> etc/profile
tar zcf `cat /opt/.mydsl_dir `/myprofile.tar.gz etc/profile --no-recursion
rm -rf $tmp

Posted by jhsu on July 05 2008,21:31
How far back do I need to go for the documentation to work?  I thought I was way behind because I'm only using version 3.4.8, but since the documentation isn't keeping up with the changes, I have no choice but to go back to an earlier version so that the documentation is valid.
Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.