source: trunk/packs/build/build-all.sh @ 20277

Revision 20277, 2.2 KB checked in by rbasch, 21 years ago (diff)
Add a common build-all script, adapted from the rpm-specific build-all, but which works for both rpm and Sun packages.
  • Property svn:executable set to *
Line 
1#!/bin/sh
2
3# This is the script for building a complete set of Athena packages.
4
5usage="build-all [-s srcdir] [-d destdir] [-k] [-n] [-l] [-t type]"
6usage="$usage [package [endpackage]]"
7
8# Default variables
9
10source="/mit/source"
11destdir="/build"
12ignore=false
13nobuild=false
14log=false
15
16while getopts s:d:knlt: opt; do
17  case "$opt" in
18  s)
19    source="$OPTARG"
20    ;;
21  d)
22    destdir="$OPTARG"
23    ;;
24  k)
25    ignore=true
26    ;;
27  n)
28    nobuild=true
29    ;;
30  l)
31    log=true
32    ;;
33  t)
34    type="$OPTARG"
35    ;;
36  \?)
37    echo "$usage"
38    exit 1
39    ;;
40  esac
41done
42
43shift `expr $OPTIND - 1`
44start="$1"
45end="${2-$1}"
46
47case `uname -s` in
48Linux)
49  os=linux
50  : ${type=rpm}
51  awk=awk
52  ;;
53SunOS)
54  os=solaris
55  : ${type=sunpkg}
56  awk=nawk
57  ;;
58*)
59  echo "Unrecognized system type, aborting." >&2
60  exit 1
61  ;;
62esac
63
64case $type in
65rpm)
66  prefix="athena-"
67  ;;
68sunpkg)
69  if [ "$os" != solaris ]; then
70    echo "Type \"sunpkg\" is only supported on Solaris, aborting." >&2
71    exit 1
72  fi
73  prefix="MIT-"
74  ;;
75*)
76  echo "Package type must be \"rpm\" or \"sunpkg\", aborting." >&2
77  exit 1
78  ;;
79esac
80
81# Send all output from this point on to the build log file.
82if [ true = "$log" ]; then
83  mkdir -p "$destdir/logs" 2>/dev/null
84  now=`date '+%y.%m.%d.%H'`
85  logfile=$destdir/logs/washlog.$now
86  rm -f "$destdir/logs/current"
87  ln -s "washlog.$now" "$destdir/logs/current"
88  exec >> "$logfile" 2>&1
89fi
90
91# Read in the list of packages, filtering for the operating system.
92# Each line of output from getpackages.awk looks something like
93#    third/afsbin afs
94set -- `$awk -f $source/packs/build/getpackages.awk \
95  os="$os" pkgnames=1 start="$start" end="$end" \
96  $source/packs/build/packages` || exit 1
97
98case $nobuild in
99true)
100  echo $*
101  exit
102  ;;
103esac
104
105echo ========
106echo Starting at `date` on $os
107
108# Build the packages
109while [ $# -ge 2 ]; do
110  echo "***** $1"
111  $source/packs/build/$type/build-package -s $source -d $destdir $1 $prefix$2
112  if [ $? -ne 0 ]; then
113    echo "We bombed in $1"
114    if [ false = "$ignore" ]; then
115      exit 1
116    fi
117  fi
118
119  # Redo the output redirection command to flush the log file.
120  if [ true = "$log" ]; then
121    exec >> "$logfile" 2>&1
122  fi
123
124  shift 2
125done
126
127if [ $# -ne 0 ]; then
128  echo "Extra grot at end of packages list:"
129  echo "$*"
130fi
131
132echo "Ending at `date`"
Note: See TracBrowser for help on using the repository browser.