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
*
|
Rev | Line | |
---|
[20277] | 1 | #!/bin/sh |
---|
| 2 | |
---|
| 3 | # This is the script for building a complete set of Athena packages. |
---|
| 4 | |
---|
| 5 | usage="build-all [-s srcdir] [-d destdir] [-k] [-n] [-l] [-t type]" |
---|
| 6 | usage="$usage [package [endpackage]]" |
---|
| 7 | |
---|
| 8 | # Default variables |
---|
| 9 | |
---|
| 10 | source="/mit/source" |
---|
| 11 | destdir="/build" |
---|
| 12 | ignore=false |
---|
| 13 | nobuild=false |
---|
| 14 | log=false |
---|
| 15 | |
---|
| 16 | while 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 |
---|
| 41 | done |
---|
| 42 | |
---|
| 43 | shift `expr $OPTIND - 1` |
---|
| 44 | start="$1" |
---|
| 45 | end="${2-$1}" |
---|
| 46 | |
---|
| 47 | case `uname -s` in |
---|
| 48 | Linux) |
---|
| 49 | os=linux |
---|
| 50 | : ${type=rpm} |
---|
| 51 | awk=awk |
---|
| 52 | ;; |
---|
| 53 | SunOS) |
---|
| 54 | os=solaris |
---|
| 55 | : ${type=sunpkg} |
---|
| 56 | awk=nawk |
---|
| 57 | ;; |
---|
| 58 | *) |
---|
| 59 | echo "Unrecognized system type, aborting." >&2 |
---|
| 60 | exit 1 |
---|
| 61 | ;; |
---|
| 62 | esac |
---|
| 63 | |
---|
| 64 | case $type in |
---|
| 65 | rpm) |
---|
| 66 | prefix="athena-" |
---|
| 67 | ;; |
---|
| 68 | sunpkg) |
---|
| 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 | ;; |
---|
| 79 | esac |
---|
| 80 | |
---|
| 81 | # Send all output from this point on to the build log file. |
---|
| 82 | if [ 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 |
---|
| 89 | fi |
---|
| 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 |
---|
| 94 | set -- `$awk -f $source/packs/build/getpackages.awk \ |
---|
| 95 | os="$os" pkgnames=1 start="$start" end="$end" \ |
---|
| 96 | $source/packs/build/packages` || exit 1 |
---|
| 97 | |
---|
| 98 | case $nobuild in |
---|
| 99 | true) |
---|
| 100 | echo $* |
---|
| 101 | exit |
---|
| 102 | ;; |
---|
| 103 | esac |
---|
| 104 | |
---|
| 105 | echo ======== |
---|
| 106 | echo Starting at `date` on $os |
---|
| 107 | |
---|
| 108 | # Build the packages |
---|
| 109 | while [ $# -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 |
---|
| 125 | done |
---|
| 126 | |
---|
| 127 | if [ $# -ne 0 ]; then |
---|
| 128 | echo "Extra grot at end of packages list:" |
---|
| 129 | echo "$*" |
---|
| 130 | fi |
---|
| 131 | |
---|
| 132 | echo "Ending at `date`" |
---|
Note: See
TracBrowser
for help on using the repository browser.