diff options
author | kris <kris@FreeBSD.org> | 2004-03-08 02:07:03 +0000 |
---|---|---|
committer | kris <kris@FreeBSD.org> | 2004-03-08 02:07:03 +0000 |
commit | 9f002a393ca6cb77e02a25b03438dcecfdb61936 (patch) | |
tree | 19dd051b787d00c5a9d3ba4b2a74d49cbd99c0ef | |
parent | 6d6d0c4e227dd01257082b9581a27e980850ff80 (diff) | |
download | FreeBSD-ports-9f002a393ca6cb77e02a25b03438dcecfdb61936.zip FreeBSD-ports-9f002a393ca6cb77e02a25b03438dcecfdb61936.tar.gz |
Run a command on all client machines of a certain architecture, or all
client machines.
-rwxr-xr-x | Tools/portbuild/scripts/allgohans | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/Tools/portbuild/scripts/allgohans b/Tools/portbuild/scripts/allgohans new file mode 100755 index 0000000..391a8a6 --- /dev/null +++ b/Tools/portbuild/scripts/allgohans @@ -0,0 +1,50 @@ +#!/bin/sh + +doarch() { + arch=$1 + shift + + if [ -f "${pb}/${arch}/portbuild.conf" ]; then + . ${pb}/${arch}/portbuild.conf + else + echo "Invalid arch" + exit 1 + fi + + machines=$(awk '{print $1}' ${pb}/${arch}/mlist) + + for i in ${machines}; do + if [ ${quiet} -eq 0 ]; then + echo "[$i]" + fi + su ports-${arch} -c "ssh root@$i $@" + done +} + +id=$(whoami) +if [ "${id}" = "root" ]; then + arch=$1 + shift + root=1 +else + arch=$(echo $id | sed s,ports-,,) + root=0 +fi + +if [ "$1" = "-q" ]; then + quiet=1 + shift +else + quiet=0 +fi + +pb=/var/portbuild +if [ "${arch}" = "all" ]; then + arches=$(find ${pb}/*/portbuild.conf) + for i in ${arches}; do + arch=$(basename $(dirname $i)) + doarch $arch "$@" + done +else + doarch $arch "$@" +fi |