Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0be7239088 | |||
| a460d09a15 | |||
| ed3cc63cec | |||
| 4a276f5a6d |
@@ -1,76 +1,51 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
VERSION=0.5r0
|
VERSION=0.5r2
|
||||||
DEST=$1
|
DEST=$1
|
||||||
shift 1
|
shift 1
|
||||||
ORIG=$@
|
ORIG=$@
|
||||||
|
|
||||||
|
if [[ -e /usr/lib/lch/resources.sh ]]; then . /usr/lib/lch/resources.sh; else . ./lib/resources.sh; fi
|
||||||
if [[ -e /usr/lib/lch/compressor.sh ]]; then . /usr/lib/lch/compressor.sh; else . ./lib/compressor.sh; fi
|
if [[ -e /usr/lib/lch/compressor.sh ]]; then . /usr/lib/lch/compressor.sh; else . ./lib/compressor.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/decompressor.sh ]]; then . /usr/lib/lch/decompressor.sh; else . ./lib/decompressor.sh; fi
|
||||||
if [[ -e /usr/lib/lch/check.sh ]]; then . /usr/lib/lch/check.sh; else . ./lib/check.sh; fi
|
if [[ -e /usr/lib/lch/installer.sh ]]; then . /usr/lib/lch/installer.sh; else . ./lib/installer.sh; fi
|
||||||
|
|
||||||
function help()
|
|
||||||
{
|
|
||||||
echo "Help:"
|
|
||||||
echo "-----"
|
|
||||||
echo ""
|
|
||||||
echo "lch [-h] [-v] [-c] [-i] [FILE [FILE...]]"
|
|
||||||
echo ""
|
|
||||||
echo "Examples:"
|
|
||||||
echo "$ lch -h - This help"
|
|
||||||
echo "$ lch -v - Print version"
|
|
||||||
echo "$ lch -c - Check compresion systems"
|
|
||||||
echo "$ lch -i - Install the compressors dependencies"
|
|
||||||
echo "$ lch file.zip - Decompress"
|
|
||||||
echo "$ lch file.zip /home/file - Compress"
|
|
||||||
echo "$ lch files.zip file1 file2 - Compress multiple"
|
|
||||||
echo ""
|
|
||||||
echo "Supported extensions:"
|
|
||||||
echo " rar, tar, tar.gz, tar.bz2, tar.xz, bz2, tgz, gz, zip, 7z"
|
|
||||||
echo ""
|
|
||||||
echo "Run 'man lch' for more info."
|
|
||||||
echo ""
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ "$DEST" = "--help" ] || [ "$DEST" = "-h" ]
|
|
||||||
then
|
|
||||||
help
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$DEST" = "--check" ] || [ "$DEST" = "-c" ]
|
|
||||||
then
|
|
||||||
check
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$DEST" = "--install" ] || [ "$DEST" = "-i" ]
|
|
||||||
then
|
|
||||||
install $DEST $@
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$DEST" = "--version" ] || [ "$DEST" = "-v" ]
|
if [ "$DEST" = "--version" ] || [ "$DEST" = "-v" ]
|
||||||
then
|
then
|
||||||
echo "Linux Compression Humanized $VERSION"
|
echo "Linux Compression Humanized $VERSION"
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo -e "\nlch $VERSION"
|
echo -e "\nlch $VERSION"
|
||||||
echo -e "---------\n"
|
echo -e "---------\n"
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$DEST" ]
|
case $DEST in
|
||||||
then
|
"--help" | "-h")
|
||||||
help
|
help
|
||||||
exit 1
|
;;
|
||||||
else
|
"--check" | "-c")
|
||||||
if [ -n "$ORIG" ]
|
check
|
||||||
then
|
;;
|
||||||
echo "Compressor:"
|
"--install" | "-i")
|
||||||
echo -e "-----------\n"
|
install $DEST $@
|
||||||
compressor $DEST $ORIG
|
;;
|
||||||
else
|
*)
|
||||||
echo "Decompressor:"
|
if [ -z "$DEST" ]
|
||||||
echo -e "-------------\n"
|
then
|
||||||
decompressor $DEST
|
help
|
||||||
fi
|
exit 1
|
||||||
|
else
|
||||||
|
if [ -n "$ORIG" ]
|
||||||
|
then
|
||||||
|
echo "Compressor:"
|
||||||
|
echo -e "-----------\n"
|
||||||
|
compressor $DEST $ORIG
|
||||||
|
else
|
||||||
|
echo "Decompressor:"
|
||||||
|
echo -e "-------------\n"
|
||||||
|
decompressor $DEST
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
+2
-7
@@ -1,11 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
function lowercase()
|
|
||||||
{
|
|
||||||
echo "$DEST" | tr 'A-Z' 'a-z'
|
|
||||||
}
|
|
||||||
|
|
||||||
function compressor()
|
function compressor()
|
||||||
{
|
{
|
||||||
case $(lowercase) in
|
case $(lowercase) in
|
||||||
*.tar)
|
*.tar)
|
||||||
tar -cvf $DEST $ORIG
|
tar -cvf $DEST $ORIG
|
||||||
@@ -39,7 +35,6 @@ function compressor()
|
|||||||
echo -e "For more information run 'lch --help'\n"
|
echo -e "For more information run 'lch --help'\n"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
echo -e "\nDone"
|
echo -e "\nDone"
|
||||||
exit 0
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-5
@@ -1,8 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
function lowercase()
|
|
||||||
{
|
|
||||||
echo "$DEST" | tr 'A-Z' 'a-z'
|
|
||||||
}
|
|
||||||
function decompressor()
|
function decompressor()
|
||||||
{
|
{
|
||||||
case $(lowercase) in
|
case $(lowercase) in
|
||||||
@@ -40,5 +37,4 @@ function decompressor()
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
echo -e "\nDone"
|
echo -e "\nDone"
|
||||||
exit 0
|
|
||||||
}
|
}
|
||||||
@@ -1,33 +1,9 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
function check()
|
|
||||||
{
|
|
||||||
local a=false
|
|
||||||
echo -e "Verification of compression systems:\n"
|
|
||||||
echo -e "Systems\t\t\tStatus"
|
|
||||||
echo "----------------------------------"
|
|
||||||
for i in "rar" "unrar" "tar" "bzip2" "gzip" "zip" "unzip" "7za"
|
|
||||||
do
|
|
||||||
if ! [ -x "$(command -v $i)" ]
|
|
||||||
then
|
|
||||||
echo -e "$i\t\t\t\e[91mNot Installed\e[0m"
|
|
||||||
$a = true
|
|
||||||
else
|
|
||||||
echo -e "$i\t\t\t\e[32mInstalled\e[0m"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if $a
|
|
||||||
then
|
|
||||||
echo -e "\nIn order to use all the extensions install the packages: tar, bzip2, gzip, zip, unzip, 7za, rar, unrar"
|
|
||||||
fi
|
|
||||||
echo ""
|
|
||||||
exit 0
|
|
||||||
}
|
|
||||||
|
|
||||||
function rarInstall(){
|
function rarInstall(){
|
||||||
if [ -e "$(command -v wget)" ]
|
if [ -e "$(command -v wget)" ]
|
||||||
then
|
then
|
||||||
if [[ $(uname -m) -eq "x86_64" ]]
|
if [[ "$(uname -m)" == "x86_64" ]]
|
||||||
then
|
then
|
||||||
RAR_URL="https://www.rarlab.com/rar/rarlinux-x64-5.9.1.tar.gz"
|
RAR_URL="https://www.rarlab.com/rar/rarlinux-x64-5.9.1.tar.gz"
|
||||||
RAR_FILE="rarlinux-x64-5.9.1.tar.gz"
|
RAR_FILE="rarlinux-x64-5.9.1.tar.gz"
|
||||||
@@ -106,5 +82,4 @@ function install()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "\nDependencies installation finished\n"
|
echo -e "\nDependencies installation finished\n"
|
||||||
exit 0
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
function help()
|
||||||
|
{
|
||||||
|
echo "Help:"
|
||||||
|
echo "-----"
|
||||||
|
echo ""
|
||||||
|
echo "lch [-h] [-v] [-c] [-i] [FILE [FILE...]]"
|
||||||
|
echo ""
|
||||||
|
echo "Examples:"
|
||||||
|
echo "$ lch -h - This help"
|
||||||
|
echo "$ lch -v - Print version"
|
||||||
|
echo "$ lch -c - Check compresion systems"
|
||||||
|
echo "$ lch -i - Install the compressors dependencies"
|
||||||
|
echo "$ lch file.zip - Decompress"
|
||||||
|
echo "$ lch file.zip /home/file - Compress"
|
||||||
|
echo "$ lch files.zip file1 file2 - Compress multiple"
|
||||||
|
echo ""
|
||||||
|
echo "Supported extensions:"
|
||||||
|
echo " rar, tar, tar.gz, tar.bz2, tar.xz, bz2, tgz, gz, zip, 7z"
|
||||||
|
echo ""
|
||||||
|
echo "Run 'man lch' for more info."
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
function check()
|
||||||
|
{
|
||||||
|
local a=false
|
||||||
|
echo -e "Verification of compression systems:\n"
|
||||||
|
echo -e "Systems\t\t\tStatus"
|
||||||
|
echo "----------------------------------"
|
||||||
|
for i in "rar" "unrar" "tar" "bzip2" "gzip" "zip" "unzip" "7za"
|
||||||
|
do
|
||||||
|
if ! [ -x "$(command -v $i)" ]
|
||||||
|
then
|
||||||
|
echo -e "$i\t\t\t\e[91mNot Installed\e[0m"
|
||||||
|
$a = true
|
||||||
|
else
|
||||||
|
echo -e "$i\t\t\t\e[32mInstalled\e[0m"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if $a
|
||||||
|
then
|
||||||
|
echo -e "\nIn order to use all the extensions install the packages: tar, bzip2, gzip, zip, unzip, 7za, rar, unrar"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
function lowercase()
|
||||||
|
{
|
||||||
|
echo "$DEST" | tr 'A-Z' 'a-z'
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user