2024-11-11 18:06:27 +01:00
|
|
|
rescue_wipe_0_init_ovh_vle2() {
|
2024-11-11 15:40:04 +01:00
|
|
|
local device="/dev/sdb"
|
|
|
|
local passphrase
|
|
|
|
# read passphrase
|
2024-11-20 10:09:40 +01:00
|
|
|
passphrase="$(sh_read_passphrase)"
|
2024-11-11 16:37:27 +01:00
|
|
|
# warn
|
2024-11-20 10:05:56 +01:00
|
|
|
sh_warn_wipe "${device}"
|
2024-11-11 12:32:13 +01:00
|
|
|
#
|
2024-11-12 19:45:47 +01:00
|
|
|
parted --script "${device}" \
|
|
|
|
mktable gpt \
|
|
|
|
unit "mib" \
|
|
|
|
mkpart "crypt" 4610 40959 \
|
|
|
|
mkpart "boot" 514 4610 \
|
|
|
|
mkpart "esp" 2 514 \
|
|
|
|
set 3 esp on \
|
|
|
|
mkpart bios 1 2 \
|
2024-11-11 17:21:21 +01:00
|
|
|
set 4 bios_grub on
|
2024-11-11 16:37:27 +01:00
|
|
|
# bios / wipe
|
2024-11-20 09:34:45 +01:00
|
|
|
sh_fs_wipe "${device}4"
|
2024-11-11 16:37:27 +01:00
|
|
|
# esp / wipe
|
2024-11-20 09:34:45 +01:00
|
|
|
sh_fs_wipe "${device}3" "1M"
|
2024-11-11 16:37:27 +01:00
|
|
|
# esp / format
|
2024-11-20 09:37:07 +01:00
|
|
|
sh_fs_make_fat "${device}3" "esp" "00000001"
|
2024-11-11 16:37:27 +01:00
|
|
|
# esp / mount
|
|
|
|
mkdir --parents "/media/esp"
|
|
|
|
mount "${device}3" "/media/esp"
|
|
|
|
# boot / wipe
|
2024-11-20 09:34:45 +01:00
|
|
|
sh_fs_wipe "${device}2" "1G" 1
|
2024-11-11 16:37:27 +01:00
|
|
|
# boot / format
|
2024-11-20 09:40:58 +01:00
|
|
|
sh_fs_make_btrfs "${device}2" "boot" \
|
2024-11-12 22:47:18 +01:00
|
|
|
"00000000-0000-0000-0000-00000000000b"
|
2024-11-11 16:37:27 +01:00
|
|
|
# boot / mount
|
|
|
|
mkdir --parents "/media/boot"
|
|
|
|
mount --options "autodefrag,compress-force=zstd" \
|
|
|
|
"${device}2" "/media/boot"
|
|
|
|
# crypt / wipe
|
2024-11-20 09:34:45 +01:00
|
|
|
sh_fs_wipe "${device}1" "1G" 1
|
2024-11-11 16:37:27 +01:00
|
|
|
# crypt / encrypt
|
2024-11-20 09:31:53 +01:00
|
|
|
sh_fs_luks_format "${passphrase}" "${device}1"
|
2024-11-11 16:37:27 +01:00
|
|
|
# crypt / open
|
2024-11-11 12:37:07 +01:00
|
|
|
echo "${passphrase}" |
|
2024-11-11 15:40:04 +01:00
|
|
|
cryptsetup luksOpen "${device}1" "crypt"
|
2024-11-12 09:28:08 +01:00
|
|
|
# passphrase
|
|
|
|
unset passphrase
|
2024-11-11 16:37:27 +01:00
|
|
|
}
|
|
|
|
|
2024-11-11 18:06:27 +01:00
|
|
|
rescue_wipe_2_make_ovh_vle2() {
|
2024-11-11 22:16:37 +01:00
|
|
|
local device="/dev/sdb"
|
2024-11-11 16:37:27 +01:00
|
|
|
local passphrase
|
|
|
|
# crypt / close
|
2024-11-11 12:32:13 +01:00
|
|
|
cryptsetup luksClose "crypt"
|
2024-11-11 16:37:27 +01:00
|
|
|
# read passphrase
|
2024-11-20 10:09:40 +01:00
|
|
|
passphrase="$(sh_read_passphrase)"
|
2024-11-11 16:37:27 +01:00
|
|
|
# crypt / encrypt
|
2024-11-20 09:31:53 +01:00
|
|
|
sh_fs_luks_format "${passphrase}" "${device}1"
|
2024-11-11 16:37:27 +01:00
|
|
|
# crypt / open
|
|
|
|
echo "${passphrase}" |
|
|
|
|
cryptsetup luksOpen "${device}1" "crypt"
|
2024-11-12 09:28:08 +01:00
|
|
|
# passphrase
|
|
|
|
unset passphrase
|
2024-11-11 16:37:27 +01:00
|
|
|
# crypt / format
|
2024-11-20 09:40:58 +01:00
|
|
|
sh_fs_make_btrfs "/dev/mapper/crypt" "crypt" \
|
2024-11-12 22:47:18 +01:00
|
|
|
"00000000-0000-0000-0000-00000000000c"
|
2024-11-11 16:37:27 +01:00
|
|
|
# crypt / mount
|
|
|
|
mkdir --parents "/media/crypt"
|
|
|
|
mount --options "autodefrag,compress-force=zstd" \
|
2024-11-11 22:21:17 +01:00
|
|
|
"/dev/mapper/crypt" "/media/crypt"
|
2024-11-11 16:37:27 +01:00
|
|
|
# crypt / swap
|
2024-11-20 09:38:22 +01:00
|
|
|
sh_fs_make_btrfs_swap "/media/crypt/swap" "4g" \
|
2024-11-12 22:59:49 +01:00
|
|
|
"00000000-0000-0000-0000-000000000005"
|
2024-11-11 16:37:27 +01:00
|
|
|
}
|