uace.in 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #! /bin/sh
  2. #
  3. # ACE Virtual filesystem executive v0.1
  4. # Works with unace v2.5
  5. # Copyright (C) 2008 Jacques Pelletier
  6. # May be distributed under the terms of the GNU Public License
  7. # <jpelletier@ieee.org>
  8. #
  9. # Define which archiver you are using with appropriate options
  10. ACE_LIST="unace l"
  11. ACE_GET="unace x"
  12. # ACE_PUT="unace ?" not available
  13. # The 'list' command executive
  14. # Unace: DD.MM.YY HH.MM packed size ratio file
  15. # ls:
  16. mc_ace_fs_list()
  17. {
  18. if [ "x$UID" = "x" ]; then
  19. UID=`id -ru 2>/dev/null`
  20. if [ "x$UID" = "x" ]; then
  21. UID=0
  22. fi
  23. fi
  24. $ACE_LIST "$1" | @AWK@ -v uid=$UID '
  25. BEGIN { Month="JanFebMarAprMayJunJulAugSepOctNovDec" }
  26. /%/ {
  27. split($1,date,".")
  28. if (date[3] > 50)
  29. date[3]=date[3] + 1900
  30. else
  31. date[3]=date[3] + 2000
  32. printf "-rw-r--r-- 1 %-8d %-8d %8d %s %2d %4d %s %s\n", uid, 0, $3, substr(Month,3*(date[2]-1)+1,3),date[1],date[3], $2, $6
  33. }' 2>/dev/null
  34. exit 0
  35. }
  36. # Command: copyout archivename storedfilename extractto
  37. mc_ace_fs_copyout()
  38. {
  39. $ACE_GET "$1" "$2" > /dev/null 2>&1
  40. mv "$2" "$3"
  41. }
  42. # The main routine
  43. umask 077
  44. cmd="$1"
  45. shift
  46. case "$cmd" in
  47. list) mc_ace_fs_list "$@" ;;
  48. copyout) mc_ace_fs_copyout "$@" ;;
  49. *) exit 1 ;;
  50. esac
  51. exit 0