Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 438e6867c5 | |||
| 4e04efe1af | |||
| 5816870906 | |||
| b25fc8bd8d | |||
| edccc89586 |
@@ -40,10 +40,9 @@ $ lch -i - Install the compressors dependencies
|
|||||||
- gz
|
- gz
|
||||||
- rar
|
- rar
|
||||||
- tar
|
- tar
|
||||||
- tar.bz2
|
- tar.bz2, tbz, tbz2, tb2
|
||||||
- tar.gz
|
- tar.gz, tgz
|
||||||
- tar.xz
|
- tar.xz, txz
|
||||||
- tgz
|
|
||||||
- zip
|
- zip
|
||||||
|
|
||||||
###### Unpacking only:
|
###### Unpacking only:
|
||||||
@@ -54,7 +53,7 @@ $ lch -i - Install the compressors dependencies
|
|||||||
- lzh
|
- lzh
|
||||||
- lzma
|
- lzma
|
||||||
- rpm
|
- rpm
|
||||||
- SquashFS
|
- squashfs
|
||||||
- vdi
|
- vdi
|
||||||
- vhd
|
- vhd
|
||||||
- vmdk
|
- vmdk
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
VERSION=0.5r6
|
VERSION=0.5r9
|
||||||
DEST=$1
|
DEST=$1
|
||||||
shift 1
|
shift 1
|
||||||
ORIG=$@
|
ORIG=$@
|
||||||
@@ -9,6 +9,9 @@ if [[ -e /usr/lib/lch/compressor.sh ]]; then . /usr/lib/lch/compressor.sh; else
|
|||||||
if [[ -e /usr/lib/lch/decompressor.sh ]]; then . /usr/lib/lch/decompressor.sh; else . ./lib/decompressor.sh; fi
|
if [[ -e /usr/lib/lch/decompressor.sh ]]; then . /usr/lib/lch/decompressor.sh; else . ./lib/decompressor.sh; fi
|
||||||
if [[ -e /usr/lib/lch/installer.sh ]]; then . /usr/lib/lch/installer.sh; else . ./lib/installer.sh; fi
|
if [[ -e /usr/lib/lch/installer.sh ]]; then . /usr/lib/lch/installer.sh; else . ./lib/installer.sh; fi
|
||||||
|
|
||||||
|
|
||||||
|
# executer tar -cvf $DEST $ORIG
|
||||||
|
|
||||||
if [ "$DEST" = "--version" ] || [ "$DEST" = "-v" ]
|
if [ "$DEST" = "--version" ] || [ "$DEST" = "-v" ]
|
||||||
then
|
then
|
||||||
echo "Linux Compression Humanized $VERSION"
|
echo "Linux Compression Humanized $VERSION"
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ simplicity in mind. Automatically select the compression format by file
|
|||||||
extension.
|
extension.
|
||||||
|
|
||||||
Packing/unpacking supported extensions:
|
Packing/unpacking supported extensions:
|
||||||
7z, bz2, gz, rar, tar, tar.bz2, tar.gz, tar.xz, tgz, zip
|
7z, bz2, gz, rar, tar, tar.bz2, tbz, tbz2, tb2, tar.gz, tgz, tar.xz, txz, zip
|
||||||
|
|
||||||
Unpacking only supported extensions:
|
Unpacking only supported extensions:
|
||||||
arj, cab, dmg, iso, lzh, lzma, rpm, SquashFS, vdi, vhd, vmdk, win, xar, z
|
arj, cab, dmg, iso, lzh, lzma, rpm, squashfs, vdi, vhd, vmdk, win, xar, z
|
||||||
|
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
.TP
|
.TP
|
||||||
|
|||||||
+9
-54
@@ -4,76 +4,31 @@ function compressor()
|
|||||||
{
|
{
|
||||||
case $(lowercase) in
|
case $(lowercase) in
|
||||||
*.tar)
|
*.tar)
|
||||||
if [ -x "$(command -v tar)" ]
|
executer tar -cvf $DEST $ORIG
|
||||||
then
|
|
||||||
tar -cvf $DEST $ORIG
|
|
||||||
else
|
|
||||||
error_not_install "tar"
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
*.tar.gz | *.tgz)
|
*.tar.gz | *.tgz)
|
||||||
if [ -x "$(command -v tar)" ]
|
executer tar -czvf $DEST $ORIG
|
||||||
then
|
|
||||||
tar -czvf $DEST $ORIG
|
|
||||||
else
|
|
||||||
error_not_install "tar"
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
*.tar.bz2 | *.tbz | *.tbz2 | *.tb2)
|
*.tar.bz2 | *.tbz | *.tbz2 | *.tb2)
|
||||||
if [ -x "$(command -v tar)" ]
|
executer tar -c $ORIG | bzip2 > $DEST
|
||||||
then
|
|
||||||
tar -c $ORIG | bzip2 > $DEST
|
|
||||||
else
|
|
||||||
error_not_install "tar"
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
*.tar.xz | *.txz)
|
*.tar.xz | *.txz)
|
||||||
if [ -x "$(command -v tar)" ]
|
executer tar -cJf $DEST $ORIG
|
||||||
then
|
|
||||||
tar -cJf $DEST $ORIG
|
|
||||||
else
|
|
||||||
error_not_install "tar"
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
*.bz2)
|
*.bz2)
|
||||||
if [ -x "$(command -v bzip2)" ]
|
executer bzip2 -c $ORIG > $DEST
|
||||||
then
|
|
||||||
bzip2 -c $ORIG > $DEST
|
|
||||||
else
|
|
||||||
error_not_install "bzip2"
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
*.gz)
|
*.gz)
|
||||||
if [ -x "$(command -v gzip)" ]
|
executer gzip -c $ORIG > $DEST
|
||||||
then
|
|
||||||
gzip -c $ORIG > $DEST
|
|
||||||
else
|
|
||||||
error_not_install "gzip"
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
*.zip)
|
*.zip)
|
||||||
if [ -x "$(command -v zip)" ]
|
executer zip -r $DEST $ORIG
|
||||||
then
|
|
||||||
zip -r $DEST $ORIG
|
|
||||||
else
|
|
||||||
error_not_install "zip"
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
*.7z)
|
*.7z)
|
||||||
if [ -x "$(command -v 7z)" ]
|
executer 7z a $DEST $ORIG
|
||||||
then
|
|
||||||
7z a $DEST $ORIG
|
|
||||||
else
|
|
||||||
error_not_install "7z"
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
*.rar)
|
*.rar)
|
||||||
if [ -x "$(command -v rar)" ]
|
executer rar a $DEST $ORIG
|
||||||
then
|
|
||||||
rar a $DEST $ORIG
|
|
||||||
else
|
|
||||||
error_not_install "rar"
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Extension not found."
|
echo "Extension not found."
|
||||||
|
|||||||
+9
-54
@@ -4,76 +4,31 @@ function decompressor()
|
|||||||
{
|
{
|
||||||
case $(lowercase) in
|
case $(lowercase) in
|
||||||
*.tar)
|
*.tar)
|
||||||
if [ -x "$(command -v tar)" ]
|
executer tar -xvf $DEST
|
||||||
then
|
|
||||||
tar -xvf $DEST
|
|
||||||
else
|
|
||||||
error_not_install "tar"
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
*.tar.gz | *.tgz)
|
*.tar.gz | *.tgz)
|
||||||
if [ -x "$(command -v tar)" ]
|
executer tar -xzvf $DEST
|
||||||
then
|
|
||||||
tar -xzvf $DEST
|
|
||||||
else
|
|
||||||
error_not_install "tar"
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
*.tar.bz2 | *.tbz | *.tbz2 | *.tb2)
|
*.tar.bz2 | *.tbz | *.tbz2 | *.tb2)
|
||||||
if [ -x "$(command -v tar)" ]
|
executer tar xjf $DEST
|
||||||
then
|
|
||||||
tar xjf $DEST
|
|
||||||
else
|
|
||||||
error_not_install "tar"
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
*.tar.xz | *.txz)
|
*.tar.xz | *.txz)
|
||||||
if [ -x "$(command -v tar)" ]
|
executer tar -xf $DEST
|
||||||
then
|
|
||||||
tar -xf $DEST
|
|
||||||
else
|
|
||||||
error_not_install "tar"
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
*.bz2)
|
*.bz2)
|
||||||
if [ -x "$(command -v bzip2)" ]
|
executer bzip2 -d $DEST
|
||||||
then
|
|
||||||
bzip2 -d $DEST
|
|
||||||
else
|
|
||||||
error_not_install "bzip2"
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
*.gz)
|
*.gz)
|
||||||
if [ -x "$(command -v gzip)" ]
|
executer gzip -d $DEST
|
||||||
then
|
|
||||||
gzip -d $DEST
|
|
||||||
else
|
|
||||||
error_not_install "gzip"
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
*.zip)
|
*.zip)
|
||||||
if [ -x "$(command -v unzip)" ]
|
executer unzip $DEST
|
||||||
then
|
|
||||||
unzip $DEST
|
|
||||||
else
|
|
||||||
error_not_install "unzip"
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
*.7z | *.arj | *.cab | *.dmg | *.iso | *.lzh | *.lzma | *.rpm | *.squashfs | *.vdi | *.vhd | *.vmdk | *.win | *.xar | *.z)
|
*.7z | *.arj | *.cab | *.dmg | *.iso | *.lzh | *.lzma | *.rpm | *.squashfs | *.vdi | *.vhd | *.vmdk | *.win | *.xar | *.z)
|
||||||
if [ -x "$(command -v 7z)" ]
|
executer 7z e -y $DEST
|
||||||
then
|
|
||||||
7z e -y $DEST
|
|
||||||
else
|
|
||||||
error_not_install "7z"
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
*.rar)
|
*.rar)
|
||||||
if [ -x "$(command -v unrar)" ]
|
executer unrar x $DEST
|
||||||
then
|
|
||||||
unrar x $DEST
|
|
||||||
else
|
|
||||||
error_not_install "unrar"
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Extension not found."
|
echo "Extension not found."
|
||||||
|
|||||||
+6
-6
@@ -19,7 +19,7 @@ function rarInstall(){
|
|||||||
rm -r rar $RAR_FILE
|
rm -r rar $RAR_FILE
|
||||||
echo "rar/unrar installed."
|
echo "rar/unrar installed."
|
||||||
else
|
else
|
||||||
echo -e "\n\e[91m[Error]\e[0m - Wget is not installed, so rar could not be installed.\nPlease install wget.\n"
|
echo -e "\n\e[91m[Error]\e[0m - wget is not installed, so rar could not be installed.\nPlease install wget.\n"
|
||||||
read -p "Press [ENTER] to continue installing or [CTRL+C] to exit."
|
read -p "Press [ENTER] to continue installing or [CTRL+C] to exit."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -30,7 +30,7 @@ function install()
|
|||||||
|
|
||||||
if [ "$UID" != "0" ]; then
|
if [ "$UID" != "0" ]; then
|
||||||
echo " Only root can execute this script, sorry."
|
echo " Only root can execute this script, sorry."
|
||||||
echo " Try 'sudo $0 $@'"
|
echo " Try 'sudo lch $@'"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -52,7 +52,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 unzip p7zip-full 1> /dev/null
|
apt install -y tar bzip2 gzip zip unzip p7zip-full p7zip-rar 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"
|
||||||
@@ -60,15 +60,15 @@ function install()
|
|||||||
rpm -U --quiet http://mirrors.kernel.org/fedora-epel/6/i386/epel-release-6-8.noarch.rpm 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
|
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 1> /dev/null
|
||||||
yum repolist 1> /dev/null
|
yum repolist 1> /dev/null
|
||||||
yum install -y -q tar bzip2 gzip zip unzip p7zip 1> /dev/null
|
yum install -y -q tar bzip2 gzip zip unzip p7zip p7zip-plugins 1> /dev/null
|
||||||
elif [ -x "$(command -v dnf)" ]
|
elif [ -x "$(command -v dnf)" ]
|
||||||
then
|
then
|
||||||
echo -e "DNF system detected\n"
|
echo -e "DNF system detected\n"
|
||||||
dnf install -y -q tar bzip2 gzip zip unzip p7zip 1> /dev/null
|
dnf install -y -q tar bzip2 gzip zip unzip p7zip p7zip-plugins 1> /dev/null
|
||||||
elif [ -x "$(command -v yum)" ]
|
elif [ -x "$(command -v yum)" ]
|
||||||
then
|
then
|
||||||
echo -e "Yum system detected\n"
|
echo -e "Yum system detected\n"
|
||||||
yum install -y -q tar bzip2 gzip zip unzip p7zip 1> /dev/null
|
yum install -y -q tar bzip2 gzip zip unzip p7zip p7zip-plugins 1> /dev/null
|
||||||
elif [ -x "$(command -v pacman)" ]
|
elif [ -x "$(command -v pacman)" ]
|
||||||
then
|
then
|
||||||
echo -e "Pacman system detected\n"
|
echo -e "Pacman system detected\n"
|
||||||
|
|||||||
+13
-3
@@ -17,10 +17,10 @@ function help()
|
|||||||
echo "$ lch files.zip file1 file2 - Compress multiple"
|
echo "$ lch files.zip file1 file2 - Compress multiple"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Packing/unpacking supported extensions:"
|
echo "Packing/unpacking supported extensions:"
|
||||||
echo " 7z, bz2, gz, rar, tar, tar.bz2, tar.gz, tar.xz, tgz, zip"
|
echo " 7z, bz2, gz, rar, tar, tar.bz2, tbz, tbz2, tb2, tar.gz, tgz, tar.xz, txz, zip"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Unpacking only supported extensions:"
|
echo "Unpacking only supported extensions:"
|
||||||
echo " arj, cab, dmg, iso, lzh, lzma, rpm, SquashFS, vdi, vhd, vmdk, win, xar, z"
|
echo " arj, cab, dmg, iso, lzh, lzma, rpm, squashfs, vdi, vhd, vmdk, win, xar, z"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Run 'man lch' for more info."
|
echo "Run 'man lch' for more info."
|
||||||
echo ""
|
echo ""
|
||||||
@@ -58,6 +58,16 @@ function lowercase()
|
|||||||
|
|
||||||
function error_not_install()
|
function error_not_install()
|
||||||
{
|
{
|
||||||
echo -e "$@ \e[91mis not Installed\e[0m, use 'lch -i' to install and 'lch -c' to check."
|
echo -e "$@ \e[91mis not installed\e[0m, use 'lch -i' to install and 'lch -c' to check."
|
||||||
exit 0
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function executer()
|
||||||
|
{
|
||||||
|
if [ -x "$(command -v $1)" ]
|
||||||
|
then
|
||||||
|
"$@"
|
||||||
|
else
|
||||||
|
error_not_install $1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user