Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 50 lines (39 sloc) 1.536 kB
#!/usr/bin/env bash
# setup-grenade hostname [username]
#
# Assumes ssh keys set up to an account with root privs
# Keep track of the devstack directory
SRC_DIR=$(cd $(dirname "$0") && pwd)
# Source params
source $SRC_DIR/grenaderc
GRENADE_REPO=git@github.com:nebula/grenade.git
GRENADE_DIR=$DEST/grenade
HOST=${1:-localhost}
DEST_USER=${USER:-${LOGNAME:-fred}}
set -o xtrace
ssh -t $DEST_USER@$HOST " \
sudo mkdir -p $DEST; \
[[ -w $DEST ]] || sudo chown `whoami` $DEST; \
[[ -d $GRENADE_DIR ]] || git clone $GRENADE_REPO $GRENADE_DIR; \
IP=\$(ip addr show dev eth0 | awk '/inet / { split(\$2,a,\"/\"); print a[1] }'); \
echo "IP: \$IP"; \
sed \"
/^DEST=/s|^DEST=.*$|DEST=$DEST|;
/^HOST_IP=/s|^HOST_IP=.*$|HOST_IP=\$IP|;
\" $GRENADE_DIR/devstack.localrc.work.in >$GRENADE_DIR/devstack.localrc.work; \
sed \"
/^DEST=/s|^DEST=.*$|DEST=$DEST|;
/^HOST_IP=/s|^HOST_IP=.*$|HOST_IP=\$IP|;
\" $GRENADE_DIR/devstack.localrc.trunk.in >$GRENADE_DIR/devstack.localrc.trunk; \
"
# Copy devstack.localrc if it exists
if [[ -r $SRC_DIR/devstack.localrc ]]; then
scp -p $SRC_DIR/devstack.localrc $DEST_USER@$HOST:$GRENADE_DIR
fi
# And append it to the work and trunk localrc files
ssh -t $DEST_USER@$HOST " \
[[ -r $GRENADE_DIR/devstack.localrc ]] && cat $GRENADE_DIR/devstack.localrc \
>>$GRENADE_DIR/devstack.localrc.work; \
[[ -r $GRENADE_DIR/devstack.localrc ]] && cat $GRENADE_DIR/devstack.localrc \
>>$GRENADE_DIR/devstack.localrc.trunk; \
"
Jump to Line
Something went wrong with that request. Please try again.