File: large-files-cab.sh

package info (click to toggle)
cabextract 1.11-2
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,884 kB
  • sloc: ansic: 5,826; sh: 5,331; perl: 462; makefile: 88
file content (31 lines) | stat: -rwxr-xr-x 903 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh
# creates 2GB of highly-repeated ASCII text, then compresses it with
# MSZIP and LZX in the same cabinet

# largest possible file is 65535 blocks of 32768 byte which is nearly 2GB
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

cat >directives.txt <<EOF
.Set DiskDirectory1=.
.Set CabinetName1=large-files.cab
.Set MaxCabinetSize=102400000
.Set MaxDiskSize=102400000
.Set Cabinet=ON
.Set Compress=ON
.Set CompressionType=MSZIP
2gb.txt mszip-2gb.txt
.New Folder
.Set CompressionType=LZX
.Set CompressionMemory=15
2gb.txt lzx15-2gb.txt
.New Folder
.Set CompressionMemory=21
2gb.txt lzx21-2gb.txt
EOF

wine makecab.exe /F directives.txt
rm 2gb.txt directives.txt

# compress again from ~18MB -> 20kB
wine makecab.exe /D CompressionType=LZX /D CompressionMemory=21 large-files.cab
mv large-files.ca_ large-files-cab.cab