From ddde3e3c6b8462f0a74460d18116da589c489f02 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 17:56:25 +0100 Subject: [PATCH] upload --- bash/rescue-hetzner.sh | 32 -------------------------------- bash/rescue-ovh.sh | 32 -------------------------------- bash/rescue.sh | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 64 deletions(-) diff --git a/bash/rescue-hetzner.sh b/bash/rescue-hetzner.sh index 0af9723..0ef1d8a 100644 --- a/bash/rescue-hetzner.sh +++ b/bash/rescue-hetzner.sh @@ -1,35 +1,3 @@ -rescue_hetzner_upload() { - local host="${1}" - local hostname="${2}" - if [ "${hostname}" ]; then - local user="root" - # - local user_host="${user}@${host}" - # remove fingerprints - ssh-keygen -R "${host}" - # copy ssh id - ssh-copy-id \ - -o "StrictHostKeyChecking=accept-new" \ - "${user_host}" - # upload root - rsync --delete --recursive \ - "${MAIN_BASH_ROOT}/" "${user_host}:/etc/bash/" - # call setup - # TODO variable - ssh "${user_host}" -- "\ -source \"/etc/bash/main.sh\" ; rescue_configure \"${hostname}\"" - # create session - ssh "${user_host}" -- byobu new-session -d - # send keys - ssh "${user_host}" -- byobu send-keys "rescue_install" "C-m" - # attach session - mosh "${user_host}" -- byobu attach-session - else - echo "Host?" - return 1 - fi -} - rescue_hetzner_wipe_8_8_0_init() { local device local devices=( diff --git a/bash/rescue-ovh.sh b/bash/rescue-ovh.sh index a62ae4e..8312dab 100644 --- a/bash/rescue-ovh.sh +++ b/bash/rescue-ovh.sh @@ -1,35 +1,3 @@ -rescue_ovh_upload() { - local host="${1}" - local hostname="${2}" - if [ "${hostname}" ]; then - local user="root" - # - local user_host="${user}@${host}" - # remove fingerprints - ssh-keygen -R "${host}" - # copy ssh id - ssh-copy-id \ - -o "StrictHostKeyChecking=accept-new" \ - "${user_host}" - # upload root - rsync --delete --recursive \ - "${MAIN_BASH_ROOT}/" "${user_host}:/etc/bash/" - # call setup - # TODO variable - ssh "${user_host}" -- "\ -source \"/etc/bash/main.sh\" ; rescue_configure \"${hostname}\"" - # create session - ssh "${user_host}" -- byobu new-session -d - # send keys - ssh "${user_host}" -- byobu send-keys "rescue_install" "C-m" - # attach session - mosh "${user_host}" -- byobu attach-session - else - echo "Host?" - return 1 - fi -} - rescue_ovh_wipe_vle2_0_init() { local device="/dev/sdb" local passphrase diff --git a/bash/rescue.sh b/bash/rescue.sh index 2a716bd..c40abcc 100644 --- a/bash/rescue.sh +++ b/bash/rescue.sh @@ -105,3 +105,35 @@ rescue_install() { apt_clean_cache done } + +rescue_upload() { + local host="${1}" + local hostname="${2}" + if [ "${hostname}" ]; then + local user="root" + # + local user_host="${user}@${host}" + # remove fingerprints + ssh-keygen -R "${host}" + # copy ssh id + ssh-copy-id \ + -o "StrictHostKeyChecking=accept-new" \ + "${user_host}" + # upload root + rsync --delete --recursive \ + "${MAIN_BASH_ROOT}/" "${user_host}:/etc/bash/" + # call setup + # TODO variable + ssh "${user_host}" -- "\ +source \"/etc/bash/main.sh\" ; rescue_configure \"${hostname}\"" + # create session + ssh "${user_host}" -- byobu new-session -d + # send keys + ssh "${user_host}" -- byobu send-keys "rescue_install" "C-m" + # attach session + mosh "${user_host}" -- byobu attach-session + else + echo "Host?" + return 1 + fi +}