#!/usr/bin/env bash
|
|
|
|
# Functions
|
|
|
|
function get_dep(){
|
|
wheel true &
|
|
WPID=$!
|
|
if [[ $@ == "p7zip-plugins" ]]; then
|
|
yum install -y -q $@ 1> /dev/null
|
|
else
|
|
yum install -y -q $@ 1> /dev/null
|
|
if [[ $? -ne 0 ]]; then
|
|
if [[ $@ == "p7zip" ]]; then failed_install 7z; else failed_install $@; fi
|
|
else
|
|
if [[ $@ == "p7zip" ]]; then complete_install 7z; else complete_install $@; fi
|
|
fi
|
|
fi
|
|
disown $WPID
|
|
kill $WPID &> /dev/null
|
|
}
|
|
|
|
function install_centos(){
|
|
if [ -n "$(grep "centos" /etc/*-release)" ]; then
|
|
yum install -y -q epel-release &> /dev/null
|
|
rpm --quiet --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8 &> /dev/null
|
|
rpm -U --quiet http://mirrors.kernel.org/fedora-epel/6/i386/epel-release-6-8.noarch.rpm &> /dev/null
|
|
fi
|
|
}
|
|
|
|
# Run
|
|
|
|
echo -e "YUM system detected"
|
|
echo "---------------------"
|
|
|
|
wheel true &
|
|
WPID=$!
|
|
yum -y -q update &> /dev/null
|
|
disown $WPID
|
|
kill $WPID &> /dev/null
|
|
|
|
if [ $# -eq 1 ]; then
|
|
install_centos
|
|
if $PRIVSOFT; then
|
|
rarInstall
|
|
fi
|
|
for installer in "tar" "bzip2" "gzip" "zip" "unzip" "p7zip" "p7zip-plugins"
|
|
do get_dep $installer
|
|
done
|
|
else
|
|
for i in $@
|
|
do
|
|
if [ $i != "-i" ]
|
|
then
|
|
case $i in
|
|
"rar" | "unrar")
|
|
rarInstall
|
|
;;
|
|
"7z" | "7zip" | "p7zip")
|
|
install_centos
|
|
get_dep p7zip
|
|
get_dep p7zip-plugins
|
|
;;
|
|
*)
|
|
get_dep $i
|
|
;;
|
|
esac
|
|
fi
|
|
done
|
|
fi
|