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

View file

@ -1,6 +1,6 @@
#! /usr/bin/env sh #! /usr/bin/env sh
ovh_rescue_configure() { rescue_ovh_configure() {
local hostname="${1}" local hostname="${1}"
local release="bookworm" local release="bookworm"
local package local package
@ -66,7 +66,7 @@ fr_FR.UTF-8 UTF-8
apt-get update apt-get update
} }
ovh_rescue_install() { rescue_ovh_install() {
local package local package
local release="bookworm" local release="bookworm"
# update catalog # update catalog
@ -108,7 +108,7 @@ ovh_rescue_install() {
done done
} }
ovh_rescue_upload() { rescue_ovh_upload() {
local host="${1}" local host="${1}"
local hostname="${2}" local hostname="${2}"
if [ "${hostname}" ]; then if [ "${hostname}" ]; then
@ -127,11 +127,11 @@ ovh_rescue_upload() {
# call setup # call setup
# TODO variable # TODO variable
ssh "${user_host}" -- "\ ssh "${user_host}" -- "\
source \"/etc/bash/main.sh\" ; ovh_rescue_configure \"${hostname}\"" source \"/etc/bash/main.sh\" ; rescue_ovh_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 "ovh_rescue_install" "C-m" ssh "${user_host}" -- byobu send-keys "rescue_ovh_install" "C-m"
# attach session # attach session
mosh "${user_host}" -- byobu attach-session mosh "${user_host}" -- byobu attach-session
else else
@ -140,7 +140,7 @@ source \"/etc/bash/main.sh\" ; ovh_rescue_configure \"${hostname}\""
fi fi
} }
ovh_rescue_wipe_vle2_0_init() { rescue_ovh_wipe_vle2_0_init() {
local device="/dev/sdb" local device="/dev/sdb"
local passphrase local passphrase
local unit="mib" local unit="mib"
@ -210,12 +210,12 @@ ovh_rescue_wipe_vle2_0_init() {
cryptsetup luksOpen "${device}1" "crypt" cryptsetup luksOpen "${device}1" "crypt"
} }
ovh_rescue_wipe_vle2_1_zero() { rescue_ovh_wipe_vle2_1_zero() {
# crypt / zero # crypt / zero
dd status="progress" if="/dev/zero" of="/dev/mapper/crypt" bs="1G" dd status="progress" if="/dev/zero" of="/dev/mapper/crypt" bs="1G"
} }
ovh_rescue_wipe_vle2_2_make() { rescue_ovh_wipe_vle2_2_make() {
local passphrase local passphrase
# crypt / close # crypt / close
cryptsetup luksClose "crypt" cryptsetup luksClose "crypt"
@ -256,7 +256,7 @@ ovh_rescue_wipe_vle2_2_make() {
"/media/crypt/swap" "/media/crypt/swap"
} }
ovh_rescue_wipe_vle2_3_close() { rescue_ovh_wipe_vle2_3_close() {
umount "/media/boot" umount "/media/boot"
umount "/media/crypt" && umount "/media/crypt" &&
cryptsetup luksClose "crypt" cryptsetup luksClose "crypt"