Browse Source

0.2r3 - Universal installer

master
Gustavo Adolfo Mesa Roldán 3 years ago
parent
commit
325a91770f
1 changed files with 47 additions and 25 deletions
  1. +47
    -25
      lch

+ 47
- 25
lch View File

@ -1,5 +1,5 @@
#!/bin/bash
VERSION=0.2r2
VERSION=0.2r3
DEST=$1
shift 1
ORIG=$@
@ -33,13 +33,11 @@ function decompressor()
;;
*)
echo "Extension not found."
echo "For more information run 'lch --help'"
echo ""
echo -e "For more information run 'lch --help'\n"
;;
esac
echo ""
echo "Done"
echo -e "\nDone"
exit 0
}
@ -72,13 +70,11 @@ function compressor()
;;
*)
echo "Extension not found."
echo "For more information run 'lch --help'"
echo ""
echo -e "For more information run 'lch --help'\n"
;;
esac
echo ""
echo "Done"
echo -e "\nDone"
exit 0
}
@ -107,8 +103,7 @@ function help()
function check()
{
local a=false
echo "Verification of compression systems:"
echo ""
echo -e "Verification of compression systems:\n"
echo -e "Systems\t\t\tStatus"
echo "----------------------------------"
for i in "tar" "bzip2" "gzip" "zip" "7za"
@ -124,8 +119,7 @@ function check()
if $a
then
echo ""
echo "In order to use all the extensions install the packages: tar, bzip2, gzip, zip, 7za"
echo -e "\nIn order to use all the extensions install the packages: tar, bzip2, gzip, zip, 7za"
fi
echo ""
exit 0
@ -133,18 +127,48 @@ function check()
function install()
{
echo "Install dependences"
echo ""
echo -e "Install dependences\n"
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)" ]
then
echo "Detect APT system"
echo ""
apt install tar bzip2 gzip zip p7zip-full
echo -e "Detect APT system\n"
apt install -y tar bzip2 gzip zip p7zip-full 1> /dev/null
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
echo "No detect installer"
echo ""
echo -e "No detect installer\n"
fi
echo -e "\nDependencies installation completed\n"
exit 0
}
@ -171,10 +195,8 @@ then
echo "Linux Compression Humanized $VERSION"
exit 0
else
echo ""
echo "lch $VERSION"
echo "---------"
echo ""
echo -e "\nlch $VERSION"
echo -e "---------\n"
fi
if [ -z "$DEST" ]
@ -194,4 +216,4 @@ else
echo ""
decompressor $DEST
fi
fi
fi

Loading…
Cancel
Save