Debian Codegraph @

test/cabs/split-cabs.sh

raw
1 #!/bin/sh
2 # creates a good mix of standalone folders, folders that
3 # split backwards, split forwards, and split both ways,
4 # with differing numbers of files in each
5 dd if=/dev/urandom of=small1.bin bs=2000 count=1 2>/dev/null
6 dd if=/dev/urandom of=small2.bin bs=8000 count=1 2>/dev/null
7 dd if=/dev/urandom of=medium1.bin bs=40000 count=1 2>/dev/null
8 dd if=/dev/urandom of=medium2.bin bs=50000 count=1 2>/dev/null
9 dd if=/dev/urandom of=small3.bin bs=128 count=1 2>/dev/null
10 dd if=/dev/urandom of=medium3.bin bs=40000 count=1 2>/dev/null
11
12 # force differing case: wine will write the cab files as "split-1.cab"
13 # but the cab file will have "Split-1.CAB" embedded in it
14 touch split-1.cab split-2.cab split-3.cab split-4.cab split-5.cab
15
16 cat >directives.txt <<EOF
17 .Set DiskLabelTemplate="Split cabinet file */5"
18 .Set DiskDirectoryTemplate=.
19 .Set CabinetNameTemplate=Split-*.CAB
20 .Set ClusterSize=1
21 .Set MaxDiskSize=30000
22 .Set Cabinet=ON
23 .Set Compress=ON
24 ; use the "reserved space" feature to check cabextract handles it
25 .Set ReservePerCabinetSize=100
26 .Set ReservePerFolderSize=50
27 .Set ReservePerDataBlockSize=10
28 small1.bin
29 .New Folder
30 small2.bin
31 medium1.bin
32 medium2.bin
33 small3.bin
34 medium3.bin
35 EOF
36
37 wine makecab.exe /F directives.txt
38
39 # makecab.exe messes up and writes "previous file is split-2.cab" instead of
40 # "previous file is split-3.cab" into header of split-4.cab
41 sed -e 's/Split-2.CAB/Split-3.CAB/' \
42 -e 's!Split cabinet file 2/5!Split cabinet file 3/5!' \
43 -i split-4.cab
44
45 # check these against each other
46 cabextract -t split-1.cab
47 md5sum small1.bin small2.bin medium1.bin medium2.bin small3.bin medium3.bin
48
49 rm *.bin directives.txt setup.inf setup.rpt