Updated Russian translation.
[midnight-commander.git] / src / vfs / extfs / helpers / uzoo.in
blobd85666977049cbd4487433750635dcd105592557
1 #! /bin/sh
3 # Zoo file system
5 # Source of zoo can be found at
6 # ftp://ftp.ibiblio.org/pub/Linux/utils/compress/
8 ZOO=zoo
10 # Stupid zoo won't work if the archive name has no .zoo extension, so we
11 # have to make a symlink with a "better" name. Also, zoo can create
12 # directories even if printing files to stdout, so it's safer to confine
13 # it to a temporary directory.
14 mklink ()
16 TMPDIR=`mktemp -d ${MC_TMPDIR:-/tmp}/mctmpdir-uzoo.XXXXXX` || exit 1
17 trap 'cd /; rm -rf "$TMPDIR"' 0 1 2 3 5 13 15
18 ARCHIVE="$TMPDIR/tmp.zoo"
19 ln -sf "$1" "$ARCHIVE"
20 cd "$TMPDIR" || exit 1
23 mczoofs_list ()
25 mklink "$1"
26 $ZOO lq "$ARCHIVE" | @AWK@ -v uid=$(id -ru) '
27 /^[^\ ]/ { next }
29 if (NF < 8)
30 next
31 if ($8 ~ /^\^/)
32 $8=substr($8, 2)
33 if ($6 > 50)
34 $6=$6 + 1900
35 else
36 $6=$6 + 2000
37 split($7, a, ":")
38 if ($8 ~ /\/$/)
39 printf "drwxr-xr-x 1 %-8d %-8d %8d %s %2d %4d %02d:%02d %s\n", uid, 0, $1, $5, $4, $6, a[1], a[2], $8
40 else
41 printf "-rw-r--r-- 1 %-8d %-8d %8d %s %2d %4d %02d:%02d %s\n", uid, 0, $1, $5, $4, $6, a[1], a[2], $8
42 }' 2>/dev/null
43 exit 0
46 mczoofs_copyout ()
48 mklink "$1"
49 # zoo only accepts name without directory as file to extract
50 base=`echo "$2" | sed 's,.*/,,'`
51 $ZOO xpq: "$ARCHIVE" "$base" > "$3"
52 cd /
53 exit 0
56 umask 077
58 cmd="$1"
59 shift
60 case "$cmd" in
61 list) mczoofs_list "$@" ;;
62 copyout) mczoofs_copyout "$@" ;;
63 *) exit 1 ;;
64 esac
65 exit 0