wok-stable view xarchive/stuff/slitaz-wrap.sh @ rev 2588
lostirc: Add custom desktop file with french translation
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Tue Apr 07 22:59:27 2009 +0200 (2009-04-07) |
parents | b538edb05596 |
children | d1d5df9b017e |
line source
1 #!/bin/sh
2 # slitaz-wrap.sh - sh slitaz core wrapper for xarchive frontend
3 # Copyright (C) 2005 Lee Bigelow <ligelowbee@yahoo.com>
4 # Copyright (C) 2008 Pascal Bellard <pascal.bellard@slitaz.org>
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 # set up exit status variables
21 E_UNSUPPORTED=65
23 # Supported file extentions for tar
24 TAR_EXTS="tar"
25 GZIP_EXTS="tar.gz tgz"
26 LZMA_EXTS="tar.lz tar.lzma tlz"
27 BZIP2_EXTS="tar.bz tbz tar.bz2 tbz2"
28 COMPRESS_EXTS="tar.z tar.Z"
29 IPK_EXTS="ipk"
30 CPIO_EXTS="cpio"
31 CPIOGZ_EXTS="cpio.gz"
32 ZIP_EXTS="zip cbz jar"
33 RPM_EXTS="rpm"
34 DEB_EXTS="deb"
35 TAZPKG_EXTS="tazpkg"
36 ISO_EXTS="iso"
37 SQUASHFS_EXTS="sqfs squashfs"
38 CROMFS_EXTS="cromfs"
39 FS_EXTS="ext2 ext3 dos fat vfat fd fs loop"
40 CLOOP_EXTS="cloop"
42 # Setup awk program
43 AWK_PROGS="mawk gawk awk"
44 AWK_PROG=""
45 for awkprog in $AWK_PROGS; do
46 if [ "$(which $awkprog)" ]; then
47 AWK_PROG="$awkprog"
48 break
49 fi
50 done
52 # setup variables opt and archive.
53 # the shifting will leave the files passed as
54 # all the remaining args "$@"
55 opt="$1"
56 test -z $1 || shift 1
57 archive="$1"
58 test -z $1 || shift 1
60 decompress_ipk()
61 {
62 tar xOzf "$1" ./data.tar.gz | gzip -dc
63 }
65 # set up compression variables for our compression functions.
66 # translate archive name to lower case for pattern matching.
67 # use compressor -c option to output to stdout and direct it where we want
68 lc_archive="$(echo $archive|tr [:upper:] [:lower:])"
69 DECOMPRESS="cat"
70 COMPRESS="cat"
71 for ext in $IPK_EXTS; do
72 if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then
73 DECOMPRESS="decompress_ipk"
74 fi
75 done
76 for ext in $GZIP_EXTS $CPIOGZ_EXTS; do
77 if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then
78 DECOMPRESS="gzip -dc"
79 COMPRESS="gzip -c"
80 fi
81 done
82 for ext in $BZIP2_EXTS; do
83 if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then
84 DECOMPRESS="bunzip2 -c"
85 COMPRESS="bzip2 -c"
86 fi
87 done
88 for ext in $LZMA_EXTS; do
89 if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then
90 DECOMPRESS="unlzma -c"
91 COMPRESS="lzma e -si -so"
92 fi
93 done
94 for ext in $COMPRESS_EXTS; do
95 if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then
96 DECOMPRESS="uncompress -dc"
97 COMPRESS="compress -c"
98 fi
99 done
101 # Compression functions
102 decompress_func()
103 {
104 if [ "$DECOMPRESS" ]; then
105 tmpname="$(mktemp -t tartmp.XXXXXX)"
106 if [ -f "$archive" ]; then
107 $DECOMPRESS "$archive" > "$tmpname"
108 fi
109 # store old name for when we recompress
110 oldarch="$archive"
111 # change working file to decompressed tmp
112 archive="$tmpname"
113 fi
114 }
116 compress_func()
117 {
118 if [ "$COMPRESS" ] && [ "$oldarch" ]; then
119 [ -f "$oldarch" ] && rm "$oldarch"
120 if $COMPRESS < "$archive" > "$oldarch"; then
121 rm "$archive"
122 fi
123 fi
124 }
126 not_busybox()
127 {
128 case "$(readlink $(which $1))" in
129 *busybox*) return 1;;
130 esac
131 return 0
132 }
134 add_file()
135 {
136 ( cd $2 ; tar -cf - $1 ) | tar -xf -
137 }
139 remove_file()
140 {
141 rm -rf ./$1
142 }
144 update_tar_cpio()
145 {
146 action=$1
147 shift
148 tardir="$(dirname "$archive")"
149 [ $(expr "$lc_archive" : ".*\."$BZIP2_EXTS"$") -gt 0 ] && ! which bzip2 && return
150 for ext in $TAR_EXTS $GZIP_EXTS $BZIP2_EXTS $COMPRESS_EXTS $LZMA_EXTS; do
151 if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then
152 if [ "$action" = "new_archive" ]; then
153 decompress_func
154 cd "$tardir"
155 tar -cf "$archive" "${1#$tardir/}"
156 status=$?
157 compress_func
158 exit $status
159 fi
160 if not_busybox tar; then
161 decompress_func
162 case "$action" in
163 remove_file)
164 tar --delete -f "$archive" "$@";;
165 add_file)
166 cd "$tardir"
167 tar -rf "$archive" "${1#$tardir/}";;
168 *) false;;
169 esac
170 status=$?
171 compress_func
172 exit $status
173 fi
174 tmptar="$(mktemp -d -t tartmp.XXXXXX)"
175 here="$(pwd)"
176 cd $tmptar
177 $DECOMPRESS < "$archive" | tar -xf -
178 status=$?
179 if [ $status -eq 0 -a -n "$1" ]; then
180 while [ "$1" ]; do
181 $action "${1#$tardir/}" $here
182 shift
183 done
184 tar -cf - $(ls -a | grep -v ^\.$ | grep -v ^\.\.$) | \
185 $COMPRESS > "$archive"
186 status=$?
187 fi
188 cd $here
189 rm -rf $tmptar
190 exit $status
191 fi
192 done
193 for ext in $CPIO_EXTS $CPIOGZ_EXTS; do
194 if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then
195 if [ "$action" = "new_archive" ]; then
196 decompress_func
197 cd "$tardir"
198 echo "${1#$tardir/}" | cpio -o -H newc > "$archive"
199 status=$?
200 compress_func
201 exit $status
202 fi
203 tmpcpio="$(mktemp -d -t cpiotmp.XXXXXX)"
204 here="$(pwd)"
205 cd $tmpcpio
206 $DECOMPRESS "$archive" | cpio -id > /dev/null
207 status=$?
208 if [ $status -eq 0 -a -n "$1" ]; then
209 while [ "$1" ]; do
210 $action "${1#$tardir/}" $here
211 shift
212 done
213 find . | cpio -o -H newc | $COMPRESS > "$archive"
214 status=$?
215 fi
216 cd $here
217 rm -rf $tmpcpio
218 exit $status
219 fi
220 done
221 }
223 loop_fs()
224 {
225 tmpfs="$(mktemp -d -t fstmp.XXXXXX)"
226 umnt="umount -d"
227 case " $CLOOP_EXTS " in
228 \ $1\ ) mount -o loop=/dev/cloop,ro "$archive" $tmpfs;;
229 esac
230 case " $FS_EXTS " in
231 \ $1\ ) mount -o loop,rw "$archive" $tmpfs;;
232 esac
233 case " $ISO_EXTS " in
234 \ $1\ ) mount -o loop,ro -t iso9660 "$archive" $tmpfs;;
235 esac
236 case " $SQUASHFS_EXTS " in
237 \ $1\ ) mount -o loop,ro -t squashfs "$archive" $tmpfs;;
238 esac
239 case " $CROMFS_EXTS " in
240 \ $1\ ) cromfs-driver "$archive" $tmpfs; umnt="fusermount -u";;
241 esac
242 case "$2" in
243 stat) find $tmpfs | while read f; do
244 [ "$f" = "$tmpfs" ] && continue
245 link="-"
246 [ -L "$f" ] && link=$(readlink "$f")
247 date=$(stat -c "%y" $f | awk \
248 '{ printf "%s;%s\n",$1,substr($2,0,8)}')
249 echo "${f#$tmpfs/};$(stat -c "%s;%A;%U;%G" $f);$date;$link"
250 done;;
251 copy) if [ -z "$3" ]; then
252 ( cd $tmpfs ; tar cf - . ) | tar xf -
253 else
254 while [ -n "$3" ]; do
255 ( cd $tmpfs ; tar cf - "$3" ) | tar xf -
256 shift;
257 done
258 fi;;
259 add) tar cf - "$@" | ( cd $tmpfs ; tar xf - );;
260 remove) while [ -n "$3" ]; do
261 rm -rf $tmpfs/$3
262 done;;
263 esac
264 $umnt $tmpfs
265 rmdir $tmpfs
266 }
268 # the option switches
269 case "$opt" in
270 -i) # info: output supported extentions for progs that exist
271 for ext in $TAR_EXTS $GZIP_EXTS $BZIP2_EXTS $COMPRESS_EXTS $LZMA_EXTS \
272 $CPIO_EXTS $CPIOGZ_EXTS $ZIP_EXTS $DEB_EXTS $RPM_EXTS \
273 $TAZPKG_EXTS $ISO_EXTS $FS_EXTS $IPK_EXTS; do
274 printf "%s;" $ext
275 if [ "$ext" = "zip" -a ! "$(which zip)" ]; then
276 echo warning: zip not found, extract only >/dev/stderr
277 fi
278 done
279 [ -d /lib/modules/$(uname -r)/kernel/fs/squashfs/squashfs.ko ] && \
280 for ext in $SQUASHFS_EXTS; do
281 printf "%s;" $ext
282 done
283 [ -x /bin/cromfs-driver ] && for ext in $CROMFS_EXTS; do
284 printf "%s;" $ext
285 done
286 [ -d /lib/modules/$(uname -r)/kernel/drivers/block/cloop.ko ] && \
287 for ext in $CLOOP_EXTS; do
288 printf "%s;" $ext
289 done
290 printf "\n"
291 exit
292 ;;
294 -o) # open: mangle output of tar cmd for xarchive
295 for ext in $TAR_EXTS $GZIP_EXTS $BZIP2_EXTS $COMPRESS_EXTS $LZMA_EXTS \
296 $IPK_EXTS; do
297 # format of tar output:
298 # lrwxrwxrwx USR/GRP 0 2005-05-12 00:32:03 file -> /path/to/link
299 # -rw-r--r-- USR/GRP 6622 2005-04-22 12:29:14 file
300 # 1 2 3 4 5 6
301 if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then
302 $DECOMPRESS "$archive" | tar -tvf - | $AWK_PROG '
303 {
304 attr=$1
305 split($2,ids,"/") #split up the 2nd field to get uid/gid
306 uid=ids[1]
307 gid=ids[2]
308 size=$3
309 date=$4
310 time=$5
312 #this method works with filenames that start with a space (evil!)
313 #split line a time and a space
314 split($0,linesplit, $5 " ")
315 #then split the second item (name&link) at the space arrow space
316 split(linesplit[2], nlsplit, " -> ")
318 name=nlsplit[1]
319 link=nlsplit[2]
321 if (! link) {link="-"} #if there was no link set it to a dash
323 printf "%s;%s;%s;%s;%s;%s;%s;%s\n",name,size,attr,uid,gid,date,time,link
324 }'
325 exit
326 fi
327 done
329 for ext in $CPIO_EXTS $CPIOGZ_EXTS; do
330 # format of cpio output:
331 # lrwxrwxrwx USR/GRP 0 2005-05-12 00:32:03 file -> /path/to/link
332 # -rw-r--r-- USR/GRP 6622 2005-04-22 12:29:14 file
333 # 1 2 3 4 5 6
334 if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then
335 $DECOMPRESS "$archive" | cpio -tv | $AWK_PROG '
336 {
337 attr=$1
338 split($2,ids,"/") #split up the 2nd field to get uid/gid
339 uid=ids[1]
340 gid=ids[2]
341 size=$3
342 date=$4
343 time=$5
345 #this method works with filenames that start with a space (evil!)
346 #split line a time and a space
347 split($0,linesplit, $5 " ")
348 #then split the second item (name&link) at the space arrow space
349 split(linesplit[2], nlsplit, " -> ")
351 name=nlsplit[1]
352 link=nlsplit[2]
354 if (! link) {link="-"} #if there was no link set it to a dash
356 if (name != "" && uid != "blocks") printf "%s;%s;%s;%s;%s;%s;%s;%s\n",name,size,attr,uid,gid,date,time,link
357 }'
358 exit
359 fi
360 done
362 for ext in $ZIP_EXTS; do
363 if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then
364 if which zipinfo; then
365 # format of zipinfo -T -s-h- output:
366 # -rw-r--r-- 2.3 unx 11512 tx defN YYYYMMDD.HHMMSS file
367 # 1 2 3 4 5 6 7 8
368 zipinfo -T -s-h-t "$archive" | $AWK_PROG -v uuid=$(id -u -n) '
369 {
370 attr=$1; size=$4
372 year=substr($7,1,4)
373 month=substr($7,5,2)
374 day=substr($7,7,2)
375 date=year "-" month "-" day
377 hours=substr($7,10,2)
378 mins=substr($7,12,2)
379 secs=substr($7,14,2)
380 time=hours ":" mins ":" secs
382 uid=uuid; gid=uuid; link="-"
383 #split line at the time and a space, second item is our name
384 split($0, linesplit, ($7 " "))
385 name=linesplit[2]
386 printf "%s;%s;%s;%s;%s;%s;%s;%s\n",name,size,attr,uid,gid,date,time,link
387 }'
388 exit
389 else
390 # format of unzip -l output:
391 # 6622 2005-04-22 12:29:14 file
392 # 1 2 3 4
393 unzip -l "$archive" | $AWK_PROG -v uuid=$(id -u -n) '
394 BEGIN { n = 0}
395 {
396 n=n+1
397 attr=""
398 uid=uuid; gid=uuid
399 size=$1
400 date=$2
401 time=$3
403 #this method works with filenames that start with a space (evil!)
404 #split line a time and a space
405 split($0,linesplit, $3 " ")
406 #then split the second item (name&link) at the space arrow space
407 split(linesplit[2], nlsplit, " -> ")
409 name=nlsplit[1]
410 link=nlsplit[2]
412 if (! link) {link="-"} #if there was no link set it to a dash
414 if (name != "" && n > 3) printf "%s;%s;%s;%s;%s;%s;%s;%s\n",name,size,attr,uid,gid,date,time,link
415 }'
416 exit
417 fi
418 fi
419 done
421 for ext in $RPM_EXTS; do
422 if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then
423 rpm2cpio "$archive" | cpio -tv | $AWK_PROG '
424 {
425 attr=$1
426 split($2,ids,"/") #split up the 2nd field to get uid/gid
427 uid=ids[1]
428 gid=ids[2]
429 size=$3
430 date=$4
431 time=$5
433 #this method works with filenames that start with a space (evil!)
434 #split line a time and a space
435 split($0,linesplit, $5 " ")
436 #then split the second item (name&link) at the space arrow space
437 split(linesplit[2], nlsplit, " -> ")
439 name=substr(nlsplit[1],2)
440 link=nlsplit[2]
442 if (! link) {link="-"} #if there was no link set it to a dash
444 if (name != "" && uid != "blocks") printf "%s;%s;%s;%s;%s;%s;%s;%s\n",name,size,attr,uid,gid,date,time,link
445 }'
446 exit
447 fi
448 done
450 for ext in $DEB_EXTS; do
451 if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then
452 dpkg-deb -c "$archive" | $AWK_PROG '
453 {
454 attr=$1
455 split($2,ids,"/") #split up the 2nd field to get uid/gid
456 uid=ids[1]
457 gid=ids[2]
458 size=$3
459 date=$4
460 time=$5
462 #this method works with filenames that start with a space (evil!)
463 #split line a time and a space
464 split($0,linesplit, $5 " ")
465 #then split the second item (name&link) at the space arrow space
466 split(linesplit[2], nlsplit, " -> ")
468 name=substr(nlsplit[1],2)
469 link=nlsplit[2]
471 if (! link) {link="-"} #if there was no link set it to a dash
473 printf "%s;%s;%s;%s;%s;%s;%s;%s\n",name,size,attr,uid,gid,date,time,link
474 }'
475 exit
476 fi
477 done
479 for ext in $TAZPKG_EXTS; do
480 # format of cpio output:
481 # lrwxrwxrwx USR/GRP 0 2005-05-12 00:32:03 file -> /path/to/link
482 # -rw-r--r-- USR/GRP 6622 2005-04-22 12:29:14 file
483 # 1 2 3 4 5 6
484 if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then
485 tmpcpio="$(mktemp -d -t cpiotmp.XXXXXX)"
486 here="$(pwd)"
487 cd $tmpcpio
488 cpio -i fs.cpio.gz > /dev/null < "$archive"
489 zcat fs.cpio.gz | cpio -tv | $AWK_PROG '
490 {
491 attr=$1
492 split($2,ids,"/") #split up the 2nd field to get uid/gid
493 uid=ids[1]
494 gid=ids[2]
495 size=$3
496 date=$4
497 time=$5
499 #this method works with filenames that start with a space (evil!)
500 #split line a time and a space
501 split($0,linesplit, $5 " ")
502 #then split the second item (name&link) at the space arrow space
503 split(linesplit[2], nlsplit, " -> ")
505 name=substr(nlsplit[1],3)
506 link=nlsplit[2]
508 if (! link) {link="-"} #if there was no link set it to a dash
510 if (name != "" && uid != "blocks") printf "%s;%s;%s;%s;%s;%s;%s;%s\n",name,size,attr,uid,gid,date,time,link
511 }'
512 cd $here
513 rm -rf $tmpcpio
514 exit
515 fi
516 done
518 for ext in $ISO_EXTS $SQUASHFS_EXTS $CROMFS_EXTS $CLOOP_EXTS $FS_EXTS; do
519 if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then
520 loop_fs $ext stat
521 exit
522 fi
523 done
524 exit $E_UNSUPPORTED
525 ;;
527 -a) # add to archive passed files
528 update_tar_cpio add_file "$@"
529 for ext in $FS_EXTS; do
530 if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then
531 loop_fs $ext add "$@"
532 exit 0
533 fi
534 done
535 which zip >/dev/null && for ext in $ZIP_EXTS; do
536 if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then
537 # we only want to add the file's basename, not
538 # the full path so...
539 while [ "$1" ]; do
540 cd "$(dirname "$1")"
541 zip -g -r "$archive" "$(basename "$1")"
542 wrapper_status=$?
543 shift 1
544 done
545 exit $wrapper_status
546 fi
547 done
548 exit $E_UNSUPPORTED
549 ;;
551 -n) # new: create new archive with passed files
552 update_tar_cpio new_archive "$@"
553 which zip >/dev/null && for ext in $ZIP_EXTS; do
554 if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then
555 # create will only be passed the first file, the
556 # rest will be "added" to the new archive
557 cd "$(dirname "$1")"
558 zip -r "$archive" "$(basename "$1")"
559 fi
560 done
561 exit $E_UNSUPPORTED
562 ;;
564 -r) # remove: from archive passed files
565 update_tar_cpio remove_file "$@"
566 for ext in $FS_EXTS; do
567 if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then
568 loop_fs $ext remove "$@"
569 exit 0
570 fi
571 done
572 which zip >/dev/null && for ext in $ZIP_EXTS; do
573 if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then
574 zip -d "$archive" "$@"
575 fi
576 done
577 exit $E_UNSUPPORTED
578 ;;
580 -e) # extract: from archive passed files
581 for ext in $TAR_EXTS $GZIP_EXTS $BZIP2_EXTS $COMPRESS_EXTS $LZMA_EXTS \
582 $IPK_EXTS; do
583 if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then
584 # xarchive will put is the right extract dir
585 # so we just have to extract.
586 $DECOMPRESS "$archive" | tar -xf - "$@"
587 exit $?
588 fi
589 done
590 for ext in $CPIO_EXTS $CPIOGZ_EXTS; do
591 if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then
592 if [ -n "$1" ]; then
593 while [ "$1" ]; do
594 $DECOMPRESS "$archive" | cpio -idv "$1"
595 shift 1
596 done
597 else
598 $DECOMPRESS "$archive" | cpio -idv
599 fi
600 exit $?
601 fi
602 done
603 for ext in $ZIP_EXTS; do
604 if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then
605 # xarchive will put is the right extract dir
606 # so we just have to extract.
607 unzip -n "$archive" "$@"
608 exit $?
609 fi
610 done
611 for ext in $RPM_EXTS; do
612 if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then
613 if [ -n "$1" ]; then
614 while [ "$1" ]; do
615 rpm2cpio "$archive" | cpio -idv "$1"
616 shift 1
617 done
618 else
619 rpm2cpio "$archive" | cpio -idv
620 fi
621 exit $?
622 fi
623 done
625 for ext in $DEB_EXTS; do
626 if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then
627 dpkg-deb -X "$archive" "$@"
628 exit $?
629 fi
630 done
631 for ext in $TAZPKG_EXTS; do
632 if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then
633 tmpcpio="$(mktemp -d -t cpiotmp.XXXXXX)"
634 here="$(pwd)"
635 cd $tmpcpio
636 cpio -i < "$archive" > /dev/null
637 zcat fs.cpio.gz | cpio -id > /dev/null
638 status=$?
639 if [ -n "$1" ]; then
640 while [ "$1" ]; do
641 dir=$(dirname "$here/$1")
642 mkdir -p "$dir" 2> /dev/null
643 mv "fs/$1" "$dir" 2> /dev/null
644 done
645 else
646 mv fs/* fs/.* $here 2> /dev/null
647 fi
648 cd $here
649 rm -rf $tmpcpio
650 exit $status
651 fi
652 done
653 for ext in $ISO_EXTS $SQUASHFS_EXTS $CROMFS_EXTS $CLOOP_EXTS $FS_EXTS; do
654 if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then
655 loop_fs $ext copy "$@"
656 exit 0
657 fi
658 done
659 exit $E_UNSUPPORTED
660 ;;
662 *) echo "error, option $opt not supported"
663 echo "use one of these:"
664 echo "-i #info"
665 echo "-o archive #open"
666 echo "-a archive files #add"
667 echo "-n archive file #new"
668 echo "-r archive files #remove"
669 echo "-e archive files #extract"
670 exit
671 esac