Debian Codegraph @

test/cabs/large-files-cab.sh

raw
1 #!/bin/sh
2 # creates 2GB of highly-repeated ASCII text, then compresses it with
3 # MSZIP and LZX in the same cabinet
4
5 # largest possible file is 65535 blocks of 32768 byte which is nearly 2GB
6 perl -e '$b="Fabulous secret powers were revealed to me the day I held aloft\n" x 512; for (1..65535) {print $b;}' >2gb.txt
7
8 cat >directives.txt <<EOF
9 .Set DiskDirectory1=.
10 .Set CabinetName1=large-files.cab
11 .Set MaxCabinetSize=102400000
12 .Set MaxDiskSize=102400000
13 .Set Cabinet=ON
14 .Set Compress=ON
15 .Set CompressionType=MSZIP
16 2gb.txt mszip-2gb.txt
17 .New Folder
18 .Set CompressionType=LZX
19 .Set CompressionMemory=15
20 2gb.txt lzx15-2gb.txt
21 .New Folder
22 .Set CompressionMemory=21
23 2gb.txt lzx21-2gb.txt
24 EOF
25
26 wine makecab.exe /F directives.txt
27 rm 2gb.txt directives.txt
28
29 # compress again from ~18MB -> 20kB
30 wine makecab.exe /D CompressionType=LZX /D CompressionMemory=21 large-files.cab
31 mv large-files.ca_ large-files-cab.cab