My question would be why the arbitrary points at checking for failure? I do follow that the points where you have multiple programs listed to install, you have tried to group together
like programs or dependent ones, but really, if you have a failure on any one program, shouldn't that be cause for alarm?
As stated above by michaelk, if the warning is to be allowed to pass then you need to alter the failure test to allow for it.
As to the script itself, my first thought is always towards the future editing (that will always occur). To that end, currently when you want to add a new program or group you need to scroll
through the script until you find the appropriate spot. I generally prefer to put all like things together, so with this type of script it would scream array(s) to me.
So here is an example of the sort of thing I would do, with some vague comments that you would need to flesh out:
Code:
set -x
function failed
{
STATUS=$(echo $?)
if [[ "${STATUS}" == "0" ]]; then
echo "All good continue"
else
# where is the error message that something went wrong??
exit 1
fi
}
download_rpms=(
"https://centos7.iuscommunity.org/ius-release.rpm"
"http://rpms.famillecollet.com/enterprise/remi-release-7.rpm"
"http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm"
)
yum_installs=(
epel-release
"http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm"
"http://linuxdownload.adobe.com/linux/x86_64/adobe-release-x86_64-1.0-1.noarch.rpm"
flash-plugin
icedtea-web
vlc smplayer ffmpeg HandBrake-{gui,cli}
libdvdcss gstreamer{,1}-plugins-ugly gstreamer-plugins-bad-nonfree gstreamer1-plugins-bad-freeworld
)
# Perform work in /tmp
cd /tmp
#failed - if this step fails you have much bigger issues
# Get all the rpms required
wget "${download_rpms[@]}"
failed
# Install retrieved rpms
for address in "${download_rpms[@]}"
do
file=${address##*/}
sudo rpm -Uvh "$file"
failed
done
# Update the repolist
yum repolist
failed
# Yum installs
for file in "${yum_installs[@]}"
do
yum -y "$file"
failed
done
# Perform singular group install
yum groupinstall "Development Tools"
failed
# Update entire machine as needed
yum -y update
failed
exit 0