Commit | Line | Data |
---|---|---|
5898af2c DHW |
1 | #!/bin/sh |
2 | CC=gcc | |
3 | ||
4 | set -x | |
5 | set -e | |
6 | ||
7 | if [ $# != 3 ] ; then | |
8 | echo Usage: $0 release host /dev/norewindtape | |
9 | exit 1 | |
10 | fi | |
11 | ||
12 | release=$1 | |
13 | host=$2 | |
14 | tape=$3 | |
15 | ||
16 | cd ${host} | |
17 | mt -f ${tape} ret | |
18 | mt -f ${tape} rew | |
19 | /bin/tar cf ${tape} Install | |
20 | ||
21 | cat > /tmp/blockit.c <<'e!o!f' | |
22 | #include <stdio.h> | |
23 | ||
24 | #define BLOCKSIZE (1024 * 62) | |
25 | ||
26 | main() { | |
27 | long c; | |
28 | long i = 0; | |
29 | long j; | |
30 | ||
31 | setvbuf (stdout, (char *)NULL, _IOFBF, BLOCKSIZE); | |
32 | ||
33 | while ((c = getchar()) != EOF) { | |
34 | if (ferror(stdin)) { | |
35 | perror("on getchar"); | |
36 | return(1); | |
37 | } /* on error */ | |
38 | ||
39 | putchar(c); | |
40 | ||
41 | if (ferror(stdout)) { | |
42 | perror("on putchar"); | |
43 | return(1); | |
44 | } /* on error */ | |
45 | ||
46 | ++i; | |
47 | } /* while there is input */ | |
48 | ||
49 | for (j = (BLOCKSIZE - (i % BLOCKSIZE)); j; --j) { | |
50 | putchar(0); | |
51 | ||
52 | if (ferror(stdout)) { | |
53 | perror("on putchar"); | |
54 | return(1); | |
55 | } /* on error */ | |
56 | } /* pad */ | |
57 | ||
58 | return(0); | |
59 | } | |
60 | e!o!f | |
61 | (cd /tmp; ${CC} -o blockit blockit.c) | |
62 | /bin/tar cf - ${release} | compress -vV | /tmp/blockit > ${tape} | |
63 | mt -f ${tape} asf 0 | |
64 | tar tvf ${tape} | |
65 | dd bs=62k if=${tape} | compress -d | /bin/tar tvvf - | |
66 | rm -f /tmp/blockit /tmp/blockit.c | |
67 | mt -f ${tape} rew |