3
# Copyright (C) 2013, 2020 Etersoft
4
# Copyright (C) 2013, 2020 Vitaly Lipatov <lav@etersoft.ru>
6
# This program is free software: you can redistribute it and/or modify
7
# it under the terms of the GNU Affero General Public License as published by
8
# the Free Software Foundation, either version 3 of the License, or
9
# (at your option) any later version.
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU Affero General Public License for more details.
16
# You should have received a copy of the GNU Affero General Public License
17
# along with this program. If not, see <http://www.gnu.org/licenses/>.
21
[ "$PROGDIR" = "." ] && PROGDIR=$(pwd)
23
# will replaced to /usr/share/erc during install
28
local CMD="$SHAREDIR/$1"
29
[ -r "$CMD" ] || fatal "Have no $CMD helper file"
33
load_helper erc-sh-functions
34
load_helper erc-sh-archive
52
echo "Etersoft uncompressor version @VERSION@"
53
echo "Copyright (c) Etersoft 2013, 2020, 2023"
54
echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
64
# instead of epm assure
65
if ! is_command "$prg" ; then
66
epm assure $prg $pkg || fatal "Try install $pkg package for $prg unpack command."
69
docmd $prg $opt $file || fatal
75
Usage="Usage: $progname [options] file(s)..."
76
Descr="ercat - universal file uncompressor"
81
# Just printout help if run without args
82
if [ -z "$cmd" ] ; then
85
fatal "Run $ $progname --help for get help"
89
-h|--help|help) # HELPOPT: this help
93
-q|--quiet) # HELPOPT: be silent
98
-v|--version) # HELPOPT: print version
105
# TODO: check file existence
106
# TODO: check by content
108
TYPE=$(get_archive_ext $f) || TYPE=$(is_plain_text $f) || { warning "Skipping unrecognized $f" ; continue ; }
111
regular_unpack "$f" gunzip gzip -c
114
regular_unpack "$f" bzcat bzip2
117
regular_unpack "$f" xzcat xz
120
regular_unpack "$f" zcat gzip
123
regular_unpack "$f" lzcat xz
126
regular_unpack "$f" zstdcat zstd
129
regular_unpack "$f" lz4cat lz4
132
docmd cat "$f" || fatal
135
fatal "Unsupported compression format $TYPE"