Commit 117ac8dc authored by Vitaly Lipatov's avatar Vitaly Lipatov

erc: add --use-7z and --use-patool

parent 2f5642f5
......@@ -20,15 +20,22 @@
have_patool()
{
# TODO: optimize?
is_command patool
[ -n "$use_7z" ] && return 1
[ -n "$use_patool" ] || is_command patool
}
HAVE_7Z=''
if ! have_patool ; then
# TODO: try install patool and p7zip
is_command 7za && HAVE_7Z="7za"
is_command 7z && HAVE_7Z="7z"
fi
set_backend()
{
HAVE_7Z='7z'
[ -n "$use_patool" ] && [ -n "$use_7z" ] && fatal "Don't use --use-7z and --use-tool simulateously."
if [ -n "$use_7z" ] || ! have_patool ; then
# TODO: try install patool and p7zip
is_command 7za && HAVE_7Z='7za'
#is_command 7z && HAVE_7Z='7z'
fi
[ -z "$force" ] || HAVE_7Z="$HAVE_7Z -y"
}
list_subformats()
......
......@@ -209,6 +209,8 @@ progname="${0##*/}"
force=
target=
verbose=--verbose
use_7z=
use_patool=
if [ -z "$" ] ; then
echo "Etersoft archive manager version @VERSION@" >&2
......@@ -232,6 +234,12 @@ case "$1" in
-f|--force) # HELPOPT: override target
force=-f
;;
--use-patool) # HELPOPT: force use patool as backend
use_patool=1
;;
--use-7z) # HELPOPT: force use 7z as backend
use_7z=1
;;
-*)
fatal "Unknown option '$1'"
;;
......@@ -242,6 +250,8 @@ esac
shift
done
set_backend
cmd="$1"
eval lastarg=\${$#}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment