This commit is contained in:
Marc Beninca 2024-11-11 16:56:00 +01:00
parent 33e823024c
commit 5f13535022
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -1,4 +1,4 @@
function hetzner-rescue-configure {
function rescue_hetzner_configure {
local hostname="${1}"
local package
local packages=(
@ -53,7 +53,7 @@ fr_FR.UTF-8 UTF-8
apt-get update
}
function hetzner-rescue-install {
function rescue_hetzner_install {
local package
local release='bookworm'
local packages=(
@ -100,7 +100,7 @@ function hetzner-rescue-install {
done
}
function hetzner-rescue-upload {
function rescue_hetzner_upload {
local host="${1}"
local hostname="${2}"
if [ "${hostname}" ] ; then
@ -117,11 +117,11 @@ if [ "${hostname}" ] ; then
rsync --delete --recursive "${MAIN_BASH_ROOT}/" "${user_host}:/etc/bash/"
# call setup
# TODO variable
ssh "${user_host}" -- "source '/etc/bash/main.sh' ; hetzner-rescue-configure '${hostname}'"
ssh "${user_host}" -- "source '/etc/bash/main.sh' ; rescue_hetzner_configure '${hostname}'"
# create session
ssh "${user_host}" -- byobu new-session -d
# send keys
ssh "${user_host}" -- byobu send-keys 'hetzner-rescue-install' 'C-m'
ssh "${user_host}" -- byobu send-keys 'rescue_hetzner_install' 'C-m'
# attach session
mosh "${user_host}" -- byobu attach-session
else
@ -130,7 +130,7 @@ else
fi
}
function hetzner-rescue-wipe-8-8-0-init {
function rescue_hetzner_wipe_8_8_0_init {
local device
local devices=(
'/dev/sda'
@ -270,13 +270,13 @@ function hetzner-rescue-wipe-8-8-0-init {
| cryptsetup luksOpen '/dev/md/crypt' 'crypt'
}
function hetzner-rescue-wipe-8-8-1-zero {
function rescue_hetzner_wipe_8_8_1_zero {
# wipe crypt
dd status='progress' \
if='/dev/zero' of='/dev/mapper/crypt' bs='8G'
}
function hetzner-rescue-wipe-8-8-2-make {
function rescue_hetzner_wipe_8_8_2_make {
local passphrase
# close
cryptsetup luksClose 'crypt'
@ -318,7 +318,7 @@ function hetzner-rescue-wipe-8-8-2-make {
'/media/crypt/swap'
}
function hetzner-rescue-wipe-8-8-3-close {
function rescue_hetzner_wipe_8_8_3_close {
umount '/media/boot'
#
umount '/media/crypt' \