This commit is contained in:
Marc Beninca 2024-11-11 17:02:08 +01:00
parent bf1e7539fa
commit 5776a03fe4
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -101,33 +101,33 @@ rescue_hetzner_install() {
} }
rescue_hetzner_upload() { rescue_hetzner_upload() {
local host="${1}" local host="${1}"
local hostname="${2}" local hostname="${2}"
if [ "${hostname}" ] ; then if [ "${hostname}" ] ; then
local user='root' local user='root'
# #
local user_host="${user}@${host}" local user_host="${user}@${host}"
# remove fingerprints # remove fingerprints
ssh-keygen -R "${host}" ssh-keygen -R "${host}"
# copy ssh id # copy ssh id
ssh-copy-id \ ssh-copy-id \
-o 'StrictHostKeyChecking=accept-new' \ -o 'StrictHostKeyChecking=accept-new' \
"${user_host}" "${user_host}"
# upload root # upload root
rsync --delete --recursive "${MAIN_BASH_ROOT}/" "${user_host}:/etc/bash/" rsync --delete --recursive "${MAIN_BASH_ROOT}/" "${user_host}:/etc/bash/"
# call setup # call setup
# TODO variable # TODO variable
ssh "${user_host}" -- "source '/etc/bash/main.sh' ; rescue_hetzner_configure '${hostname}'" ssh "${user_host}" -- "source '/etc/bash/main.sh' ; rescue_hetzner_configure '${hostname}'"
# create session # create session
ssh "${user_host}" -- byobu new-session -d ssh "${user_host}" -- byobu new-session -d
# send keys # send keys
ssh "${user_host}" -- byobu send-keys 'rescue_hetzner_install' 'C-m' ssh "${user_host}" -- byobu send-keys 'rescue_hetzner_install' 'C-m'
# attach session # attach session
mosh "${user_host}" -- byobu attach-session mosh "${user_host}" -- byobu attach-session
else else
echo 'Host?' echo 'Host?'
return 1 return 1
fi fi
} }
rescue_hetzner_wipe_8_8_0_init() { rescue_hetzner_wipe_8_8_0_init() {