Skip to content

Instantly share code, notes, and snippets.

@joestringer
Last active May 29, 2018 16:45
Show Gist options
  • Select an option

  • Save joestringer/b479bf993534254dbb9e0e5da9f1220a to your computer and use it in GitHub Desktop.

Select an option

Save joestringer/b479bf993534254dbb9e0e5da9f1220a to your computer and use it in GitHub Desktop.
Re-deploy the Cilium dev VM with my config and some minor changes
#!/bin/bash
CILIUM_PATH="$HOME/git/cilium"
VM="runtime1"
IP="192.168.34.11"
USER="vagrant"
CONFIG_GIT="https://github.com/joestringer/config"
BASHRC_PATCH="bashrc_nobold.patch"
set -e
cd "$CILIUM_PATH"
vagrant destroy "$VM"
MEMORY=5120 ./contrib/vagrant/start.sh
ssh-keygen -f "$HOME/.ssh/known_hosts" -R "$IP"
ssh-copy-id "$USER@$IP"
ssh "$USER@$IP" "git clone $CONFIG_GIT && cd config/ && ./install.sh"
ssh "$USER@$IP" "rm .bashrc && cp config/.bashrc .bashrc"
cat <<EOF >> "$BASHRC_PATCH"
--- config/.bashrc 2018-05-29 16:27:45.132399999 +0000
+++ .bashrc 2018-05-29 16:29:15.973798000 +0000
@@ -46,11 +46,11 @@
PS1='${debian_chroot:+($debian_chroot)}'
if [[ ${EUID} == 0 ]] ; then
- PS1+='\[\033[01;31m\]'
+ PS1+='\[\033[00;31m\]'
else
- PS1+='\[\033[01;32m\]\u@'
+ PS1+='\[\033[00;32m\]\u@'
fi
- PS1+='\h\[\033[01;33m\]${namespace} '
+ PS1+='\h\[\033[00;33m\]${namespace} '
PS1+='\[\033[01;90m\][${time}] '
PS1+='\[\033[01;34m\]\W '
PS1+="\$([ \$? == 0 ] && echo '\[\e[01;32m\]' || echo '\[\e[01;31m\]')"
EOF
scp "$BASHRC_PATCH" "$USER@$IP:~"
ssh "$USER@$IP" "patch -Ns .bashrc $BASHRC_PATCH"
ssh "$USER@$IP" "tail -n 2 ~/.bashrc.old >> ~/.bashrc"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment