Files
lch/lib/installer.sh
T

72 lines
2.4 KiB
Bash
Raw Normal View History

2020-09-30 01:37:15 +02:00
#!/usr/bin/env bash
2020-09-27 17:37:30 +02:00
function rarInstall(){
2020-10-03 13:33:19 +02:00
if [ -e "$(command -v wget)" ] || [ -e "$(command -v curl)" ]
2020-09-27 17:37:30 +02:00
then
2020-09-30 16:15:55 +02:00
if [[ "$(uname -m)" == "x86_64" ]]
2020-09-30 01:07:37 +02:00
then
RAR_URL="https://www.rarlab.com/rar/rarlinux-x64-5.9.1.tar.gz"
RAR_FILE="rarlinux-x64-5.9.1.tar.gz"
else
RAR_URL="https://www.rarlab.com/rar/rarlinux-5.9.1.tar.gz"
RAR_FILE="rarlinux-5.9.1.tar.gz"
fi
2020-10-03 13:33:19 +02:00
if [ -e "$(command -v wget)" ]
then
wget -q $RAR_URL > /dev/null
else
curl -s -o $RAR_FILE $RAR_URL > /dev/null
fi
2020-10-03 11:42:11 +02:00
tar -zxvf $RAR_FILE > /dev/null
2020-09-30 01:07:37 +02:00
cd rar
2020-10-03 11:42:11 +02:00
cp -v rar unrar /usr/local/bin/ > /dev/null
2020-09-30 01:07:37 +02:00
cd ..
2020-10-03 11:42:11 +02:00
rm -r rar $RAR_FILE > /dev/null
complete_install "rar"
2020-09-27 17:37:30 +02:00
else
2020-10-03 13:33:19 +02:00
echo -e "\n\e[91m[Error]\e[0m - wget or curl is not installed, so rar could not be installed.\nPlease install wget.\n"
2020-09-30 01:07:37 +02:00
read -p "Press [ENTER] to continue installing or [CTRL+C] to exit."
2020-09-27 17:37:30 +02:00
fi
}
function install()
{
if [ "$UID" != "0" ]; then
echo " Only root can execute this script, sorry."
2020-10-03 08:12:14 +02:00
echo " Try 'sudo lch $@'"
2020-09-27 17:37:30 +02:00
exit 0
fi
2020-10-03 11:11:35 +02:00
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
2020-09-27 17:37:30 +02:00
else
2020-10-03 11:11:35 +02:00
PRIVSOFT=false
2020-09-27 17:37:30 +02:00
fi
2020-10-03 11:11:35 +02:00
2020-09-27 17:37:30 +02:00
if [ -x "$(command -v apt)" ]
then
2020-10-03 12:15:05 +02:00
if [[ -e ./lib/installers/deb.sh ]]; then . ./lib/installers/deb.sh; else . /usr/lib/lch/installers/deb.sh; fi
2020-10-03 14:30:06 +02:00
elif [ -x "$(command -v yum)" ]
2020-10-03 12:15:05 +02:00
then
if [[ -e ./lib/installers/rpm.sh ]]; then . ./lib/installers/rpm.sh; else . /usr/lib/lch/installers/rpm.sh; fi
2020-09-27 17:37:30 +02:00
elif [ -x "$(command -v pacman)" ]
then
2020-10-03 13:34:48 +02:00
if [[ -e ./lib/installers/pacman.sh ]]; then . ./lib/installers/pacman.sh; else . /usr/lib/lch/installers/pacman.sh; fi
2020-09-27 17:37:30 +02:00
elif [ -x "$(command -v zypper)" ]
then
2020-10-03 13:34:48 +02:00
if [[ -e ./lib/installers/zypper.sh ]]; then . ./lib/installers/zypper.sh; else . /usr/lib/lch/installers/zypper.sh; fi
2020-09-27 17:37:30 +02:00
else
2020-10-03 11:11:35 +02:00
echo -e "System installer not detected"
2020-09-27 17:37:30 +02:00
fi
2020-10-03 11:42:11 +02:00
echo -e "\nDependencies installation finished\n"
2020-09-27 17:37:30 +02:00
}