LinuxQuestions.org
Review your favorite Linux distribution.
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 09-27-2005, 06:44 AM   #1
nirav.jani
Member
 
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 tldp.org tutorial on bash shell script, still not getting how to solve this problem in short time !!
Thanx in advance
nj
 
Old 09-27-2005, 10:23 PM   #2
flower.Hercules
Member
 
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.

Code:
#!/bin/bash

declare -r DIRECTORY=$(tar xvzf $1 | grep -m 1 Makefile | cut -d'/' -f1)
cd ${DIRECTORY}
./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

HTH

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


Reply


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


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration