Check system requirements in installer shell script
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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.
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?
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
}
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.