Merge branch '4593_tar_compilation'
[midnight-commander.git] / src / vfs / extfs / helpers / uace.in
blob22eae30fca5cb92d8ae21cf8d1eae69d6b3dc3b8
1 #! /bin/sh
4 # ACE Virtual filesystem executive v0.1
5 # Works with unace v2.5
7 # Note: There are two packages for Debian: 'unace' (v1.2b) and
8 # 'unace-nonfree' (v2.x). This script supports 'unace-nonfree' only.
9 # 'unace', which supports only old versions of ACE archives (and is
10 # therefore of little use), uses the pipe character to separate columns
11 # in its listing format.
13 # Copyright (C) 2008 Jacques Pelletier
14 # May be distributed under the terms of the GNU Public License
15 # <jpelletier@ieee.org>
18 # Define which archiver you are using with appropriate options
19 ACE_LIST=${MC_TEST_EXTFS_LIST_CMD:-"unace l"}
20 ACE_GET="unace x"
21 # ACE_PUT="unace ?" not available
23 # The 'list' command executive
25 # Unace: DD.MM.YY HH:MM packed size ratio file
26 # ls:
27 mc_ace_fs_list()
29 if [ "x$UID" = "x" ]; then
30 UID=`id -ru 2>/dev/null`
31 if [ "x$UID" = "x" ]; then
32 UID=0
35 $ACE_LIST "$1" | @AWK@ -v uid=$UID '
36 /%/ {
37 split($1,date,".")
39 if (date[3] > 50)
40 date[3]=date[3] + 1900
41 else
42 date[3]=date[3] + 2000
44 printf "-rw-r--r-- 1 %-8d %-8d %8d %02d-%02d-%04d %s %s\n", uid, 0, $4, date[2], date[1], date[3], $2, $6
45 }' 2>/dev/null
46 exit 0
49 # Command: copyout archivename storedfilename extractto
50 mc_ace_fs_copyout()
52 $ACE_GET "$1" "$2" > /dev/null 2>&1
53 mv "$2" "$3"
56 # The main routine
57 umask 077
59 cmd="$1"
60 shift
62 case "$cmd" in
63 list) mc_ace_fs_list "$@" ;;
64 copyout) mc_ace_fs_copyout "$@" ;;
65 *) exit 1 ;;
66 esac
67 exit 0