3 # Written by andrey joukov
4 # (C) 1996 2:5020/337.13@fidonet.org
5 # Updated by christian.gennerat@alcatel.fr 1999
6 # Andrew V. Samoilov <sav@bcs.zp.ua> 2000
9 # rar and unrar can be found on http://www.rarlabs.com/
13 # Prefer unrar (freeware).
14 UNRAR
=`which unrar 2>/dev/null`
16 [ -z $UNRAR ] && UNRAR
=$RAR
17 [ ! -x $UNRAR -a -x $RAR ] && UNRAR
=$RAR
19 # Define $UNRAR version
20 UNRAR_VERSION
=`$UNRAR -? | grep "Copyright" | sed -e 's/.*\([0-9]\)\..*/\1/'`
24 $UNRAR v
-c- -cfg- "$1" | @AWK@
-v uid
=`id -u` -v gid
=`id -g` '
26 /^-------/ { flag++; if (flag > 1) exit 0; next }
31 if (index($6, "D") != 0)
34 if (index($6, ".") != 0)
36 printf "%s 1 %s %s %d %02d/%02d/%02d %s ./%s\n", $6, uid, gid, $1, a[2], a[1], a[3], $5, str
42 $UNRAR v
-c- -cfg- "$1" | @AWK@
-v uid
=`id -u` -v gid
=`id -g` '
44 /^-----------/ { flag++; if (flag > 1) exit 0; next }
47 if (index($1, "D") != 0)
50 if (index($1, ".") != 0)
52 printf "%s 1 %s %s %d %02d/%02d/%02d %s ./%s\n", $1, uid, gid, $2, a[2], a[1], a[3], $6, $8
58 [ x
$UNRAR_VERSION = x5
] && mcrar5fs_list
"$@" || mcrar4fs_list
"$@"
63 # copyin by christian.gennerat@alcatel.fr
64 # preserve pwd. It is clean, but is it necessary?
66 # Create a directory and copy in it the tmp file with the good name
70 # if file is to be written upper in the archive tree, make fake dir
71 if test x
"$di" != x
"${2##*/}" ; then
74 cp -fp "$3" "$3.dir/$2"
75 $RAR a
"$1" "$2" >/dev
/null
82 $UNRAR p
-p- -c- -cfg- -inul "$1" "$2" > "$3"
87 # preserve pwd. It is clean, but is it necessary?
89 # Create a directory and create in it a tmp directory with the good name
90 dir
=`mktemp -d "${MC_TMPDIR:-/tmp}/mctmpdir-urar.XXXXXX"` ||
exit 1
93 # rar cannot create an empty directory
95 $RAR a
-r "$1" "$2" >/dev
/null
96 $RAR d
"$1" "$2/.rarfs" >/dev
/null
103 $RAR d
"$1" "$2" >/dev
/null
112 # Workaround for a bug in mc - directories must precede files to
113 # avoid duplicate entries, so we sort output by filenames
114 list
) mcrarfs_list
"$@" |
sort -k 8 ;;
115 rm) mcrarfs_rm
"$@" ;;
116 rmdir) mcrarfs_rm
"$@" ;;
117 mkdir
) mcrarfs_mkdir
"$@" ;;
118 copyin
) mcrarfs_copyin
"$@" ;;
119 copyout
) mcrarfs_copyout
"$@" ;;