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

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

parent 2f5642f5
...@@ -20,15 +20,22 @@ ...@@ -20,15 +20,22 @@
have_patool() have_patool()
{ {
# TODO: optimize? # TODO: optimize?
is_command patool [ -n "$use_7z" ] && return 1
[ -n "$use_patool" ] || is_command patool
} }
HAVE_7Z='' set_backend()
if ! have_patool ; then {
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 # TODO: try install patool and p7zip
is_command 7za && HAVE_7Z="7za" is_command 7za && HAVE_7Z='7za'
is_command 7z && HAVE_7Z="7z" #is_command 7z && HAVE_7Z='7z'
fi fi
[ -z "$force" ] || HAVE_7Z="$HAVE_7Z -y"
}
list_subformats() list_subformats()
......
...@@ -209,6 +209,8 @@ progname="${0##*/}" ...@@ -209,6 +209,8 @@ progname="${0##*/}"
force= force=
target= target=
verbose=--verbose verbose=--verbose
use_7z=
use_patool=
if [ -z "$" ] ; then if [ -z "$" ] ; then
echo "Etersoft archive manager version @VERSION@" >&2 echo "Etersoft archive manager version @VERSION@" >&2
...@@ -232,6 +234,12 @@ case "$1" in ...@@ -232,6 +234,12 @@ case "$1" in
-f|--force) # HELPOPT: override target -f|--force) # HELPOPT: override target
force=-f 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'" fatal "Unknown option '$1'"
;; ;;
...@@ -242,6 +250,8 @@ esac ...@@ -242,6 +250,8 @@ esac
shift shift
done done
set_backend
cmd="$1" cmd="$1"
eval lastarg=\${$#} 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