aboutsummaryrefslogtreecommitdiff
path: root/Pack-A-Progressive
blob: 5b6f66a0d43c75ceed7c13d232f6a0ee3b54c57b (plain)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/sh
CC=gcc

set -x
set -e

if [ $# != 3 ] ; then
	echo Usage: $0 release host /dev/norewindtape
	exit 1
fi

release=$1
host=$2
tape=$3

cd ${host}
mt -f ${tape} ret
mt -f ${tape} rew
/bin/tar cf ${tape} Install

cat > /tmp/blockit.c <<'e!o!f'
#include <stdio.h>

#define BLOCKSIZE (1024 * 62)

main() {
  long c;
  long i = 0;
  long j;

  setvbuf (stdout, (char *)NULL, _IOFBF, BLOCKSIZE);

  while ((c = getchar()) != EOF) {
    if (ferror(stdin)) {
      perror("on getchar");
      return(1);
    } /* on error */

    putchar(c);

    if (ferror(stdout)) {
      perror("on putchar");
      return(1);
    } /* on error */

    ++i;
  } /* while there is input */

  for (j = (BLOCKSIZE - (i % BLOCKSIZE)); j; --j) {
    putchar(0);

    if (ferror(stdout)) {
      perror("on putchar");
      return(1);
    } /* on error */
  } /* pad */

  return(0);
}
e!o!f
(cd /tmp; ${CC} -o blockit blockit.c) 
/bin/tar cf - ${release} | compress -vV | /tmp/blockit > ${tape}
mt -f ${tape} asf 0
tar tvf ${tape}
dd bs=62k if=${tape} | compress -d | /bin/tar tvvf -
rm -f /tmp/blockit /tmp/blockit.c
mt -f ${tape} rew