From ff6cd52e538179c009716539cbb5fb00967c2739 Mon Sep 17 00:00:00 2001 From: Slava Zanko Date: Thu, 3 Sep 2009 13:37:15 +0300 Subject: [PATCH] Ticket #44: More functionally u7z. * automatically search of 7z or 7za utility * fixed calculate of EXFNAME file name. Signed-off-by: Slava Zanko --- vfs/extfs/u7z | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/vfs/extfs/u7z b/vfs/extfs/u7z index 75d0c86e3..cc8d2d9de 100644 --- a/vfs/extfs/u7z +++ b/vfs/extfs/u7z @@ -5,7 +5,7 @@ # Some Bugfixes/workarounds by Sergiy Niskorodov # Licensed under GNU GPL version 2 or later version. -P7ZIP=7za +P7ZIP=`which 7z 2>/dev/null` || P7ZIP=`which 7za 2>/dev/null` mcu7zip_list () { @@ -21,8 +21,8 @@ mcu7zip_list () mcu7zip_copyout () { #first we check if we have old p7zip archive with prefix ./ in filename - $P7ZIP l "$1" "$2" | grep -q "0 files" && \ - EXFNAME=*./"$2" || EXFNAME="$2" + $P7ZIP l "$1" "$2" | grep -q "0 files, 0 folders" && \ + EXFNAME='*./'"$2" || EXFNAME="$2" $P7ZIP e -so "$1" "$EXFNAME" > "$3" 2>/dev/null } @@ -43,8 +43,8 @@ mcu7zip_rm () { # NOTE: Version 4.20 fails to delete files in subdirectories #first we check if we have old p7zip archive with prefix ./ in filename - $P7ZIP l "$1" "$2" | grep -q "0 files" && \ - EXFNAME=*./"$2" || EXFNAME="$2" + $P7ZIP l "$1" "$2" | grep -q "0 files, 0 folders" && \ + EXFNAME='*./'"$2" || EXFNAME="$2" $P7ZIP d "$1" "$EXFNAME" 2>&1 | grep -q E_NOTIMPL > /dev/null 2>&1 && \ { printf "Function not implemented...\n7z cannot delete from solid archive." >&2 ; exit 1 ; } } @@ -52,8 +52,8 @@ mcu7zip_rm () mcu7zip_rmdir () { #first we check if we have old p7zip archive with prefix ./ in filename - $P7ZIP l "$1" "$2" | grep -q "0 files" && \ - EXFNAME=*./"$2" || EXFNAME="$2" + $P7ZIP l "$1" "$2" | grep -q "0 files, 0 folders" && \ + EXFNAME='*./'"$2" || EXFNAME="$2" $P7ZIP d "$1" "$EXFNAME"/ 2>&1 | grep -q E_NOTIMPL > /dev/null 2>&1 && \ { printf "Function not implemented...\n7z cannot delete from solid archive." >&2 ; exit 1 ; } }