Browse Source

0.6 dev

pull/3/head
Gustavo Adolfo Mesa Roldán 3 years ago
parent
commit
3c84ab9231
3 changed files with 59 additions and 26 deletions
  1. +1
    -1
      lib/compressor.sh
  2. +23
    -25
      lib/installer.sh
  3. +35
    -0
      lib/installers/apt.sh

+ 1
- 1
lib/compressor.sh View File

@ -37,4 +37,4 @@ function compressor()
esac
echo -e "\nDone"
}
}

+ 23
- 25
lib/installer.sh View File

@ -26,36 +26,34 @@ function rarInstall(){
function install()
{
echo -e "Install dependencies\n"
if [ "$UID" != "0" ]; then
echo " Only root can execute this script, sorry."
echo " Try 'sudo lch $@'"
exit 0
fi
if [ -e "$(command -v rar)" ]
then
echo "rar installed."
if [ $# -eq 1 ]; then
# Poner aviso "Vamos a instalarlo todo y mucho"
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
read -p "Do you want to install non-free software? (rar, unrar) [Y/N]: " PRIVSOFT
case ${PRIVSOFT} in
y|Y)
rarInstall;;
n|N)
echo -e "\nOnly will install free software.\n";;
*)
echo -e "Options: 'Y' or 'N': ";;
esac
PRIVSOFT=false
fi
if [ -x "$(command -v apt)" ]
then
echo -e "APT system detected\n"
apt install -y tar bzip2 gzip zip unzip p7zip-full p7zip-rar 1> /dev/null
if [[ -e ./lib/installers/apt.sh ]]; then . ./lib/installers/apt.sh; else . /usr/lib/lch/installers/apt.sh; fi
# Hasta aqui he modificado
elif [ -n "$(grep "centos" /etc/*-release)" ]
then
echo -e "CentOS system detected\n"
echo -e "CentOS system detected"
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 --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
elif [ -x "$(command -v dnf)" ]
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
elif [ -x "$(command -v yum)" ]
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
elif [ -x "$(command -v pacman)" ]
then
echo -e "Pacman system detected\n"
echo -e "Pacman system detected"
pacman -Sqy --noconfirm tar bzip2 gzip zip unzip p7zip 1> /dev/null
elif [ -x "$(command -v zypper)" ]
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
else
echo -e "System installer not detected\n"
echo -e "System installer not detected"
fi
echo -e "\nDependencies installation finished\n"
echo -e "Dependencies installation finished\n"
}

+ 35
- 0
lib/installers/apt.sh 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

Loading…
Cancel
Save