#!/bin/bash
-signerLocation=self
-devPkgs=""
-targetHost="$1"
-
-function ssh_target {
- ssh -i vm-key "$to" "$@"
-}
-
-function install_nre {
- ./installNRE "$targetHost"
-}
-function read_activation_link {
- read -rp "Link: " link
- printf '%s\n' "$link"
-}
-function configure {
- ssh_target -t 'bash conf-puppet --force'
- ssh_target 'sed -i "s%\$signerLocation = '".*'"'%\$signerLocation = '"'$signerLocation'"'%" environments/production/manifests/ip.pp'
-}
-function do_reset_vm {
- read -rp "Please reset your VM and confirm by pressing enter." _
-}
-function execute-bootstrap-user {
- ssh_target -t 'bash bootstrap-user'
-}
-
+targetHost=$1
+targetHost=${targetHost%/}
+source config
source "$targetHost/config"
eval $(ssh-agent)
}
function update {
title 'S1: apt-get; clone'
- ssh_target -t "sudo apt-get update && DEBIAN_FRONTEND=noninteractive sudo -E apt-get upgrade -o Dpkg::Options::=\"--force-confold\" -y && sudo apt-get install -y git curl $devPkgs"
+ ssh_target -t "( sudo apt-get update | cat ) && ( DEBIAN_FRONTEND=noninteractive sudo -E apt-get upgrade -o Dpkg::Options::=\"--force-confold\" -y | cat ) && ( sudo apt-get install -y git curl $devPkgs | cat )"
echo "Git init"
ssh_target -t '[[ -d .git ]] || git init;'
echo "Git push"
fi
configure
ensure_nre
+
+install_backup
+
title 'S3: puppet-1'
ssh_target -t 'sudo ./bootstrap'
title 'S3: puppet-2'
ssh_target -t 'sudo ./bootstrap'
-[[ -f ../../migrate ]] && ( cd ../.. && bash migrate "$targetHost")
if [[ -f tricks ]]; then
cat tricks | ssh_target 'cat > tricks && chmod +x tricks'
ssh_target -t 'bash tricks'
exit 1
fi
-execute-bootstrap-user
+populate_system
title 'bash'
eval $(ssh-agent -k)