-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpack.sh
executable file
·45 lines (39 loc) · 867 Bytes
/
pack.sh
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
set -e
set -u
SIEVE=$1
SIEVE_MAP=$SIEVE.map
SIEVE_LZ4=$SIEVE.lz4
SIEVE_LZO=$SIEVE.lzo
SIEVE_GZ=$SIEVE.gz
if test ! -r ${SIEVE_MAP}; then
echo "the sieve does not exist"
exit 1
fi
if test ! -r ${SIEVE_LZ4}; then
echo "creating LZ4 archive..."
lz4 --best ${SIEVE_MAP} ${SIEVE_LZ4}
echo "testing LZ4 archive..."
lz4 -d ${SIEVE_LZ4} temp
diff ${SIEVE_MAP} temp
echo "LZ4 archive OK"
rm temp
fi
if test ! -r ${SIEVE_LZO}; then
echo "creating LZO archive..."
lzop --best -o ${SIEVE_LZO} ${SIEVE_MAP}
echo "testing LZO archive..."
lzop -d -o temp ${SIEVE_LZO}
diff ${SIEVE_MAP} temp
echo "LZO archive OK"
rm temp
fi
if test ! -r ${SIEVE_GZ}; then
echo "creating GZ archive..."
gzip --best -c ${SIEVE_MAP} > ${SIEVE_GZ}
echo "testing GZ archive..."
gzip -d -c ${SIEVE_GZ} > temp
diff ${SIEVE_MAP} temp
echo "GZ archive OK"
rm temp
fi