Review your favorite Linux distribution.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 09-27-2005, 05:44 AM   #1
Registered: Nov 2004
Location: Hyderabad, India
Distribution: Fedora Core - II, RedHat - 9
Posts: 45

Rep: Reputation: 15
Unhappy installler shell script

Hi all,
I am installing various packages for a tv tuner card, which contains various tar.gz files.
These files are required to be untarred and then ./configure, make and make install as usual.
I want a script which should install these packages, before intsalling packages it should also check the list of installed packages. Regarding to scripts I don't have much exposure, can any body point me to some good example of the same kind.

I am also willing to have one tar.gz with shell script which contains the complete group of tar.gz required to install my packages. Is it possible to do this, if yes how to do it ?

I have goen through the tutorial on bash shell script, still not getting how to solve this problem in short time !!
Thanx in advance
Old 09-27-2005, 09:23 PM   #2
Registered: Aug 2005
Distribution: Gentoo
Posts: 228

Rep: Reputation: 31
I can give you a couple hints to get you on your way:

cut the last line of the output of the tar xvzf process out and strip it down to everything before the /, change directory to that stored value and run ./configure && make && make install.


declare -r DIRECTORY=$(tar xvzf $1 | grep -m 1 Makefile | cut -d'/' -f1)
./configure && make && make install
Perhaps something like that will do the trick.

DIRECTORY will hold the output of what is in the paranthesis, which is taking (or piping) the output of the tar command to the grep, only allowing one line to match (in case you get multiple Makefiles), and then cutting that one line up by the slash (/) and stripping off anything after and including the first match (or in this case, the first slash). Then it changes the directory up and configures, makes, and make installs. Good luck!

Edit: A side note, you probably know, but I will describe it for clarity. $1 means the OPTION included after the script name, so, in this case, you will have to run a file at a time. If you named the script install_script, then you would have to type:

# install_script <filename>.tar.gz


Last edited by flower.Hercules; 09-27-2005 at 09:27 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Shell script inside shell script treotan Linux - General 4 02-19-2009 06:34 AM
Shell Scripting: Getting a pid and killing it via a shell script topcat Programming 15 10-28-2007 02:14 AM
shell script problem, want to use shell script auto update IP~! singying304 Programming 4 11-29-2005 05:32 PM
creating shell script that executes as root regardless of who runs the script? m3kgt Linux - General 13 06-04-2004 10:23 PM
[SHELL SCRIPT] Write at the right of the shell window Creak Linux - General 2 04-02-2004 03:00 PM > Forums > Non-*NIX Forums > Programming

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

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration