File: genzip

package info (click to toggle)
java3d 1.5.2%2Bdfsg-11
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 17,696 kB
  • ctags: 28,299
  • sloc: java: 183,342; cpp: 23,561; ansic: 21,390; xml: 1,959; sh: 40; makefile: 33
file content (54 lines) | stat: -rw-r--r-- 878 bytes parent folder | download | duplicates (6)
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
46
47
48
49
50
51
52
53
54
#!/bin/sh

# usage: genzip <archive-name> <license-file> <file> [ <file> ... ]

tmpscr1=script1.$$
tmpscr2=script2.$$

archive=$1
shift
license=$1
shift

echo "zip'ing..."

zip -r $archive.zip $*

cat ../unzipsfx $archive.zip > $archive

echo "Checksumming..."

sum=`/usr/bin/sum $archive`
index=1
for s in $sum
do
    case $index in
    1)  sum1=$s;
	index=2;
	;;
    2)  sum2=$s;
	index=3;
	;;
    esac
done
echo sum = $sum1 $sum2

cat ../script1.txt $license ../script2.txt > $tmpscr1

linecount=`/usr/bin/wc -l < $tmpscr1`
linecount=$(($linecount + 1))
echo linecount = $linecount

echo "Generating .bin script..."

sed -e s/@LINECOUNT@/$linecount/ -e s/@SUM1@/$sum1/ -e s/@SUM2@/$sum2/ < $tmpscr1 > $tmpscr2
cat $tmpscr2 $archive > ../$archive.bin
chmod +x ../$archive.bin

echo "Cleaning up..."
rm -f $tmpscr1
rm -f $tmpscr2
rm -f $archive.zip
rm -f $archive

echo "Done"