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 fi
} }
ovh_rescue_wipe_1_2TB() { ovh_rescue_wipe_vle2_0_init() {
local device="/dev/sda" local device="/dev/sdb"
local passphrase
local unit="mib" local unit="mib"
# read passphrase
printf "PassPhrase: "
read -r -s passphrase
# #
lsblk lsblk
printf "%s" "WIPE ${device} /?\\ OR CANCEL /!\\" 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 "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}" set 3 esp on
# #
parted "${device}" unit "${unit}" mkpart bios 1 2 parted "${device}" unit "${unit}" mkpart bios 1 2
parted "${device}" set 4 bios_grub on parted "${device}" set 4 bios_grub on
# wipe bios # wipe bios
dd if="/dev/zero" of="/dev/sda4" dd if="/dev/zero" of="${device}4"
# format esp # format esp
mkfs.vfat -F 32 -n "esp" "/dev/sda3" mkfs.vfat -F 32 -n "esp" "${device}3"
# format boot # format boot
mkfs.ext4 -F -L "boot" "/dev/sda2" mkfs.ext4 -F -L "boot" "${device}2"
# read passphrase
local passphrase
printf "PassPhrase: "
read -r -s passphrase
# encrypt # encrypt
echo "${passphrase}" | echo "${passphrase}" |
cryptsetup \ cryptsetup \
@ -182,10 +182,10 @@ ovh_rescue_wipe_1_2TB() {
--hash "sha512" \ --hash "sha512" \
--use-random \ --use-random \
luksFormat \ luksFormat \
"/dev/sda1" "${device}1"
# open # open
echo "${passphrase}" | echo "${passphrase}" |
cryptsetup luksOpen "/dev/sda1" "crypt" cryptsetup luksOpen "${device}1" "crypt"
# pv # pv
pvcreate "/dev/mapper/crypt" pvcreate "/dev/mapper/crypt"
# vg # vg