rar support added

This commit is contained in:
2020-09-27 04:43:42 +02:00
parent 5c0cfb2776
commit d2f7e5139a
+9 -3
View File
@@ -31,6 +31,9 @@ function decompressor()
*.7z) *.7z)
7za e $DEST 7za e $DEST
;; ;;
*.rar)
unrar x $DEST
;;
*) *)
echo "Extension not found." echo "Extension not found."
echo -e "For more information run 'lch --help'\n" echo -e "For more information run 'lch --help'\n"
@@ -68,6 +71,9 @@ function compressor()
*.7z) *.7z)
7za a $DEST $ORIG 7za a $DEST $ORIG
;; ;;
*.rar)
rar a $DEST $ORIG
;;
*) *)
echo "Extension not found." echo "Extension not found."
echo -e "For more information run 'lch --help'\n" echo -e "For more information run 'lch --help'\n"
@@ -94,7 +100,7 @@ function help()
echo "$ lch file.zip -Decompress" echo "$ lch file.zip -Decompress"
echo "" echo ""
echo "Supported extensions:" echo "Supported extensions:"
echo " tar, tar.gz, tar.bz2, tar.xz, bz2, tgz, gz, zip, 7z" echo " rar, tar, tar.gz, tar.bz2, tar.xz, bz2, tgz, gz, zip, 7z"
echo "" echo ""
echo "Run 'man lch' for more info." echo "Run 'man lch' for more info."
echo "" echo ""
@@ -119,7 +125,7 @@ function check()
if $a if $a
then then
echo -e "\nIn 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, rar, unrar"
fi fi
echo "" echo ""
exit 0 exit 0
@@ -138,7 +144,7 @@ function install()
if [ -x "$(command -v apt)" ] if [ -x "$(command -v apt)" ]
then then
echo -e "APT system detected\n" echo -e "APT system detected\n"
apt install -y tar bzip2 gzip zip p7zip-full 1> /dev/null apt install -y tar bzip2 gzip zip p7zip-full rar unrar-free 1> /dev/null
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\n"