home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Amiga 12 / MA_Cover_12.iso / c / lha2lzx_3 < prev    next >
Encoding:
AmigaDOS Script File  |  1996-05-29  |  2.2 KB  |  95 lines

  1. .key DESTDIR/A,LHAARC/A,FORCE/S,OPT1,OPT2,OPT3
  2. .bra {
  3. .ket }
  4.  
  5. ; $VER: lha2lzx 1.1 (01.04.95) by Ralph Seichter
  6. ;
  7. ; This script will unpack a LhA archive and re-pack its contents using
  8. ; the LZX archiver. It will display the file sizes and the user can
  9. ; decide which archive is to be kept. There is also a forced mode, in
  10. ; which there is no user interaction (the LhA archive will always be
  11. ; replaced by the LZX archive).
  12. ;
  13. ; INSTALLATION:
  14. ;
  15. ; You should copy lha2lzx to your S: directory or any other directory
  16. ; in your command path. Make surce that the script bit is set, or you
  17. ; will have to invoke it with "Execute lha2lzx".
  18. ;
  19. ; USAGE EXAMPLE:
  20. ;
  21. ; Best compression is obtained by invoking the script as follows:
  22. ;
  23. ;      lha2lzx foo.lha bar.lzx -3
  24. ;
  25. ; Please note that lha2lzx will use the exakt LZX name you specify, as
  26. ; the -X0 option (don't append suffix) is used. If you want the usual
  27. ; suffix .lzx, make sure to type it!
  28. ;
  29. ; If you want to re-pack all archives in a directory, use lha2lzx-dir,
  30. ; this script is also included in the distribution archive.
  31.  
  32. set tempname lha2lzx-$process
  33. set tempdir T:
  34. set ext .lzx
  35.  
  36. cd {DESTDIR}
  37. failat 30
  38. makedir $tempdir$tempname
  39. if warn
  40.     echo "Can't create directory $tempdir"
  41.     quit 5
  42. endif
  43. lha -I -F -M -a -P-1 x {LHAARC} $tempdir$tempname/
  44. if warn
  45.     echo "Can't unpack {LHAARC}"
  46.     delete $tempdir$tempname all force quiet
  47.     quit 5
  48. endif
  49. failat 20
  50.  
  51. assign $tempname: ""
  52. cd $tempdir$tempname
  53. ; This is a multitasking OS, so I run lzx with priority -1
  54. lzx -r -a -e -F -Y -P-1 -X0 {OPT1} {OPT2} {OPT3} a $tempname:{LHAARC}$ext #?
  55. cd $tempname:
  56. assign $tempname:
  57. delete $tempdir$tempname all force quiet
  58.  
  59. echo "Testing archive integrity... " noline
  60. failat 11
  61. unlzx -q -X0 t {LHAARC}$ext
  62. if warn
  63.     echo "{LHAARC}$ext is corrupt!"
  64.     delete {LHAARC}$ext quiet
  65.     quit 5
  66. else
  67.     echo "ok"
  68. endif
  69. failat 10
  70.  
  71. echo "*N=== Archive size comparison =========="
  72. list lformat "%-24N %7L bytes" {LHAARC} {LHAARC}$ext
  73.  
  74. if "{FORCE}" eq ""
  75.     ; Script is interactive
  76.     ask "*NKeep {LHAARC} (y/N)?"
  77.     if warn
  78.         ask "Delete {LHAARC}$ext (y/N)?"
  79.         if warn
  80.             delete {LHAARC}$ext force
  81.         endif
  82.     else
  83.         delete {LHAARC} force
  84.     endif
  85. else
  86.     ; Script is NOT interactive
  87.     delete {LHAARC} force
  88. endif
  89.  
  90. unset ext
  91. unset tempdir
  92. unset tempname
  93.  
  94. ; EOF
  95.