This commit is contained in:
Marc Beninca 2024-11-11 17:56:25 +01:00
parent 98c121d837
commit ddde3e3c6b
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F
3 changed files with 32 additions and 64 deletions

View file

@ -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() { rescue_hetzner_wipe_8_8_0_init() {
local device local device
local devices=( local devices=(

View file

@ -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() { rescue_ovh_wipe_vle2_0_init() {
local device="/dev/sdb" local device="/dev/sdb"
local passphrase local passphrase

View file

@ -105,3 +105,35 @@ rescue_install() {
apt_clean_cache apt_clean_cache
done 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
}