# $prefix/sbin. It needs passwordless root login to the nodes.
set -e
+
+PREFIX='@PREFIX@'
+SYSCONFDIR='@SYSCONFDIR@'
+PKGLIBDIR='@PKGLIBDIR@'
+
+NO_RESTART=
+NO_CRON=
+hosts=
+while [ "$#" -gt 0 ]; do
+ opt="$1"
+ case "$opt" in
+ --no-restart)
+ NO_RESTART=1
+ ;;
+ --no-cron)
+ NO_CRON=1
+ ;;
+ -h|--help)
+ echo "Usage: $0 [--no-restart] hosts..."
+ exit 0
+ ;;
+ -*)
+ echo "Unknown option: $opt" >&2
+ exit 1
+ ;;
+ *)
+ hosts="$hosts $opt"
+ ;;
+ esac
+ shift
+done
+
+set ${hosts}
+
TXD=`mktemp -d`
trap 'rm -rf $TXD' EXIT
# install ganeti as a real tree
make install DESTDIR="$TXD"
+# copy additional needed files
+install -D --mode=0755 doc/examples/ganeti.initd \
+ "$TXD/$SYSCONFDIR/init.d/ganeti"
+
+install -D --mode=0644 doc/examples/bash_completion \
+ "$TXD/$SYSCONFDIR/bash_completion.d/ganeti"
+
+if [ -z "$NO_CRON" ]; then
+ install -D --mode=0644 doc/examples/ganeti.cron \
+ "$TXD/$SYSCONFDIR/cron.d/ganeti"
+fi
+
+install -D --mode=0755 doc/examples/dumb-allocator \
+ "$TXD/$PKGLIBDIR/iallocators/dumb"
+
echo ---
( cd "$TXD" && find; )
echo ---
-PREFIX='@PREFIX@'
-
# and now put it under $prefix on the target node(s)
for host; do
echo Uploading code to ${host}...
rsync -v -rlDc --exclude="*.py[oc]" --exclude="*.pdf" --exclude="*.html" \
- "$TXD/$PREFIX/" \
- root@${host}:$PREFIX/ &
-done
-wait
-
-for host; do
- echo Uploading init script to ${host}...
- scp doc/examples/ganeti.initd root@${host}:/etc/init.d/ganeti &
+ "$TXD/" \
+ root@${host}:/ &
done
wait
-if [ -f ganeti-master-cron ]; then
+if test -z "${NO_RESTART}"; then
for host; do
- echo Uploading cron files to ${host}...
- scp ganeti-master-cron root@${host}:/etc/ganeti/master-cron &
+ echo Restarting ganeti-noded on ${host}...
+ ssh root@${host} /etc/init.d/ganeti restart &
done
+ wait
fi
-wait
-
-for host; do
- echo Restarting ganeti-noded on ${host}...
- ssh root@${host} /etc/init.d/ganeti restart &
-done
-wait