Sync usage with man page.
[netbsd-mini2440.git] / external / bsd / ntp / dist / flock-build
blobdbdf990a4d695a5f21e5107c1733eae64189794e
1 #! /bin/sh
3 IAM=`hostname || uname -n`
4 MYNAME=`IFS=. ; set $IAM ; echo $1`
6 case "$1" in
7 '--one'|'-1')
8 shift
9 FB_FIRSTONLY=1
10 LIST=$MYNAME
13 FB_FIRSTONLY=0
14 esac
16 BUILD_ARGS="$@"
17 PARSE="--enable-parse-clocks"
18 #PARSE=
19 STD="--enable-simulator"
21 case "$SIMUL" in
22 '') PARALLEL_BUILDS=1
24 *) PARALLEL_BUILDS=$SIMUL
25 esac
27 case "$PARALLEL_BUILDS" in
28 1) ;;
29 *) echo Launching $PARALLEL_BUILDS parallel builds on each machine
30 esac
32 # Backroom:
33 # barnstable freebsd-6.1
34 # beauregard freebsd-6.0
35 # X churchy alpha-dec-osf5.1
36 # deacon sparc-sun-solaris2.10
37 # grundoon freebsd-6.2
38 # howland freebsd-6.1
39 # o macabre freebsd-6.1-STABLE
40 # o mort freebsd-6.1
41 # whimsy sparc-sun-solaris2.10
43 # Campus:
44 # * baldwin sparc-sun-solaris2.10
45 # * bridgeport sparc-sun-solaris2.10
46 # * malarky sparc-sun-solaris2.10
47 # * pogo sparc-sun-solaris2.10
48 # * rackety freebsd-6.1
50 # HMS: we need $PWD because solaris produces /deacon/backroom when
51 # we are in /backroom and in general there is no /deacon/backroom.
52 c_d=${PWD:-`pwd`}
54 SIG=`perl -e 'print rand'`
56 case "$LIST" in
57 '') LIST="malarky rackety" ;;
58 esac
60 for i in $LIST
62 SKIPTHIS=0
63 [ -f .buildkey-$i ] && SKIPTHIS=1
64 case "$SKIPTHIS" in
66 echo flock-build running on $i? check LIST, skipping
68 0)
69 echo $i
70 echo $SIG > .buildkey-$i
71 case "1" in
73 ssh $i "cd $c_d ; ./build $SIG $PARSE $STD $BUILD_ARGS" &
74 ssh $i "cd $c_d ; ./build $SIG $PARSE $STD --without-crypto $BUILD_ARGS" &
75 ssh $i "cd $c_d ; ./build $SIG $STD --disable-all-clocks $BUILD_ARGS" &
78 cat > .flockbuild-$i-$SIG <<-ENDQUOT
79 #!/bin/sh
81 # script uses job control and expects to be invoked
82 # in a ssh session started with the -tt option,
83 # which forces a pseudo-tty to be used.
85 cd $c_d
86 COUNT=0
88 ./build $SIG $PARSE $STD $BUILD_ARGS &
90 COUNT=\`expr \$COUNT + 1\`
91 echo \`date -u '+%H:%M:%S'\` $i started build \$COUNT of 4
92 [ 0 -lt \`expr \$COUNT % $PARALLEL_BUILDS\` ] || wait
94 case $FB_FIRSTONLY in
95 '0')
96 ./build $SIG $PARSE $STD --disable-debugging $BUILD_ARGS &
98 COUNT=\`expr \$COUNT + 1\`
99 echo \`date -u '+%H:%M:%S'\` $i started build \$COUNT of 4
100 [ 0 -lt \`expr \$COUNT % $PARALLEL_BUILDS\` ] || wait
102 ./build $SIG $PARSE $STD --without-crypto $BUILD_ARGS &
104 COUNT=\`expr \$COUNT + 1\`
105 echo \`date -u '+%H:%M:%S'\` $i started build \$COUNT of 4
106 [ 0 -lt \`expr \$COUNT % $PARALLEL_BUILDS\` ] || wait
108 ./build $SIG $STD --disable-all-clocks $BUILD_ARGS &
110 COUNT=\`expr \$COUNT + 1\`
111 echo \`date -u '+%H:%M:%S'\` $i started build \$COUNT of 4
112 wait
113 esac
114 echo \`date -u '+%H:%M:%S'\` $i flock-build $c_d done.
115 rm .buildkey-$i
116 ENDQUOT
117 chmod +x .flockbuild-$i-$SIG
118 ssh -tt $i "$c_d/.flockbuild-$i-$SIG ; \
119 rm $c_d/.flockbuild-$i-$SIG" 2>/dev/null &
120 esac
121 esac
122 done
123 echo `date -u '+%H:%M:%S'` flock-build launched