Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ed3cc63cec | |||
| 4a276f5a6d |
@@ -1,53 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
VERSION=0.5r0
|
||||
VERSION=0.5r1
|
||||
DEST=$1
|
||||
shift 1
|
||||
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/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" ]
|
||||
then
|
||||
@@ -56,21 +17,37 @@ then
|
||||
else
|
||||
echo -e "\nlch $VERSION"
|
||||
echo -e "---------\n"
|
||||
fi
|
||||
|
||||
if [ -z "$DEST" ]
|
||||
then
|
||||
help
|
||||
exit 1
|
||||
else
|
||||
if [ -n "$ORIG" ]
|
||||
then
|
||||
echo "Compressor:"
|
||||
echo -e "-----------\n"
|
||||
compressor $DEST $ORIG
|
||||
else
|
||||
echo "Decompressor:"
|
||||
echo -e "-------------\n"
|
||||
decompressor $DEST
|
||||
fi
|
||||
case $DEST in
|
||||
"--help" | "-h")
|
||||
help
|
||||
exit 0
|
||||
;;
|
||||
"--check" | "-c")
|
||||
check
|
||||
exit 0
|
||||
;;
|
||||
"--install" | "-i")
|
||||
install $DEST $@
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
if [ -z "$DEST" ]
|
||||
then
|
||||
help
|
||||
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
|
||||
fi
|
||||
@@ -1,8 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
function lowercase()
|
||||
{
|
||||
echo "$DEST" | tr 'A-Z' 'a-z'
|
||||
}
|
||||
|
||||
function compressor()
|
||||
{
|
||||
|
||||
+1
-4
@@ -1,8 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
function lowercase()
|
||||
{
|
||||
echo "$DEST" | tr 'A-Z' 'a-z'
|
||||
}
|
||||
|
||||
function decompressor()
|
||||
{
|
||||
case $(lowercase) in
|
||||
|
||||
@@ -1,28 +1,4 @@
|
||||
#!/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(){
|
||||
if [ -e "$(command -v wget)" ]
|
||||
@@ -0,0 +1,54 @@
|
||||
#!/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 ""
|
||||
exit 0
|
||||
}
|
||||
|
||||
function lowercase()
|
||||
{
|
||||
echo "$DEST" | tr 'A-Z' 'a-z'
|
||||
}
|
||||
Reference in New Issue
Block a user