rescue/ovh

This commit is contained in:
Marc Beninca 2024-11-29 19:53:27 +01:00
parent a0d487f473
commit 4d64db0b70
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -2,9 +2,9 @@ rwx_rescue_wipe_0_init_ovh_vle2() {
local device="/dev/sdb"
local passphrase
# read passphrase
passphrase="$(sh_read_passphrase)"
passphrase="$(rwx_read_passphrase)"
# warn
sh_warn_wipe "${device}"
rwx_warn_wipe "${device}"
#
parted --script "${device}" \
mktable gpt \
@ -16,27 +16,27 @@ rwx_rescue_wipe_0_init_ovh_vle2() {
mkpart bios 1 2 \
set 4 bios_grub on
# bios / wipe
sh_fs_wipe "${device}4"
rwx_fs_wipe "${device}4"
# esp / wipe
sh_fs_wipe "${device}3" "1M"
rwx_fs_wipe "${device}3" "1M"
# esp / format
sh_fs_make_fat "${device}3" "esp" "00000001"
rwx_fs_make_fat "${device}3" "esp" "00000001"
# esp / mount
mkdir --parents "/media/esp"
mount "${device}3" "/media/esp"
# boot / wipe
sh_fs_wipe "${device}2" "1G" 1
rwx_fs_wipe "${device}2" "1G" 1
# boot / format
sh_fs_make_btrfs "${device}2" "boot" \
rwx_fs_make_btrfs "${device}2" "boot" \
"00000000-0000-0000-0000-00000000000b"
# boot / mount
mkdir --parents "/media/boot"
mount --options "autodefrag,compress-force=zstd" \
"${device}2" "/media/boot"
# crypt / wipe
sh_fs_wipe "${device}1" "1G" 1
rwx_fs_wipe "${device}1" "1G" 1
# crypt / encrypt
sh_fs_luks_format "${passphrase}" "${device}1"
rwx_fs_luks_format "${passphrase}" "${device}1"
# crypt / open
echo "${passphrase}" |
cryptsetup luksOpen "${device}1" "crypt"
@ -50,22 +50,22 @@ rwx_rescue_wipe_2_make_ovh_vle2() {
# crypt / close
cryptsetup luksClose "crypt"
# read passphrase
passphrase="$(sh_read_passphrase)"
passphrase="$(rwx_read_passphrase)"
# crypt / encrypt
sh_fs_luks_format "${passphrase}" "${device}1"
rwx_fs_luks_format "${passphrase}" "${device}1"
# crypt / open
echo "${passphrase}" |
cryptsetup luksOpen "${device}1" "crypt"
# passphrase
unset passphrase
# crypt / format
sh_fs_make_btrfs "/dev/mapper/crypt" "crypt" \
rwx_fs_make_btrfs "/dev/mapper/crypt" "crypt" \
"00000000-0000-0000-0000-00000000000c"
# crypt / mount
mkdir --parents "/media/crypt"
mount --options "autodefrag,compress-force=zstd" \
"/dev/mapper/crypt" "/media/crypt"
# crypt / swap
sh_fs_make_btrfs_swap "/media/crypt/swap" "4g" \
rwx_fs_make_btrfs_swap "/media/crypt/swap" "4g" \
"00000000-0000-0000-0000-000000000005"
}