Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 27 Aug 2014, 17:31
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Pet package 'pinstall.sh' problem!
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 2 [17 Posts]   Goto page: 1, 2 Next
Author Message
Argolance


Joined: 06 Jan 2008
Posts: 1825
Location: PORT-BRILLET (Mayenne - France)

PostPosted: 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. Shocked
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
View user's profile Send private message Visit poster's website 
seaside

Joined: 11 Apr 2007
Posts: 886

PostPosted: 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
View user's profile Send private message 
Argolance


Joined: 06 Jan 2008
Posts: 1825
Location: PORT-BRILLET (Mayenne - France)

PostPosted: 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
View user's profile Send private message Visit poster's website 
seaside

Joined: 11 Apr 2007
Posts: 886

PostPosted: 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. Very Happy

Cheers,
s
Back to top
View user's profile Send private message 
Argolance


Joined: 06 Jan 2008
Posts: 1825
Location: PORT-BRILLET (Mayenne - France)

PostPosted: 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
View user's profile Send private message Visit poster's website 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Sun 21 Feb 2010, 20:34    Post subject:  

Argolance


Code:

env


and see what is LANG=


I have this
LANG=en_US


Joe

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send private message 
seaside

Joined: 11 Apr 2007
Posts: 886

PostPosted: 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
View user's profile Send private message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Mon 22 Feb 2010, 10:10    Post subject:  

Argolance

this is better
Code:
 env |grep  "LANG="



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

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send private message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: 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 Wink

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send private message 
8-bit


Joined: 03 Apr 2007
Posts: 3364
Location: Oregon

PostPosted: 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
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2236

PostPosted: 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
View user's profile Send private message 
Argolance


Joined: 06 Jan 2008
Posts: 1825
Location: PORT-BRILLET (Mayenne - France)

PostPosted: 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'... Shocked Yes indeed but slightly, slightly!
Thank you!
Back to top
View user's profile Send private message Visit poster's website 
technosaurus


Joined: 18 May 2008
Posts: 4340

PostPosted: 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 ????
_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: 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 Shocked
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

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send private message 
seaside

Joined: 11 Apr 2007
Posts: 886

PostPosted: 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 Very Happy

Cheers,
s
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 2 [17 Posts]   Goto page: 1, 2 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0889s ][ Queries: 12 (0.0144s) ][ GZIP on ]