Ticket #92: mc-4.6.1-alt-u7z.patch

File mc-4.6.1-alt-u7z.patch, 5.5 KB (added by slavazanko, 15 years ago)

AltLinux? patch

  • mc-4.6.1/lib/mc.ext.in

    diff -Naur mc-4.6.1/lib/mc.ext.in.orig mc-4.6.1/lib/mc.ext.in
    old new  
    206206        Open=%cd %p#iso9660 
    207207        View=%view{ascii} isoinfo -l -i %f 
    208208 
    209 # 7zip archives (they are not man pages) 
    210 shell/.7z 
     209regex/\.(7z|7Z)$ 
    211210        View=%view{ascii} 7za l %f 2>/dev/null 
     211        Open=%cd %p#u7z 
    212212 
    213213 
    214214### Sources ### 
  • mc-4.6.1/vfs/extfs

    diff -Naur mc-4.6.1/vfs/extfs.orig/Makefile.in mc-4.6.1/vfs/extfs/Makefile.in
    old new  
    229229EXTFS_MISC = README extfs.ini sfs.ini 
    230230 
    231231# Scripts hat don't need adaptation to the local system 
    232 EXTFS_CONST = bpp rpm trpm 
     232EXTFS_CONST = bpp rpm trpm u7z 
    233233 
    234234# Scripts that need adaptation to the local system - source files 
    235235EXTFS_IN = \ 
  • mc-4.6.1/vfs/extfs

    diff -Naur mc-4.6.1/vfs/extfs.orig/extfs.ini mc-4.6.1/vfs/extfs/extfs.ini
    old new  
    5252 
    5353# ISO image 
    5454iso9660 
     55 
     56# 7zip 
     57u7z 
  • mc-4.6.1/vfs/extfs

    diff -Naur mc-4.6.1/vfs/extfs.orig/u7z mc-4.6.1/vfs/extfs/u7z
    old new  
     1#! /bin/sh 
     2# 
     3# u7z - 7zip file archive Virtual File System for Midnight Commander ( ftp://ftp.ibiblio.org/pub/Linux/utils/file/managers/mc/ ) 
     4#  
     5# Copyright (C) 2004 Sergiy Niskorodov (sgh at ukrpost dot net) 
     6 
     7# Written by Sergiy Niskorodov aka SGh 
     8# 
     9# beta version 4.16 (11 Apr 2005) 
     10# 
     11# 7z for linux can be found on http://sourceforge.net/projects/p7zip/ 
     12 
     13 
     14# Thanks to urar VFS authors andrey joukov 2:5020/337.13@fidonet.org,  
     15# christian.gennerat@alcatel.fr, Andrew V. Samoilov <sav@bcs.zp.ua> 
     16# I use this script like example 
     17 
     18 
     19# This program is free software; you can redistribute it and/or modify 
     20# it under the terms of the GNU General Public License as published by 
     21# the Free Software Foundation; either version 2 of the License, or 
     22# (at your option) any later version. 
     23#  
     24# This program is distributed in the hope that it will be useful, 
     25# but WITHOUT ANY WARRANTY; without even the implied warranty of 
     26# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     27# GNU General Public License for more details. 
     28#  
     29# You should have received a copy of the GNU General Public License 
     30# along with this program; if not, write to the Free Software 
     31# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
     32 
     33 
     34SEVENZ=`which 7za` 
     35 
     36 
     37mc7zfs_list () 
     38{ 
     39    $SEVENZ l "$1" 2> /dev/null | gawk -v uid=${UID-0} ' 
     40BEGIN { flag=0; arr_of_month="JanFebMarAprMayJunJulAugSepOctNovDec" } 
     41 /^-------/ { flag++; if (flag > 1) exit 0; next } 
     42{ 
     43if (flag == 0) next 
     44 
     45year=substr($1, 1, 4) 
     46month=substr($1, 6, 2) 
     47day=substr($1, 9, 2) 
     48 
     49month_name=substr(arr_of_month, (month-1)*3+1, 3) 
     50 
     51time=substr($2, 1, 5) 
     52 
     53if (index($3, "D") != 0) 
     54    attr="drwxr-xr-x" 
     55else 
     56if (index($3, ".") != 0) 
     57    attr="-rw-r--r--" 
     58 
     59size=$4 
     60 
     61$0=substr($0, 54) 
     62if (NF > 1) 
     63    name=$0 
     64else 
     65    name=$1 
     66 
     67gsub(/\\/, "/", name) 
     68 
     69printf "%s   1 %-8d %-8d %8d %3s %2d %4d %s %s\n", attr, uid, 0, size, month_name, day, year, time, name 
     70}' 
     71} 
     72 
     73mc7zfs_copyin () 
     74{ 
     75# preserve pwd. 
     76    pwd=`pwd` 
     77# Create a directory and copy in it the tmp file with the random name 
     78    dir="$3".dir 
     79    mkdir "$dir" 
     80    cd "$dir" 
     81    mv "$1" . 
     82    arname=`basename "$1"` 
     83    di="${2%/*}" 
     84# if file is to be written upper in the archive tree, make fake dir 
     85    if test "$di" != "${2##*/}" ; then 
     86#       echo asdsad 1>&2 
     87        mkdir -p "$di"  
     88    fi 
     89#    pwd > /tmp/cdir 
     90#    echo "$arname $2" > /tmp/ters 
     91    cp -fp "$3" "$dir/$2" 
     92#    cp -f "$1" "$3.dir" 
     93    $SEVENZ a "$arname" "$2" -w >/dev/null 2> /dev/null 
     94    mv "$arname" "$1" 
     95    cd $pwd 
     96    rm -rf "$3.dir" 
     97} 
     98 
     99mc7zfs_copyout () 
     100{ 
     101    dir=tmpdir.${RANDOM} 
     102    mkdir /tmp/"$dir" 
     103#    echo "$1 $2 $3" > hers 
     104#       p7zip 0.91 don't understand filename in subdir without "./" 
     105#       but in top dir it understand only without "./" 
     106    FLIST=`$SEVENZ l "$1" 2> /dev/null` 
     107    echo "$FLIST" | grep -q "[.][/]" &> /dev/null && EXFNAME=*./"$2" || EXFNAME="$2" 
     108    EXFN=`basename "$2"` 
     109    $SEVENZ e -r- "$1" "$EXFNAME" -o/tmp/"$dir" > /dev/null 2> /dev/null 
     110 
     111    cat /tmp/"$dir"/"$EXFN" > "$3" 
     112    rm -rf /tmp/"$dir" 
     113} 
     114 
     115mc7zfs_mkdir () 
     116{ 
     117# Function not fully implemented, because 7z cannot keep empty directories 
     118# preserve pwd. 
     119    pwd=`pwd` 
     120# Create a directory and create in it a tmp directory with the good name      
     121    dir=tmpdir.${RANDOM} 
     122    mkdir $dir 
     123    cd $dir 
     124    mv "$1" . 
     125    arname=`basename "$1"` 
     126    mkdir -p "$2" 
     127# 7z cannot create an empty directory     
     128#    touch "$2"/.emptydir 
     129    $SEVENZ a -r "$arname" "$2" >/dev/null 2>/dev/null 
     130#    echo "$1" "$2" >error34 
     131#    $SEVENZ d ../"$1" "$2/.7zfs" >/dev/null 
     132    mv "$arname" "$1" 
     133    cd $pwd 
     134    rm -rf $dir 
     135} 
     136 
     137mc7zfs_rm () 
     138{ 
     139    $SEVENZ l "$1" 2> /dev/null | grep -q "[.][/]" &> /dev/null && EXFNAME=*./"$2" || EXFNAME="$2" 
     140    $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 ; } 
     141} 
     142 
     143umask 077 
     144 
     145cmd="$1" 
     146shift 
     147 
     148case "$cmd" in 
     149  list)    mc7zfs_list    "$@" ;; 
     150  rm)      mc7zfs_rm      "$@" ;; 
     151  rmdir)   mc7zfs_rm      "$@" ;; 
     152  mkdir)   mc7zfs_mkdir   "$@" ;; 
     153  copyin)  mc7zfs_copyin  "$@" ;; 
     154  copyout) mc7zfs_copyout "$@" ;; 
     155  *) exit 1 ;; 
     156esac 
     157exit 0