Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37549748
en ru br
Репозитории ALT
S:4.8.30-alt3
5.1: 4.8.11-alt0.M51.1
4.1: 4.6.2-alt7.pre1
4.0: 4.6.1r-alt9
3.0: 4.6.1r-alt3
www.altlinux.org/Changes

Группа :: Работа с файлами
Пакет: mc

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: mc-4.6.1-alt-u7z.patch
Скачать


diff -Naur mc-4.6.1/lib/mc.ext.in.orig mc-4.6.1/lib/mc.ext.in
--- mc-4.6.1/lib/mc.ext.in.orig	2005-09-15 12:56:29 +0400
+++ mc-4.6.1/lib/mc.ext.in	2005-09-15 12:56:56 +0400
@@ -206,9 +206,9 @@
 	Open=%cd %p#iso9660
 	View=%view{ascii} isoinfo -l -i %f
 
-# 7zip archives (they are not man pages)
-shell/.7z
+regex/\.(7z|7Z)$
 	View=%view{ascii} 7za l %f 2>/dev/null
+	Open=%cd %p#u7z
 
 
 ### Sources ###
diff -Naur mc-4.6.1/vfs/extfs.orig/Makefile.in mc-4.6.1/vfs/extfs/Makefile.in
--- mc-4.6.1/vfs/extfs.orig/Makefile.in	2003-04-29 20:03:12 +0400
+++ mc-4.6.1/vfs/extfs/Makefile.in	2005-09-15 13:03:04 +0400
@@ -229,7 +229,7 @@
 EXTFS_MISC = README extfs.ini sfs.ini
 
 # Scripts hat don't need adaptation to the local system
-EXTFS_CONST = bpp rpm trpm
+EXTFS_CONST = bpp rpm trpm u7z
 
 # Scripts that need adaptation to the local system - source files
 EXTFS_IN = \
diff -Naur mc-4.6.1/vfs/extfs.orig/extfs.ini mc-4.6.1/vfs/extfs/extfs.ini
--- mc-4.6.1/vfs/extfs.orig/extfs.ini	2005-09-15 15:34:51 +0400
+++ mc-4.6.1/vfs/extfs/extfs.ini	2005-09-15 15:34:23 +0400
@@ -52,3 +52,6 @@
 
 # ISO image
 iso9660
+
+# 7zip
+u7z
diff -Naur mc-4.6.1/vfs/extfs.orig/u7z mc-4.6.1/vfs/extfs/u7z
--- mc-4.6.1/vfs/extfs.orig/u7z	1970-01-01 03:00:00 +0300
+++ mc-4.6.1/vfs/extfs/u7z	2005-05-26 00:42:12 +0400
@@ -0,0 +1,157 @@
+#! /bin/sh
+#
+# u7z - 7zip file archive Virtual File System for Midnight Commander ( ftp://ftp.ibiblio.org/pub/Linux/utils/file/managers/mc/ )
+# 
+# Copyright (C) 2004 Sergiy Niskorodov (sgh at ukrpost dot net)
+
+# Written by Sergiy Niskorodov aka SGh
+#
+# beta version 4.16 (11 Apr 2005)
+#
+# 7z for linux can be found on http://sourceforge.net/projects/p7zip/
+
+
+# Thanks to urar VFS authors andrey joukov 2:5020/337.13@fidonet.org, 
+# christian.gennerat@alcatel.fr, Andrew V. Samoilov <sav@bcs.zp.ua>
+# I use this script like example
+
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+SEVENZ=`which 7za`
+
+
+mc7zfs_list ()
+{
+    $SEVENZ l "$1" 2> /dev/null | gawk -v uid=${UID-0} '
+BEGIN { flag=0; arr_of_month="JanFebMarAprMayJunJulAugSepOctNovDec" }
+ /^-------/ { flag++; if (flag > 1) exit 0; next }
+{
+if (flag == 0) next
+
+year=substr($1, 1, 4)
+month=substr($1, 6, 2)
+day=substr($1, 9, 2)
+
+month_name=substr(arr_of_month, (month-1)*3+1, 3)
+
+time=substr($2, 1, 5)
+
+if (index($3, "D") != 0)
+    attr="drwxr-xr-x"
+else
+if (index($3, ".") != 0)
+    attr="-rw-r--r--"
+
+size=$4
+
+$0=substr($0, 54)
+if (NF > 1)
+    name=$0
+else
+    name=$1
+
+gsub(/\\/, "/", name)
+
+printf "%s   1 %-8d %-8d %8d %3s %2d %4d %s %s\n", attr, uid, 0, size, month_name, day, year, time, name
+}'
+}
+
+mc7zfs_copyin ()
+{
+# preserve pwd.
+    pwd=`pwd`
+# Create a directory and copy in it the tmp file with the random name
+    dir="$3".dir
+    mkdir "$dir"
+    cd "$dir"
+    mv "$1" .
+    arname=`basename "$1"`
+    di="${2%/*}"
+# if file is to be written upper in the archive tree, make fake dir
+    if test "$di" != "${2##*/}" ; then
+#	echo asdsad 1>&2
+        mkdir -p "$di" 
+    fi
+#    pwd > /tmp/cdir
+#    echo "$arname $2" > /tmp/ters
+    cp -fp "$3" "$dir/$2"
+#    cp -f "$1" "$3.dir"
+    $SEVENZ a "$arname" "$2" -w >/dev/null 2> /dev/null
+    mv "$arname" "$1"
+    cd $pwd
+    rm -rf "$3.dir"
+}
+
+mc7zfs_copyout ()
+{
+    dir=tmpdir.${RANDOM}
+    mkdir /tmp/"$dir"
+#    echo "$1 $2 $3" > hers
+#	p7zip 0.91 don't understand filename in subdir without "./"
+#	but in top dir it understand only without "./"
+    FLIST=`$SEVENZ l "$1" 2> /dev/null`
+    echo "$FLIST" | grep -q "[.][/]" &> /dev/null && EXFNAME=*./"$2" || EXFNAME="$2"
+    EXFN=`basename "$2"`
+    $SEVENZ e -r- "$1" "$EXFNAME" -o/tmp/"$dir" > /dev/null 2> /dev/null
+
+    cat /tmp/"$dir"/"$EXFN" > "$3"
+    rm -rf /tmp/"$dir"
+}
+
+mc7zfs_mkdir ()
+{
+# Function not fully implemented, because 7z cannot keep empty directories
+# preserve pwd.
+    pwd=`pwd`
+# Create a directory and create in it a tmp directory with the good name     
+    dir=tmpdir.${RANDOM}
+    mkdir $dir
+    cd $dir
+    mv "$1" .
+    arname=`basename "$1"`
+    mkdir -p "$2"
+# 7z cannot create an empty directory    
+#    touch "$2"/.emptydir
+    $SEVENZ a -r "$arname" "$2" >/dev/null 2>/dev/null
+#    echo "$1" "$2" >error34
+#    $SEVENZ d ../"$1" "$2/.7zfs" >/dev/null
+    mv "$arname" "$1"
+    cd $pwd
+    rm -rf $dir
+}
+
+mc7zfs_rm ()
+{
+    $SEVENZ l "$1" 2> /dev/null | grep -q "[.][/]" &> /dev/null && EXFNAME=*./"$2" || EXFNAME="$2"
+    $SEVENZ d "$1" "$EXFNAME" 2>&1 | grep -q E_NOTIMPL &> /dev/null && { echo -e "Function not implemented...\n7z cannot delete files from solid archive." >&2 ; exit 1 ; }
+}
+
+umask 077
+
+cmd="$1"
+shift
+
+case "$cmd" in
+  list)    mc7zfs_list    "$@" ;;
+  rm)      mc7zfs_rm      "$@" ;;
+  rmdir)   mc7zfs_rm      "$@" ;;
+  mkdir)   mc7zfs_mkdir   "$@" ;;
+  copyin)  mc7zfs_copyin  "$@" ;;
+  copyout) mc7zfs_copyout "$@" ;;
+  *) exit 1 ;;
+esac
+exit 0
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin