31 | | $UNRAR v -c- -cfg- "$1" | gawk -v uid=`id -u` -v gid=`id -g` ' |
32 | | BEGIN { flag=0 } |
33 | | /^-------/ { flag++; if (flag > 1) exit 0; next } |
34 | | flag==1 { |
35 | | str = substr($0, 2) |
36 | | getline |
37 | | split($4, a, "-") |
38 | | if (index($6, "D") != 0) |
39 | | $6="drwxr-xr-x" |
40 | | else |
41 | | if (index($6, ".") != 0) |
42 | | $6="-rw-r--r--" |
43 | | printf "%s 1 %s %s %d %02d/%02d/%02d %s ./%s\n", $6, uid, gid, $1, a[2], a[1], a[3], $5, str |
44 | | }' |
| 31 | $UNRAR v -c- -cfg- "$1" 2>&1 | grep -q -m1 "Pathname/Comment" |
| 32 | if [ $? == 0 ]; then |
| 33 | $UNRAR v -c- -cfg- "$1" | gawk -v uid=`id -u` -v gid=`id -g` ' |
| 34 | BEGIN { flag=0 } |
| 35 | /^-------/ { flag++; if (flag > 1) exit 0; next } |
| 36 | flag==1 { |
| 37 | str = substr($0, 2) |
| 38 | getline |
| 39 | split($4, a, "-") |
| 40 | if (index($6, "D") != 0) |
| 41 | $6="drwxr-xr-x" |
| 42 | else |
| 43 | if (index($6, ".") != 0) |
| 44 | $6="-rw-r--r--" |
| 45 | printf "%s 1 %s %s %d %02d/%02d/%02d %s ./%s\n", $6, uid, gid, $1, a[2], a[1], a[3], $5, str |
| 46 | }' |
| 47 | else |
| 48 | echo "-r--r--r-- 1 `id -u` `id -g` 0 01-01-1970 00:00 @ERROR-BAD-ARCHIVE@" |
| 49 | fi |