0.2r3 - Universal installer

This commit is contained in:
Gustavo Adolfo Mesa Roldán
2020-09-27 00:14:29 +02:00
parent e8aee6a828
commit 325a91770f
+47 -25
View File
@@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
VERSION=0.2r2 VERSION=0.2r3
DEST=$1 DEST=$1
shift 1 shift 1
ORIG=$@ ORIG=$@
@@ -33,13 +33,11 @@ function decompressor()
;; ;;
*) *)
echo "Extension not found." echo "Extension not found."
echo "For more information run 'lch --help'" echo -e "For more information run 'lch --help'\n"
echo ""
;; ;;
esac esac
echo "" echo -e "\nDone"
echo "Done"
exit 0 exit 0
} }
@@ -72,13 +70,11 @@ function compressor()
;; ;;
*) *)
echo "Extension not found." echo "Extension not found."
echo "For more information run 'lch --help'" echo -e "For more information run 'lch --help'\n"
echo ""
;; ;;
esac esac
echo "" echo -e "\nDone"
echo "Done"
exit 0 exit 0
} }
@@ -107,8 +103,7 @@ function help()
function check() function check()
{ {
local a=false local a=false
echo "Verification of compression systems:" echo -e "Verification of compression systems:\n"
echo ""
echo -e "Systems\t\t\tStatus" echo -e "Systems\t\t\tStatus"
echo "----------------------------------" echo "----------------------------------"
for i in "tar" "bzip2" "gzip" "zip" "7za" for i in "tar" "bzip2" "gzip" "zip" "7za"
@@ -124,8 +119,7 @@ function check()
if $a if $a
then then
echo "" echo -e "\nIn order to use all the extensions install the packages: tar, bzip2, gzip, zip, 7za"
echo "In order to use all the extensions install the packages: tar, bzip2, gzip, zip, 7za"
fi fi
echo "" echo ""
exit 0 exit 0
@@ -133,18 +127,48 @@ function check()
function install() function install()
{ {
echo "Install dependences" echo -e "Install dependences\n"
echo ""
if [ "$UID" != "0" ]; then
echo " Only root can execute this script, sorry."
echo " Try 'sudo $0 $DEST'"
exit 0
fi
if [ -x "$(command -v apt)" ] if [ -x "$(command -v apt)" ]
then then
echo "Detect APT system" echo -e "Detect APT system\n"
echo "" apt install -y tar bzip2 gzip zip p7zip-full 1> /dev/null
apt install tar bzip2 gzip zip p7zip-full elif [ -x "$(command -v dnf)" ] && ! [ -n "$(grep "centos" /etc/*-release)" ]
then
echo -e "Detect DNF system\n"
dnf install -y -q tar bzip2 gzip zip p7zip 1> /dev/null
elif [ -x "$(command -v yum)" ] && ! [ -n "$(grep "centos" /etc/*-release)" ]
then
echo -e "Detect Yum system\n"
yum install -y -q tar bzip2 gzip zip p7zip 1> /dev/null
elif [ -n "$(grep "centos" /etc/*-release)" ]
then
echo -e "Detect CentOS system\n"
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
yum repolist 1> /dev/null
yum install -y -q p7zip p7zip-plugins 1> /dev/null
yum install -y -q tar bzip2 gzip zip 1> /dev/null
elif [ -x "$(command -v pacman)" ]
then
echo -e "Detect Pacman system\n"
pacman -Sqy --noconfirm tar bzip2 gzip zip p7zip 1> /dev/null
elif [ -x "$(command -v zypper)" ]
then
echo -e "Detect Zypper system\n"
zypper install -y tar bzip2 gzip zip p7zip-full 1> /dev/null
else else
echo "No detect installer" echo -e "No detect installer\n"
echo ""
fi fi
echo -e "\nDependencies installation completed\n"
exit 0 exit 0
} }
@@ -171,10 +195,8 @@ then
echo "Linux Compression Humanized $VERSION" echo "Linux Compression Humanized $VERSION"
exit 0 exit 0
else else
echo "" echo -e "\nlch $VERSION"
echo "lch $VERSION" echo -e "---------\n"
echo "---------"
echo ""
fi fi
if [ -z "$DEST" ] if [ -z "$DEST" ]
@@ -194,4 +216,4 @@ else
echo "" echo ""
decompressor $DEST decompressor $DEST
fi fi
fi fi