* Fix for PR 18665, from sky branch.
[binutils-gdb.git] / Pack-A-Progressive
blob5b6f66a0d43c75ceed7c13d232f6a0ee3b54c57b
1 #!/bin/sh
2 CC=gcc
4 set -x
5 set -e
7 if [ $# != 3 ] ; then
8 echo Usage: $0 release host /dev/norewindtape
9 exit 1
12 release=$1
13 host=$2
14 tape=$3
16 cd ${host}
17 mt -f ${tape} ret
18 mt -f ${tape} rew
19 /bin/tar cf ${tape} Install
21 cat > /tmp/blockit.c <<'e!o!f'
22 #include <stdio.h>
24 #define BLOCKSIZE (1024 * 62)
26 main() {
27 long c;
28 long i = 0;
29 long j;
31 setvbuf (stdout, (char *)NULL, _IOFBF, BLOCKSIZE);
33 while ((c = getchar()) != EOF) {
34 if (ferror(stdin)) {
35 perror("on getchar");
36 return(1);
37 } /* on error */
39 putchar(c);
41 if (ferror(stdout)) {
42 perror("on putchar");
43 return(1);
44 } /* on error */
46 ++i;
47 } /* while there is input */
49 for (j = (BLOCKSIZE - (i % BLOCKSIZE)); j; --j) {
50 putchar(0);
52 if (ferror(stdout)) {
53 perror("on putchar");
54 return(1);
55 } /* on error */
56 } /* pad */
58 return(0);
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