This commit is contained in:
Marc Beninca 2024-11-11 15:40:04 +01:00
parent bee3710cde
commit 28e3acd8a7
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -140,9 +140,13 @@ source \"/etc/bash/main.sh\" ; ovh_rescue_configure \"${hostname}\""
fi
}
ovh_rescue_wipe_1_2TB() {
local device="/dev/sda"
ovh_rescue_wipe_vle2_0_init() {
local device="/dev/sdb"
local passphrase
local unit="mib"
# read passphrase
printf "PassPhrase: "
read -r -s passphrase
#
lsblk
printf "%s" "WIPE ${device} /?\\ OR CANCEL /!\\"
@ -152,23 +156,19 @@ ovh_rescue_wipe_1_2TB() {
#
parted "${device}" unit "${unit}" mkpart "crypt" 65795 1907729
#
parted "${device}" unit "${unit}" mkpart "boot" 259 65795
parted "${device}" unit "${unit}" mkpart "boot" 514 65795
#
parted "${device}" unit "${unit}" mkpart "esp" 2 259
parted "${device}" unit "${unit}" mkpart "esp" 2 514
parted "${device}" set 3 esp on
#
parted "${device}" unit "${unit}" mkpart bios 1 2
parted "${device}" set 4 bios_grub on
# wipe bios
dd if="/dev/zero" of="/dev/sda4"
dd if="/dev/zero" of="${device}4"
# format esp
mkfs.vfat -F 32 -n "esp" "/dev/sda3"
mkfs.vfat -F 32 -n "esp" "${device}3"
# format boot
mkfs.ext4 -F -L "boot" "/dev/sda2"
# read passphrase
local passphrase
printf "PassPhrase: "
read -r -s passphrase
mkfs.ext4 -F -L "boot" "${device}2"
# encrypt
echo "${passphrase}" |
cryptsetup \
@ -182,10 +182,10 @@ ovh_rescue_wipe_1_2TB() {
--hash "sha512" \
--use-random \
luksFormat \
"/dev/sda1"
"${device}1"
# open
echo "${passphrase}" |
cryptsetup luksOpen "/dev/sda1" "crypt"
cryptsetup luksOpen "${device}1" "crypt"
# pv
pvcreate "/dev/mapper/crypt"
# vg