Skip to content

Commit

Permalink
Merge pull request #2 from vininjr/issue1
Browse files Browse the repository at this point in the history
#issue1 - Adding support for the 7z format
  • Loading branch information
vininjr authored May 19, 2020
2 parents b0ced61 + 25f910f commit 8218169
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 69 deletions.
4 changes: 3 additions & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ mvdc
mvdc is a file decompress manager easy and simpler for the linux.


### Dependencies
### Supported Formats

- tar
- unzip
- unrar
- gzip
- bzip2
- lzma
- 7z

### Build from GitHub

Expand Down
24 changes: 2 additions & 22 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,5 @@ if [[ $EUID -ne 0 ]]; then
exit 1
fi

if ! type which tar > /dev/null; then
sudo apt install tar -y
fi

if ! type which unzip > /dev/null; then
sudo apt install unzip -y
fi

if ! type which unrar > /dev/null; then
sudo apt install unrar -y
fi

if ! type which gzip > /dev/null; then
sudo apt install gzip -y
fi

if ! type which bzip2 > /dev/null; then
sudo apt install bzip2 -y
fi

sudo cp mvdc-main.py /usr/bin/mvdc
sudo chmod +x /usr/bin/mvdc
sudo cp mvdc.sh /usr/bin/mvdc
sudo chmod +x /usr/bin/mvdc
41 changes: 0 additions & 41 deletions mvdc-main.py

This file was deleted.

98 changes: 98 additions & 0 deletions mvdc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#!/bin/bash

##############################################################################
## ##
## mvdc is a file decompress manager easy and simpler for the linux. ##
## ##
##############################################################################

# Help
function help() {
echo "usage: mvdc <file>"
echo " where file are [examples]:"
echo " bar.zip or bar.tar.gz"
exit 1
}

if [ ! -r $1 ]; then
help
fi

if [ $# -eq 0 ]; then
help
fi

tipo=$(file -i $1 | grep zip:)
if [ ${#tipo} != 0 ]; then
if ! type which unzip >/dev/null; then
sudo apt install unzip -y
fi
unzip $1
fi
tipo=$(file -i $1 | grep tar:)
if [ ${#tipo} != 0 ]; then
if ! type which tar >/dev/null; then
sudo apt install tar -y
fi
tar -xvf $1
fi
tipo=$(file -i $1 | grep gz:)
if [ ${#tipo} != 0 ]; then
tipo=$(file -i $1 | grep .tar.gz:)
if [ ${#tipo} != 0 ]; then
if ! type which tar >/dev/null; then
sudo apt install tar -y
fi
tar -xzvf $1
else
tipo=$(file -i $1 | grep .tgz:)
if [ ${#tipo} != 0 ]; then
if ! type which tar >/dev/null; then
sudo apt install tar -y
fi
tar -xzvf $1
else
if ! type which gzip >/dev/null; then
sudo apt install gzip -y
fi
gzip -d $1
fi
fi
fi
tipo=$(file -i $1 | grep bz2)
if [ ${#tipo} != 0 ]; then
if ! type which bzip2 >/dev/null; then
sudo apt install bzip2 -y
fi
tipo=$(file -i $1 | grep .tar.bz2:)
if [ ${#tipo} != 0 ]; then
if ! type which tar >/dev/null; then
sudo apt install tar -y
fi
bzip2 -dc $1 | tar -xv
else
bzip2 -d $1
fi
fi
tipo=$(file -i $1 | grep .lzma)
if [ ${#tipo} != 0 ]; then
if ! type which lzma >/dev/null; then
sudo apt install lzma -y
fi
lzma -d $1
fi
tipo=$(file -i $1 | grep .rar)
if [ ${#tipo} != 0 ]; then
if ! type which rar >/dev/null; then
sudo apt install rar -y
fi
rar -x $1
fi
tipo=$(file -i $1 | grep .7z)
if [ ${#tipo} != 0 ]; then
if ! type which p7zip-full >/dev/null; then
sudo apt install p7zip-full -y
fi
7za e $1
fi
echo "Descompress finish."
9 changes: 4 additions & 5 deletions update.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
#!/usr/bin/env bash

if [[ $EUID -ne 0 ]]; then
echo "superuser privileges are required" 1>&2
exit 1
echo "superuser privileges are required" 1>&2
exit 1
fi

if [ -d ".git" ]; then
git pull
git submodule update --init --recursive --remote
git pull origin master -f
sudo chmod +x install.sh
sudo ./install.sh
else
echo "Not a git repository (or any of the parent directories): .git. Do NOT download the repository as a zip file from GitHub.com! Please download Fuzion by cloning the Git repository: 'git clone --recursive https://github.com/vininjr/mvdc.git'"
exit
fi
fi

0 comments on commit 8218169

Please sign in to comment.