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 hostname="${1}"
local package local package
local packages=( local packages=(
@ -53,7 +53,7 @@ fr_FR.UTF-8 UTF-8
apt-get update apt-get update
} }
function hetzner-rescue-install { function rescue_hetzner_install {
local package local package
local release='bookworm' local release='bookworm'
local packages=( local packages=(
@ -100,7 +100,7 @@ function hetzner-rescue-install {
done done
} }
function hetzner-rescue-upload { function rescue_hetzner_upload {
local host="${1}" local host="${1}"
local hostname="${2}" local hostname="${2}"
if [ "${hostname}" ] ; then if [ "${hostname}" ] ; then
@ -117,11 +117,11 @@ if [ "${hostname}" ] ; then
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' ; hetzner-rescue-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 'hetzner-rescue-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
@ -130,7 +130,7 @@ else
fi fi
} }
function hetzner-rescue-wipe-8-8-0-init { function rescue_hetzner_wipe_8_8_0_init {
local device local device
local devices=( local devices=(
'/dev/sda' '/dev/sda'
@ -270,13 +270,13 @@ function hetzner-rescue-wipe-8-8-0-init {
| cryptsetup luksOpen '/dev/md/crypt' 'crypt' | cryptsetup luksOpen '/dev/md/crypt' 'crypt'
} }
function hetzner-rescue-wipe-8-8-1-zero { function rescue_hetzner_wipe_8_8_1_zero {
# wipe crypt # wipe crypt
dd status='progress' \ dd status='progress' \
if='/dev/zero' of='/dev/mapper/crypt' bs='8G' 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 local passphrase
# close # close
cryptsetup luksClose 'crypt' cryptsetup luksClose 'crypt'
@ -318,7 +318,7 @@ function hetzner-rescue-wipe-8-8-2-make {
'/media/crypt/swap' '/media/crypt/swap'
} }
function hetzner-rescue-wipe-8-8-3-close { function rescue_hetzner_wipe_8_8_3_close {
umount '/media/boot' umount '/media/boot'
# #
umount '/media/crypt' \ umount '/media/crypt' \