| Author |
Message |
Argolance

Joined: 06 Jan 2008 Posts: 1360 Location: PORT-BRILLET (Mayenne - France)
|
Posted: Sun 21 Feb 2010, 10:32 Post subject:
Pet package 'pinstall.sh' problem! |
|
Hello everybody!
I created a pet package that needs a pinstall.sh file to copy the right localized file to /root: Depending on the actual locale used by the system, this file should be copied from 'myapp/menus/en/' or 'myapp/menus/fr/' directory. ...Should be but is unfortunately not! | Code: | | cp -f ${SOURCE}/menus/"${LANG:0:2}"/.jwmrc-tray_3in1 /root/.jwmrc-tray; | Looking at xerrs.log, I get:
| Quote: | cannot stat /usr/local/myapp/menu/C/.jwmrc-tray_3in1 not such a file... etc. | Why this C directory when I should get 'en' or 'fr' from the variable ${LANG:0:2}? Running the pinstall.sh alone after installation, the right directory is identified and the right file correctly copied to root!
What's going wrong Doctor?
Thank you!
|
|
Back to top
|
|
 |
seaside
Joined: 11 Apr 2007 Posts: 832
|
Posted: Sun 21 Feb 2010, 12:58 Post subject:
|
|
Argolance,
| Code: | | cp -f ${SOURCE}/menus/"${LANG:0:2}"/.jwmrc-tray_3in1 /root/.jwmrc-tray; |
It appears that you are using ${SOURCE} as a path variable and "SOURCE" is also a command.
You might try setting a variable $PROGRAMPATH instead of SOURCE and see if that works.
Bon Chance,
s
|
|
Back to top
|
|
 |
Argolance

Joined: 06 Jan 2008 Posts: 1360 Location: PORT-BRILLET (Mayenne - France)
|
Posted: Sun 21 Feb 2010, 14:18 Post subject:
|
|
Thank's for reply!
@seaside
I tried this: | Code: | | cp -f ${SCRIPT_DIR}/menus/"${LANG:0:2}"/.jwmrc-tray_3in1 /root/.jwmrc-tray; |
... and this (without quotes!) | Code: | | cp -f ${SCRIPT_DIR}/menus/${LANG:0:2}/.jwmrc-tray_3in1 /root/.jwmrc-tray; |
... and got this:
| Quote: | | cp: cannot stat '/usr/local/myapp/menus/C/.jwmrc-tray_3in1'... |
Where does this 'C' come from? Very strange indeed!
Don't understand...
|
|
Back to top
|
|
 |
seaside
Joined: 11 Apr 2007 Posts: 832
|
Posted: Sun 21 Feb 2010, 15:52 Post subject:
|
|
Argolance,
The only other possibility I can think of is that somehow the LANG variable may be set to "C". I think a number of scripts have "LANG=C" in them to run everything faster.
Cheers,
s
|
|
Back to top
|
|
 |
Argolance

Joined: 06 Jan 2008 Posts: 1360 Location: PORT-BRILLET (Mayenne - France)
|
Posted: Sun 21 Feb 2010, 19:41 Post subject:
|
|
Hello!
Is there nothing else to do? Do any command or code line exist to get the actual locale of the system without using this $LANG variable? Can such a strange thing happen?
Thanks.
Regards.
|
|
Back to top
|
|
 |
big_bass

Joined: 13 Aug 2007 Posts: 1736
|
Posted: Sun 21 Feb 2010, 20:34 Post subject:
|
|
Argolance
and see what is LANG=
I have this
LANG=en_US
Joe
_________________ slackware 14
|
|
Back to top
|
|
 |
seaside
Joined: 11 Apr 2007 Posts: 832
|
Posted: Sun 21 Feb 2010, 23:56 Post subject:
|
|
Argolance,
Since the "pinstall.sc" is under the control of the pet installer and the variable has been set to LANG=C, the normal LANG environment variable isn't seen.
An alternative is to put your code into a helper startup script which would run once when the program command is given.
The code runs properly when YOU run pinstall.sc in a terminal because "echo $LANG" will supply the default ENV LANG language.
Cheers,
s
|
|
Back to top
|
|
 |
big_bass

Joined: 13 Aug 2007 Posts: 1736
|
Posted: Mon 22 Feb 2010, 10:10 Post subject:
|
|
Argolance
this is better
if another script exported LANG=C
and you ran a child process from it you get it in the echo
I don't know what version your running or anything else about your code
but only from what little info you posted
the info I posted will pin point the problem
Joe
_________________ slackware 14
|
|
Back to top
|
|
 |
big_bass

Joined: 13 Aug 2007 Posts: 1736
|
Posted: Mon 22 Feb 2010, 10:10 Post subject:
|
|
Argolance
well it double posted so
here's a new thought
| Code: |
DEFAULTLANG=(`env |grep "LANG="`)
if [ $DEFAULTLANG = "LANG=en_US" ]; then
echo $DEFAULTLANG
elif [ $DEFAULTLANG = "LANG=C" ]; then
echo "you got borked :D"
fi |
Joe
_________________ slackware 14
|
|
Back to top
|
|
 |
8-bit

Joined: 03 Apr 2007 Posts: 3012 Location: Oregon
|
Posted: Tue 23 Feb 2010, 01:26 Post subject:
|
|
I have been following along and I selected your (Big Bass) code snipit and pasted it in a terminal.
The result was "en_US"
That is the first time I have pasted multiple lines of code in a terminal anyway.
So I was curious.
|
|
Back to top
|
|
 |
amigo
Joined: 02 Apr 2007 Posts: 1757
|
Posted: Tue 23 Feb 2010, 04:25 Post subject:
|
|
As seaside said, the installer sets LANG=C so that sorting is more predictable, so it's a 'bug' in the installer. There is a way around this. Insetad of exporting the LANG variable, it can be set only when needed:
LANG=C sort file > new-file
|
|
Back to top
|
|
 |
Argolance

Joined: 06 Jan 2008 Posts: 1360 Location: PORT-BRILLET (Mayenne - France)
|
Posted: Tue 23 Feb 2010, 10:06 Post subject:
|
|
Hello everybody,
Thank you a lot for your replies!
... I finally gave up and my application will be installed in English by default! User can localize it through the application itself while simply clicking on a button... Nevertheless, please, I would like to know how to do this: | Quote: | | LANG=C sort file > new-file | Need some explanations!
@big_bass
... Was curious about what 'borked' means. I found 'To have totally f...d something up'... Yes indeed but slightly, slightly!
Thank you!
|
|
Back to top
|
|
 |
technosaurus

Joined: 18 May 2008 Posts: 3843
|
Posted: Tue 23 Feb 2010, 13:29 Post subject:
|
|
some longer scripts may set LANG=C for about a 5X speed increase (search Barry's blog for details)... but not save the original LANG and set it back to preferred ... perhaps the preferred language is also stored somewhere in /etc ????
_________________ Puppy Web Desktop Now with pet packages - Pet Packaging 100 & 101
|
|
Back to top
|
|
 |
big_bass

Joined: 13 Aug 2007 Posts: 1736
|
Posted: Tue 23 Feb 2010, 13:30 Post subject:
|
|
Hey Argolance
give it another try after a cup of coffee
if you want some code to change locals heres a good link
http://www.murga-linux.com/puppy/viewtopic.php?t=51630
there's a lot of code there to sort through 16 pages
but you may just need to try it first
TIP : when you plan to try again post the code you are having problems with more people can offer
help / suggestions
Joe
_________________ slackware 14
|
|
Back to top
|
|
 |
seaside
Joined: 11 Apr 2007 Posts: 832
|
Posted: Tue 23 Feb 2010, 13:34 Post subject:
|
|
Argolance,
Sorry you ran into this difficulty. The change that Amigo mentions "LANG=C sort file > new-file" would have to be made to the Petget installer program and not by your program.
As I mentioned before, you could provide a "helper" script alternative like this -
Rename your execute file to "ProgramName-bin"
Make up a script as follows: (pseudo code)
| Code: | if not exist MARKERFILE; then
cp xxxx xxxx (your code)
echo >MARKERFILE
fi
ProgramName-bin |
Name the script "ProgramName" , and put it in a program path directory.
This will run the setup copy code and establish the ENV LANG only once, and then execute the program.
Maybe big_bass will provide you with a more precise translation of "borked" than Google
Cheers,
s
|
|
Back to top
|
|
 |
|