]> WPIA git - infra.git/blobdiff - manager/setup
fix: force non-interactive output of pty-executed apts
[infra.git] / manager / setup
index 9481c85a57efad4f694f0a219d085abe4f0fa068..0c5643b1ba0e13f6e3a63a0a7509a050147131e1 100755 (executable)
@@ -1,30 +1,7 @@
 #!/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)
@@ -59,7 +36,7 @@ function reset_vm {
 }
 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"
@@ -158,12 +135,14 @@ if [[ "$2" == "update" ]]; then
 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'
@@ -174,7 +153,7 @@ if [[ $signerLocation == "self" ]] && [[ $(ssh_target 'ps -ef | grep tcpseria[l]
     exit 1
 fi
 
-execute-bootstrap-user
+populate_system
 
 title 'bash'
 eval $(ssh-agent -k)