3 # extfs support for p7zip
4 # Written by Pavel Roskin <proski@gnu.org>
5 # Some Bugfixes/workarounds by Sergiy Niskorodov <sgh@mail.zp.ua>
6 # Licensed under GNU GPL version 2 or later version.
8 P7ZIP
=`which 7z 2>/dev/null` || P7ZIP
=`which 7za 2>/dev/null` || P7ZIP
=`which 7zr 2>/dev/null`
12 # Symlinks are not shown - no idea how to distinguish them
13 # Read-only files are not shown as such - it's rarely useful
14 ugid
="`id -nu` `id -ng`"
15 date_re
='^\(....\)-\(..\)-\(..\) \(..:..:..\)'
17 size_re
='............'
18 $P7ZIP l
"$1" |
sed -n "s/$date_re D.... $size_re $size_re\(.*\)/drwxr-xr-x 1 $ugid 0 $date_mc \5/p;s/$date_re \..... \($size_re\) $size_re\(.*\)/-rw-r--r-- 1 $ugid \5 $date_mc \6/p"
23 #first we check if we have old p7zip archive with prefix ./ in filename
24 $P7ZIP l
"$1" "$2" |
grep -q "0 files, 0 folders" && \
25 EXFNAME
='*./'"$2" || EXFNAME
="$2"
26 $P7ZIP e
-so "$1" "$EXFNAME" > "$3" 2>/dev
/null
31 $P7ZIP a
-si"$2" "$1" <"$3" >/dev
/null
2>&1
36 dir
=`mktemp -d "${MC_TMPDIR:-/tmp}/mctmpdir-u7z.XXXXXX"` ||
exit 1
38 $P7ZIP a
-w"$dir" "$1" "$dir"/"$2" >/dev
/null
2>&1
44 # NOTE: Version 4.20 fails to delete files in subdirectories
45 #first we check if we have old p7zip archive with prefix ./ in filename
46 $P7ZIP l
"$1" "$2" |
grep -q "0 files, 0 folders" && \
47 EXFNAME
='*./'"$2" || EXFNAME
="$2"
48 $P7ZIP d
"$1" "$EXFNAME" 2>&1 |
grep -q E_NOTIMPL
> /dev
/null
2>&1 && \
49 { printf "Function not implemented...\n7z cannot delete from solid archive." >&2 ; exit 1 ; }
54 #first we check if we have old p7zip archive with prefix ./ in filename
55 $P7ZIP l
"$1" "$2" |
grep -q "0 files, 0 folders" && \
56 EXFNAME
='*./'"$2" || EXFNAME
="$2"
57 $P7ZIP d
"$1" "$EXFNAME"/ 2>&1 |
grep -q E_NOTIMPL
> /dev
/null
2>&1 && \
58 { printf "Function not implemented...\n7z cannot delete from solid archive." >&2 ; exit 1 ; }
61 # override any locale for dates
71 list
) mcu7zip_list
"$@" |
sort -k 8 ;;
72 copyout
) mcu7zip_copyout
"$@" ;;
73 copyin
) mcu7zip_copyin
"$@" ;;
74 mkdir
) mcu7zip_mkdir
"$@" ;;
75 rm) mcu7zip_rm
"$@" ;;
76 rmdir) mcu7zip_rmdir
"$@" ;;