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 03-10-2015, 04:54 AM   #1
trava90
LQ Newbie
 
Registered: Dec 2014
Distribution: Manjaro/Mint
Posts: 13

Rep: Reputation: 4
Check system requirements in installer shell script


Hi, I have a shell script that I would like to update, but I'm still new to writing scripts, and I haven't been able to find what I'm need on Google, so I thought I would ask here. Currently, the script uses curl to download a precompiled tar.bz2, then extracts it (updating previous versions if necessary) and creates a desktop icon.

My question is, how do I update the script to check the minimum system requirements before downloading the archive (specifically the Linux kernel, glib, gtk, etc.)?

Any help is appreciated! Thank you!

Last edited by trava90; 03-10-2015 at 05:38 AM. Reason: Add additional information
 
Old 03-10-2015, 08:26 AM   #2
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 982
Blog Entries: 2

Rep: Reputation: 244Reputation: 244Reputation: 244
I think it would help to state what distribution and package manager you have.

And assuming you're using a package manager is it really necessary to do automated installation of a tarball as opposed to a package?
 
Old 03-10-2015, 08:35 AM   #3
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
You can use 'uname' command output for kernel version. And for glib, gtk, and etc in general you can use package managers description of installed packages.
But it might be a little difficult. As said in previous post you can instead create a package based on the package manager and you will have dependency resolution easily.
 
Old 03-10-2015, 02:46 PM   #4
trava90
LQ Newbie
 
Registered: Dec 2014
Distribution: Manjaro/Mint
Posts: 13

Original Poster
Rep: Reputation: 4
The program I download and extract isn't available through my distro's (Manjaro) repo. The reason I want to have the script check system requirements is so that I can use the script across multiple distros (especially older ones like CentOS 6 and Ubuntu 12.04 for example), and learn something in the process!

Could you elaborate on using the package managers description? If I go that route, would it work across a wide range of distros?

Thanks again for any help!
 
Old 03-10-2015, 08:54 PM   #5
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Well different distros use different package managers.

Read the man pages of 'rpm' and 'dpkg'.
 
Old 03-11-2015, 06:09 AM   #6
trava90
LQ Newbie
 
Registered: Dec 2014
Distribution: Manjaro/Mint
Posts: 13

Original Poster
Rep: Reputation: 4
Do you think something like this (as an example) would work across multiple distros? Or do you think it would be more hassle then it's worth?

Code:
check_dependencies () {
echo "Checking for dependencies..."
local MISSING_DEPS=""

if [ -z "$(find_python2)" ]; then
MISSING_DEPS="${MISSING_DEPS}python2.x "
fi

if [ -z "$(which curl)" ]; then
MISSING_DEPS="${MISSING_DEPS}curl "
fi

if [ -z "$(which curl)" ]; then
MISSING_DEPS="${MISSING_DEPS}gtk2-2.20 "
fi

if [ -n "$MISSING_DEPS" ]; then
exit_with_error "Your computer is missing the following programs or libraries: $MISSING_DEPS. Install them using your distribution's package manager."
fi
}
 
Old 03-11-2015, 09:19 AM   #7
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Quote:
Originally Posted by trava90 View Post
Do you think something like this (as an example) would work across multiple distros? Or do you think it would be more hassle then it's worth?

Code:
check_dependencies () {
echo "Checking for dependencies..."
local MISSING_DEPS=""

if [ -z "$(find_python2)" ]; then
MISSING_DEPS="${MISSING_DEPS}python2.x "
fi

if [ -z "$(which curl)" ]; then
MISSING_DEPS="${MISSING_DEPS}curl "
fi

if [ -z "$(which curl)" ]; then
MISSING_DEPS="${MISSING_DEPS}gtk2-2.20 "
fi

if [ -n "$MISSING_DEPS" ]; then
exit_with_error "Your computer is missing the following programs or libraries: $MISSING_DEPS. Install them using your distribution's package manager."
fi
}
The code is a very brief summary or truely a cursory one. It depends on you what's hassle.
 
  


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
[SOLVED] Shell Script Check for 2 lines Return? khandu Programming 12 05-12-2014 10:34 AM
An error occurred during the file system check, dropping you to a shell; the system w sanjay87 Linux - Server 1 11-11-2012 11:14 PM
LXer: Tiki Wiki 9.2 can now check system requirements LXer Syndicated Linux News 0 10-26-2012 11:22 PM
An error Occurred during the file system check. Dropping you to shell; the system wil aneikei Linux - Newbie 3 02-11-2010 07:38 PM
Shell Script to check root user? kushalkoolwal Programming 4 09-22-2005 12:15 AM

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

All times are GMT -5. The time now is 10:23 PM.

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