Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 438e6867c5 | |||
| 4e04efe1af | |||
| 5816870906 | |||
| b25fc8bd8d | |||
| edccc89586 | |||
| 6b94a50229 | |||
| 2596a6a6fb | |||
| b8cb0defe8 | |||
| b10ba9ffee | |||
| 8ae84ab526 | |||
| 6692024ae1 | |||
| 9a13b0168c | |||
| 446b6647ed | |||
| fd40e86308 | |||
| 2c6f419db8 |
@@ -1,4 +1,18 @@
|
||||
#Linux compressor humanizer
|
||||
# Linux compressor humanizer
|
||||
|
||||
## Installation
|
||||
|
||||
###### install
|
||||
```
|
||||
sudo ./install.sh
|
||||
```
|
||||
|
||||
###### Uninstall
|
||||
```
|
||||
sudo ./uninstall.sh
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
###### Compress
|
||||
```
|
||||
@@ -10,22 +24,42 @@ $ lch file.zip file1 [file2...]
|
||||
$ lch file.zip
|
||||
```
|
||||
|
||||
## Supported extensions
|
||||
- tar
|
||||
- tar.gz
|
||||
- tar.bz2
|
||||
- tar.xz
|
||||
- bz2
|
||||
- tgz
|
||||
- gz
|
||||
- zip
|
||||
- 7z
|
||||
- rar
|
||||
###### Options
|
||||
```
|
||||
$ lch -h - Show help
|
||||
$ lch -v - Print version
|
||||
$ lch -c - Check compression systems
|
||||
$ lch -i - Install the compressors dependencies
|
||||
```
|
||||
|
||||
## Install
|
||||
```
|
||||
sudo ./install.sh
|
||||
```
|
||||
## Supported extensions
|
||||
|
||||
###### Packing/unpacking:
|
||||
- 7z
|
||||
- bz2
|
||||
- gz
|
||||
- rar
|
||||
- tar
|
||||
- tar.bz2, tbz, tbz2, tb2
|
||||
- tar.gz, tgz
|
||||
- tar.xz, txz
|
||||
- zip
|
||||
|
||||
###### Unpacking only:
|
||||
- arj
|
||||
- cab
|
||||
- dmg
|
||||
- iso
|
||||
- lzh
|
||||
- lzma
|
||||
- rpm
|
||||
- squashfs
|
||||
- vdi
|
||||
- vhd
|
||||
- vmdk
|
||||
- win
|
||||
- xar
|
||||
- z
|
||||
|
||||
## Testing with docker
|
||||
```
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
VERSION=0.5r2
|
||||
VERSION=0.5r9
|
||||
DEST=$1
|
||||
shift 1
|
||||
ORIG=$@
|
||||
@@ -10,6 +10,8 @@ if [[ -e /usr/lib/lch/decompressor.sh ]]; then . /usr/lib/lch/decompressor.sh; e
|
||||
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" ]
|
||||
then
|
||||
echo "Linux Compression Humanized $VERSION"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.TH LCH 1 "29 September 2020"
|
||||
.TH LCH 1 "03 October 2020"
|
||||
.SH NAME
|
||||
lch \- command\-line compressor and decompressor for humans
|
||||
.SH SYNOPSIS
|
||||
@@ -10,9 +10,11 @@ lch \- command\-line compressor and decompressor for humans
|
||||
simplicity in mind. Automatically select the compression format by file
|
||||
extension.
|
||||
|
||||
Supported extensions:
|
||||
Packing/unpacking supported extensions:
|
||||
7z, bz2, gz, rar, tar, tar.bz2, tbz, tbz2, tb2, tar.gz, tgz, tar.xz, txz, zip
|
||||
|
||||
rar, tar, tar.gz, tar.bz2, tar.xz, bz2, tgz, gz, zip, 7z
|
||||
Unpacking only supported extensions:
|
||||
arj, cab, dmg, iso, lzh, lzma, rpm, squashfs, vdi, vhd, vmdk, win, xar, z
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
|
||||
+9
-9
@@ -4,31 +4,31 @@ function compressor()
|
||||
{
|
||||
case $(lowercase) in
|
||||
*.tar)
|
||||
tar -cvf $DEST $ORIG
|
||||
executer tar -cvf $DEST $ORIG
|
||||
;;
|
||||
*.tar.gz | *.tgz)
|
||||
tar -czvf $DEST $ORIG
|
||||
executer tar -czvf $DEST $ORIG
|
||||
;;
|
||||
*.tar.bz2 | *.tbz | *.tbz2 | *.tb2)
|
||||
tar -c $ORIG | bzip2 > $DEST
|
||||
executer tar -c $ORIG | bzip2 > $DEST
|
||||
;;
|
||||
*.tar.xz | *.txz)
|
||||
tar -cJf $DEST $ORIG
|
||||
executer tar -cJf $DEST $ORIG
|
||||
;;
|
||||
*.bz2)
|
||||
bzip2 -c $ORIG > $DEST
|
||||
executer bzip2 -c $ORIG > $DEST
|
||||
;;
|
||||
*.gz)
|
||||
gzip -c $ORIG > $DEST
|
||||
executer gzip -c $ORIG > $DEST
|
||||
;;
|
||||
*.zip)
|
||||
zip -r $DEST $ORIG
|
||||
executer zip -r $DEST $ORIG
|
||||
;;
|
||||
*.7z)
|
||||
7za a $DEST $ORIG
|
||||
executer 7z a $DEST $ORIG
|
||||
;;
|
||||
*.rar)
|
||||
rar a $DEST $ORIG
|
||||
executer rar a $DEST $ORIG
|
||||
;;
|
||||
*)
|
||||
echo "Extension not found."
|
||||
|
||||
+10
-10
@@ -4,31 +4,31 @@ function decompressor()
|
||||
{
|
||||
case $(lowercase) in
|
||||
*.tar)
|
||||
tar -xvf $DEST
|
||||
executer tar -xvf $DEST
|
||||
;;
|
||||
*.tar.gz | *.tgz)
|
||||
tar -xzvf $DEST
|
||||
executer tar -xzvf $DEST
|
||||
;;
|
||||
*.tar.bz2 | *.tbz | *.tbz2 | *.tb2)
|
||||
tar xjf $DEST
|
||||
executer tar xjf $DEST
|
||||
;;
|
||||
*.tar.xz | *.txz)
|
||||
tar -xf $DEST
|
||||
executer tar -xf $DEST
|
||||
;;
|
||||
*.bz2)
|
||||
bzip2 -d $DEST
|
||||
executer bzip2 -d $DEST
|
||||
;;
|
||||
*.gz)
|
||||
gzip -d $DEST
|
||||
executer gzip -d $DEST
|
||||
;;
|
||||
*.zip)
|
||||
unzip $DEST
|
||||
executer unzip $DEST
|
||||
;;
|
||||
*.7z)
|
||||
7za e $DEST
|
||||
*.7z | *.arj | *.cab | *.dmg | *.iso | *.lzh | *.lzma | *.rpm | *.squashfs | *.vdi | *.vhd | *.vmdk | *.win | *.xar | *.z)
|
||||
executer 7z e -y $DEST
|
||||
;;
|
||||
*.rar)
|
||||
unrar x $DEST
|
||||
executer unrar x $DEST
|
||||
;;
|
||||
*)
|
||||
echo "Extension not found."
|
||||
|
||||
+6
-6
@@ -19,7 +19,7 @@ function rarInstall(){
|
||||
rm -r rar $RAR_FILE
|
||||
echo "rar/unrar installed."
|
||||
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."
|
||||
fi
|
||||
}
|
||||
@@ -30,7 +30,7 @@ function install()
|
||||
|
||||
if [ "$UID" != "0" ]; then
|
||||
echo " Only root can execute this script, sorry."
|
||||
echo " Try 'sudo $0 $@'"
|
||||
echo " Try 'sudo lch $@'"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@@ -52,7 +52,7 @@ function install()
|
||||
if [ -x "$(command -v apt)" ]
|
||||
then
|
||||
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)" ]
|
||||
then
|
||||
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 --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 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)" ]
|
||||
then
|
||||
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)" ]
|
||||
then
|
||||
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)" ]
|
||||
then
|
||||
echo -e "Pacman system detected\n"
|
||||
|
||||
+25
-5
@@ -16,8 +16,11 @@ function help()
|
||||
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 "Packing/unpacking supported extensions:"
|
||||
echo " 7z, bz2, gz, rar, tar, tar.bz2, tbz, tbz2, tb2, tar.gz, tgz, tar.xz, txz, zip"
|
||||
echo ""
|
||||
echo "Unpacking only supported extensions:"
|
||||
echo " arj, cab, dmg, iso, lzh, lzma, rpm, squashfs, vdi, vhd, vmdk, win, xar, z"
|
||||
echo ""
|
||||
echo "Run 'man lch' for more info."
|
||||
echo ""
|
||||
@@ -29,12 +32,12 @@ function check()
|
||||
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"
|
||||
for i in "7z" "bzip2" "gzip" "rar" "tar" "unrar" "unzip" "zip"
|
||||
do
|
||||
if ! [ -x "$(command -v $i)" ]
|
||||
then
|
||||
echo -e "$i\t\t\t\e[91mNot Installed\e[0m"
|
||||
$a = true
|
||||
a=true
|
||||
else
|
||||
echo -e "$i\t\t\t\e[32mInstalled\e[0m"
|
||||
fi
|
||||
@@ -42,7 +45,8 @@ function check()
|
||||
|
||||
if $a
|
||||
then
|
||||
echo -e "\nIn order to use all the extensions install the packages: tar, bzip2, gzip, zip, unzip, 7za, rar, unrar"
|
||||
echo -e "\nIn order to use all the extensions install the packages."
|
||||
echo -e "Or use 'lch -i' to install all dependences"
|
||||
fi
|
||||
echo ""
|
||||
}
|
||||
@@ -51,3 +55,19 @@ function lowercase()
|
||||
{
|
||||
echo "$DEST" | tr 'A-Z' 'a-z'
|
||||
}
|
||||
|
||||
function error_not_install()
|
||||
{
|
||||
echo -e "$@ \e[91mis not installed\e[0m, use 'lch -i' to install and 'lch -c' to check."
|
||||
exit 0
|
||||
}
|
||||
|
||||
function executer()
|
||||
{
|
||||
if [ -x "$(command -v $1)" ]
|
||||
then
|
||||
"$@"
|
||||
else
|
||||
error_not_install $1
|
||||
fi
|
||||
}
|
||||
Reference in New Issue
Block a user