Browse Source

0.2r1 - Verification of compression systems

master
Gustavo Adolfo Mesa Roldán 3 years ago
parent
commit
d31bc2f360
2 changed files with 54 additions and 17 deletions
  1. +48
    -15
      lch
  2. +6
    -2
      lch.1

+ 48
- 15
lch View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
VERSION=0.1r8
VERSION=0.2r1
DEST=$1 DEST=$1
shift 1 shift 1
ORIG=$@ ORIG=$@
@ -10,10 +10,10 @@ function decompressor()
*.tar) *.tar)
tar -xvf $DEST tar -xvf $DEST
;; ;;
*.tar.gz | *.tgz)
*.tar.gz | *.tgz)
tar -xzvf $DEST tar -xzvf $DEST
;; ;;
*.tar.bz2 | *.tbz | *.tbz2 | *.tb2)
*.tar.bz2 | *.tbz | *.tbz2 | *.tb2)
tar xjf $DEST tar xjf $DEST
;; ;;
*.tar.xz | *.txz) *.tar.xz | *.txz)
@ -21,17 +21,17 @@ function decompressor()
;; ;;
*.bz2) *.bz2)
bzip2 -d $DEST bzip2 -d $DEST
;;
;;
*.gz) *.gz)
gzip -d $DEST gzip -d $DEST
;; ;;
*.zip) *.zip)
unzip $DEST unzip $DEST
;; ;;
*.7z)
*.7z)
7za e $DEST 7za e $DEST
;; ;;
*)
*)
echo "Extension not found." echo "Extension not found."
echo "For more information run 'lch --help'" echo "For more information run 'lch --help'"
echo "" echo ""
@ -49,7 +49,7 @@ function compressor()
*.tar) *.tar)
tar -cvf $DEST $ORIG tar -cvf $DEST $ORIG
;; ;;
*.tar.gz | *.tgz)
*.tar.gz | *.tgz)
tar -czvf $DEST $ORIG tar -czvf $DEST $ORIG
;; ;;
*.tar.bz2 | *.tbz | *.tbz2 | *.tb2) *.tar.bz2 | *.tbz | *.tbz2 | *.tb2)
@ -57,20 +57,20 @@ function compressor()
;; ;;
*.tar.xz | *.txz) *.tar.xz | *.txz)
tar -cJf $DEST $ORIG tar -cJf $DEST $ORIG
;;
;;
*.bz2) *.bz2)
bzip2 -c $ORIG > $DEST
bzip2 -c $ORIG > $DEST
;; ;;
*.gz) *.gz)
gzip -c $ORIG > $DEST
gzip -c $ORIG > $DEST
;; ;;
*.zip) *.zip)
zip -r $DEST $ORIG zip -r $DEST $ORIG
;; ;;
*.7z)
*.7z)
7za a $DEST $ORIG 7za a $DEST $ORIG
;; ;;
*)
*)
echo "Extension not found." echo "Extension not found."
echo "For more information run 'lch --help'" echo "For more information run 'lch --help'"
echo "" echo ""
@ -83,16 +83,16 @@ function compressor()
} }
function help() function help()
{
# echo ""
{
echo "Help:" echo "Help:"
echo "-----" echo "-----"
echo "" echo ""
echo "lch [-h] [-v] [FILE [FILE]]"
echo "lch [-h] [-v] [-c] [FILE [FILE]]"
echo "" echo ""
echo "Examples:" echo "Examples:"
echo "$ lch -h -This help" echo "$ lch -h -This help"
echo "$ lch -v -print version" echo "$ lch -v -print version"
echo "$ lch -c -check compresion systems"
echo "$ lch file.zip /home/file -Compress" echo "$ lch file.zip /home/file -Compress"
echo "$ lch file.zip -Decompress" echo "$ lch file.zip -Decompress"
echo "" echo ""
@ -103,12 +103,45 @@ function help()
echo "" echo ""
} }
function check()
{
local a=false
echo "Verification of compression systems:"
echo ""
echo -e "Systems\t\t\tStatus"
echo "----------------------------------"
for i in "tar" "bzip2" "gzip" "zip" "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[32mInstaled\e[0m"
fi
done
if $a
then
echo ""
echo "In order to use all the extensions install the packages: tar, bzip2, gzip, zip, 7za"
fi
echo ""
exit 0
}
if [ "$DEST" = "--help" ] || [ "$DEST" = "-h" ] if [ "$DEST" = "--help" ] || [ "$DEST" = "-h" ]
then then
help help
exit 0 exit 0
fi fi
if [ "$DEST" = "--check" ] || [ "$DEST" = "-c" ]
then
check
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"


+ 6
- 2
lch.1 View File

@ -11,7 +11,7 @@ simplicity in mind. Automatically select the compression format by file
extension. extension.
Supported extensions: Supported extensions:
tar, tar.gz, tar.bz2, tar.xz, bz2, tgz, gz, zip, 7z tar, tar.gz, tar.bz2, tar.xz, bz2, tgz, gz, zip, 7z
.SH OPTIONS .SH OPTIONS
@ -21,6 +21,10 @@ Help: show syntax.
.TP .TP
\fI\-v, \-\-version\fP \fI\-v, \-\-version\fP
Print current version. Print current version.
.TP
\fI\-c, \-\-check\fP
Print a check the compressors installed.
.SH EXAMPLES .SH EXAMPLES
@ -36,6 +40,6 @@ will compress foobar1/ and foobar2/ in foobar.tar.gz
Report your bugs at <gore@hatthieves.es> Report your bugs at <gore@hatthieves.es>
.SH AUTHOR .SH AUTHOR
\fBlch\fP are by Gustavo Adolfo Mesa Roldan <gore@hackthieves.es.>
\fBlch\fP are by Gustavo Adolfo Mesa Roldan <gore@hackthieves.es>
This document is by radikal <radikal@disroot.org>. This document is by radikal <radikal@disroot.org>.

Loading…
Cancel
Save