This commit is contained in:
Gustavo Adolfo Mesa Roldán
2020-10-03 11:11:35 +02:00
parent fddc1481ef
commit 3c84ab9231
3 changed files with 59 additions and 26 deletions
+21 -23
View File
@@ -26,36 +26,34 @@ function rarInstall(){
function install() function install()
{ {
echo -e "Install dependencies\n"
if [ "$UID" != "0" ]; then if [ "$UID" != "0" ]; then
echo " Only root can execute this script, sorry." echo " Only root can execute this script, sorry."
echo " Try 'sudo lch $@'" echo " Try 'sudo lch $@'"
exit 0 exit 0
fi fi
if [ -e "$(command -v rar)" ] if [ $# -eq 1 ]; then
then # Poner aviso "Vamos a instalarlo todo y mucho"
echo "rar installed." read -p "Do you want to install non-free software? (rar, unrar) [y/N]: " PRIVSOFT
case ${PRIVSOFT} in
y | Y | yes)
PRIVSOFT=true
echo -e "\nInstall all dependencies (with non-free)\n";;
*)
PRIVSOFT=false
echo -e "\nOnly will install free software.\n";;
esac
else else
read -p "Do you want to install non-free software? (rar, unrar) [Y/N]: " PRIVSOFT PRIVSOFT=false
case ${PRIVSOFT} in
y|Y)
rarInstall;;
n|N)
echo -e "\nOnly will install free software.\n";;
*)
echo -e "Options: 'Y' or 'N': ";;
esac
fi fi
if [ -x "$(command -v apt)" ] if [ -x "$(command -v apt)" ]
then then
echo -e "APT system detected\n" if [[ -e ./lib/installers/apt.sh ]]; then . ./lib/installers/apt.sh; else . /usr/lib/lch/installers/apt.sh; fi
apt install -y tar bzip2 gzip zip unzip p7zip-full p7zip-rar 1> /dev/null # Hasta aqui he modificado
elif [ -n "$(grep "centos" /etc/*-release)" ] elif [ -n "$(grep "centos" /etc/*-release)" ]
then then
echo -e "CentOS system detected\n" echo -e "CentOS system detected"
yum install -y -q epel-release 1> /dev/null yum install -y -q epel-release 1> /dev/null
rpm -U --quiet http://mirrors.kernel.org/fedora-epel/6/i386/epel-release-6-8.noarch.rpm 1> /dev/null rpm -U --quiet http://mirrors.kernel.org/fedora-epel/6/i386/epel-release-6-8.noarch.rpm 1> /dev/null
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 1> /dev/null rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 1> /dev/null
@@ -63,23 +61,23 @@ function install()
yum install -y -q tar bzip2 gzip zip unzip p7zip p7zip-plugins 1> /dev/null yum install -y -q tar bzip2 gzip zip unzip p7zip p7zip-plugins 1> /dev/null
elif [ -x "$(command -v dnf)" ] elif [ -x "$(command -v dnf)" ]
then then
echo -e "DNF system detected\n" echo -e "DNF system detected"
dnf install -y -q tar bzip2 gzip zip unzip p7zip p7zip-plugins 1> /dev/null dnf install -y -q tar bzip2 gzip zip unzip p7zip p7zip-plugins 1> /dev/null
elif [ -x "$(command -v yum)" ] elif [ -x "$(command -v yum)" ]
then then
echo -e "Yum system detected\n" echo -e "Yum system detected"
yum install -y -q tar bzip2 gzip zip unzip p7zip p7zip-plugins 1> /dev/null yum install -y -q tar bzip2 gzip zip unzip p7zip p7zip-plugins 1> /dev/null
elif [ -x "$(command -v pacman)" ] elif [ -x "$(command -v pacman)" ]
then then
echo -e "Pacman system detected\n" echo -e "Pacman system detected"
pacman -Sqy --noconfirm tar bzip2 gzip zip unzip p7zip 1> /dev/null pacman -Sqy --noconfirm tar bzip2 gzip zip unzip p7zip 1> /dev/null
elif [ -x "$(command -v zypper)" ] elif [ -x "$(command -v zypper)" ]
then then
echo -e "Zypper system detected\n" echo -e "Zypper system detected"
zypper install -y tar bzip2 gzip zip unzip p7zip-full 1> /dev/null zypper install -y tar bzip2 gzip zip unzip p7zip-full 1> /dev/null
else else
echo -e "System installer not detected\n" echo -e "System installer not detected"
fi fi
echo -e "\nDependencies installation finished\n" echo -e "Dependencies installation finished\n"
} }
+35
View File
@@ -0,0 +1,35 @@
#!/usr/bin/env bash
# Function
function install(){
echo "$@:"
# Busca la manera de capturar el error. Y mostrar mensaje en rojo.
apt-get install -y $@ 1> /dev/null
echo "e[32mInstalled\e[0m"
}
# Run
echo -e "APT system detected"
echo $@
echo $1
echo $0
echo $PRIVSOFT
echo "----------"
install $2
if [ $# -eq 1 ]; then
install tar
install bzip2
install gzip
install zip
install unzip
install p7zip-full p7zip-rar
else
#Tropa
fi
# apt-get install -y tar bzip2 gzip zip unzip p7zip-full p7zip-rar 1> /dev/null