LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-02-2007, 04:16 AM   #1
munna_dude
Member
 
Registered: Dec 2006
Posts: 362

Rep: Reputation: 30
linux script


hi all
i would like to write some code in make script( in gtk make file, linux script).
i am including libgtkembedmoz.so and libxpcom.so to the make file....
there i have to write the condition ... that have to check, whether the mozilla installed or not ....

if it is installed
then do this
Code:
NULL
here am storing the mozilla-version in mozlib.

else

it have to check mozilla-seamonkey is there or not..
if it is installed
then do this
Code:
NULL
here am storing the mozilla-seamonkey-version in mozlib.

else

it have to check firefox is there or not
if it is installed
then do this
Code:
NULL
here am storing the firefox-version in mozlib.

is it possible to write in make file using linux script...

please help me

thank you in advance

Last edited by munna_dude; 08-11-2007 at 04:46 AM.
 
Old 08-02-2007, 12:08 PM   #2
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

Rep: Reputation: 69
If the question is "Is it possible?" the answer is "yes, it is". I would do it (I hope you have read man bash..) by
if rpm -qi mozilla | grep 'Size: ' ; then
#mozilla variant;
else if rpm -qi mozilla-seamonkey | grep 'Size: ' ; then
#...
fi
 
Old 08-02-2007, 11:17 PM   #3
munna_dude
Member
 
Registered: Dec 2006
Posts: 362

Original Poster
Rep: Reputation: 30
i did this but failed... please give some code..
for this...
i think it is easy to write but am confusing to write the code.. only the checking part is remained(if condithion to check)...


please help me

thank you in advance

Last edited by munna_dude; 08-11-2007 at 04:58 AM.
 
Old 08-03-2007, 12:57 AM   #4
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

Rep: Reputation: 69
Does

if rpm -qi mozilla | grep 'Size: ' ; then
echo mozilla
elif rpm -qi mozilla-seamonkey | grep 'Size: ' ; then
echo seamonkey
fi

work (ignoring firefox variant)?
 
Old 08-03-2007, 03:53 AM   #5
munna_dude
Member
 
Registered: Dec 2006
Posts: 362

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by raskin
Does
NULL
work (ignoring firefox variant)?
i tried with your example...
but failed..
Code:
NULL
the out put is
mozilla

actually i removed mozilla and seamonkey was installed.

what i ve to do...

please help me

thank you in advance

Last edited by munna_dude; 08-11-2007 at 04:47 AM.
 
Old 08-03-2007, 04:04 AM   #6
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

Rep: Reputation: 69
if rpm -ql mozilla | grep /usr/lib/mozilla- | tail -1 | cut -d/ -f4 ; then

obviously it succeeds on mozilla-seamonkey; also you want only to check if some string exists in the rpm output, so try

if rpm -ql mozilla | grep -v seamonkey | grep /usr/lib/mozilla ; then

in its place.
 
Old 08-03-2007, 04:22 AM   #7
munna_dude
Member
 
Registered: Dec 2006
Posts: 362

Original Poster
Rep: Reputation: 30
sorry.. no output...

the perpous of is to know if firefox(mozilla or seamonkey and copy this and run in terminal u can understand what exactly i needed ) is exist or not .and if exist ... it tells the current installed version of firefox..


i tried this

Code:
NULL
actually the i have to do this like the above code...
please make me correct..

finally the out put comes in "mozlib" this have to use in library path... dynamically...

please help me

thank you in advance

Last edited by munna_dude; 08-11-2007 at 04:48 AM.
 
Old 08-03-2007, 04:30 AM   #8
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

Rep: Reputation: 69
Maybe you do not need to distinguish mozilla and mozilla-seamonkey? You do exactly the same for them. Try
Code:
k=" "
k=`rpm -ql mozilla | grep /usr/lib/mozilla- | tail -1 | cut -d/ -f4`
path=`whereis -SBM $(k) | cut -d" " -f2 `
mozlib := $(shell $(path))

if test -z "$mozlib"; then
k=" "
k=`rpm -ql firefox | grep /usr/lib/firefox- | tail -1 | cut -d/ -f4`
path=`whereis -SBM $(k) | cut -d" " -f2 `
mozlib := $(shell $(path))
fi;
 
Old 08-03-2007, 05:24 AM   #9
munna_dude
Member
 
Registered: Dec 2006
Posts: 362

Original Poster
Rep: Reputation: 30
yes. i wannathis... great code ...
actually my source code is belongs to phone source and it is build in gtk..
it is working in normal(mean i saved this code in a file "one" and compiled in terminal.. it is working..

but i want this code to run in make script(gtk based make file)
i tried this to get the output os "mozlib"

Code:
NULL
thae output of the "mozlib" ill included in lib path i.e.
Quote:
NULL
please observe the bold text..
there i have to include the output of the mozlib.

at present with above script..
it will not taking the output.
and saying that in that place..

how to do this.

please help me

thank you in advance

Last edited by munna_dude; 08-11-2007 at 04:49 AM.
 
Old 08-03-2007, 05:30 AM   #10
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

Rep: Reputation: 69
Write a separate shell script which outputs $mozlib in the end. MOZLIB=$(shell ./get-mozlib) should work.
 
Old 08-03-2007, 06:13 AM   #11
munna_dude
Member
 
Registered: Dec 2006
Posts: 362

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by raskin
Write a separate shell script which outputs $mozlib in the end. MOZLIB=$(shell ./get-mozlib) should work.
sorry to say this....
you are saying that the main script for if condition have to write in seperate code and have to linkup the file with original make file then i have to get the output.. in MOZLIB.. is it...

but i dont know how to do this all...

coz, i am trying this total code in original script.. and i succeded without if codition i.e. it is always taking the firefox....


but this process is wrong.. so that i am trying to check all the browsers... means mozilla and seamonkey and firefox... these are exist or not...

if i could do this..
am very thankfull to you..

this is the ultimatesolution for gtk make script..


please help me

thank you in advance
 
Old 08-03-2007, 06:17 AM   #12
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

Rep: Reputation: 69
To create a shell script, just paste all the code you want it to execute into a file (in this case get-mozlib) and run 'chmod a+x' on this file. I cannot understand how do you want to choose if you have more than one browser installed. So I offer to always run script for mozilla case and if it returns nothing then it will do no harm to try firefox.
 
Old 08-03-2007, 06:54 AM   #13
munna_dude
Member
 
Registered: Dec 2006
Posts: 362

Original Poster
Rep: Reputation: 30
hi..
Code:

the code not working properly...
the output is
Code:

after compiling this code , finally one output have to take..

in this code it is printing two...

actually our code is if seamonkey exists , then it will not check for firefox... but it is printing...

and finally the output have to store in "i";

what i have to do

please help me

thank you in advance

Last edited by munna_dude; 08-11-2007 at 04:49 AM.
 
Old 08-03-2007, 03:29 PM   #14
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

Rep: Reputation: 69
Looks like misuse of whereis. Try
Code:
k=`rpm -ql seamonkey | grep /usr/lib/mozilla-seamonkey | tail -1 | cut -d/ -f2-4`
path=/$k
mozlib=$path
and remove 'echo $k '. The same changes should be done in the second block.
 
Old 08-06-2007, 12:20 AM   #15
munna_dude
Member
 
Registered: Dec 2006
Posts: 362

Original Poster
Rep: Reputation: 30
yeah! this is great....

if i use this code in make file(gtk make script) it is not woking...

i tried this
Code:

at present i have no mozilla installed..

so that it have to linkup with seamonkey ".so" ...

i write the above code...
the output is storing in MOZLIBS..

here MOZLIBS is the LIBRARY ".so" path

what i have to do ...
i would like to write the above script in make file..


please help me

thnak you in advance

Last edited by munna_dude; 08-11-2007 at 04:49 AM.
 
  


Reply



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
same awk script running on linux 7.2 and linux 10 suchi_s Programming 2 11-22-2004 07:47 AM
Converting a Windows Perl script to a Linux Perl script. rubbercash Programming 2 07-19-2004 10:22 AM
linux 9 and java script error - premature end of script header sibil Linux - Newbie 0 01-06-2004 04:21 PM
Exp. Windows/Linux-Script Programmer - Need Linux Programming Mentor! ruttiger Linux - Newbie 2 10-28-2001 11:00 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:05 AM.

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
Open Source Consulting | Domain Registration