uace.in 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 your awk
  10. AWK=gawk
  11. # Define which archiver you are using with appropriate options
  12. ACE_LIST="unace l"
  13. ACE_GET="unace x"
  14. # ACE_PUT="unace ?" not available
  15. # The 'list' command executive
  16. # Unace: DD.MM.YY HH.MM packed size ratio file
  17. # ls:
  18. mc_ace_fs_list()
  19. {
  20. $ACE_LIST "$1" | gawk -v uid=${UID-0} '
  21. BEGIN { Month="JanFebMarAprMayJunJulAugSepOctNovDec" }
  22. /%/ {
  23. split($1,date,".")
  24. if (date[3] > 50)
  25. date[3]=date[3] + 1900
  26. else
  27. date[3]=date[3] + 2000
  28. 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
  29. }' 2>/dev/null
  30. exit 0
  31. }
  32. # Command: copyout archivename storedfilename extractto
  33. mc_ace_fs_copyout()
  34. {
  35. $ACE_GET "$1" "$2" > /dev/null 2>&1
  36. mv "$2" "$3"
  37. }
  38. # The main routine
  39. umask 077
  40. cmd="$1"
  41. shift
  42. case "$cmd" in
  43. list) mc_ace_fs_list "$@" ;;
  44. copyout) mc_ace_fs_copyout "$@" ;;
  45. *) exit 1 ;;
  46. esac
  47. exit 0