2024-11-11 17:06:27 +00:00
|
|
|
rescue_wipe_0_init_ovh_vle2() {
|
2024-11-11 14:40:04 +00:00
|
|
|
local device="/dev/sdb"
|
|
|
|
local passphrase
|
|
|
|
# read passphrase
|
2024-11-12 08:28:08 +00:00
|
|
|
passphrase="$(read_passphrase)"
|
2024-11-11 15:37:27 +00:00
|
|
|
# warn
|
2024-11-11 11:32:13 +00:00
|
|
|
lsblk
|
|
|
|
printf "%s" "WIPE ${device} /?\\ OR CANCEL /!\\"
|
|
|
|
read -r
|
|
|
|
#
|
2024-11-12 18:45:47 +00: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 16:21:21 +00:00
|
|
|
set 4 bios_grub on
|
2024-11-11 15:37:27 +00:00
|
|
|
# bios / wipe
|
2024-11-12 19:22:58 +00:00
|
|
|
fs_wipe "${device}4"
|
2024-11-11 15:37:27 +00:00
|
|
|
# esp / wipe
|
2024-11-12 19:22:58 +00:00
|
|
|
fs_wipe "${device}3" "1M"
|
2024-11-11 15:37:27 +00:00
|
|
|
# esp / format
|
2024-11-12 19:03:47 +00:00
|
|
|
fs_make_fat "${device}3" "esp" "00000001"
|
2024-11-11 15:37:27 +00:00
|
|
|
# esp / mount
|
|
|
|
mkdir --parents "/media/esp"
|
|
|
|
mount "${device}3" "/media/esp"
|
|
|
|
# boot / wipe
|
2024-11-12 19:22:58 +00:00
|
|
|
fs_wipe "${device}2" "1G" 1
|
2024-11-11 15:37:27 +00:00
|
|
|
# boot / format
|
2024-11-12 21:47:18 +00:00
|
|
|
fs_make_btrfs "${device}2" "boot" \
|
|
|
|
"00000000-0000-0000-0000-00000000000b"
|
2024-11-11 15:37:27 +00:00
|
|
|
# boot / mount
|
|
|
|
mkdir --parents "/media/boot"
|
|
|
|
mount --options "autodefrag,compress-force=zstd" \
|
|
|
|
"${device}2" "/media/boot"
|
|
|
|
# crypt / wipe
|
2024-11-12 19:22:58 +00:00
|
|
|
fs_wipe "${device}1" "1G" 1
|
2024-11-11 15:37:27 +00:00
|
|
|
# crypt / encrypt
|
2024-11-12 22:36:20 +00:00
|
|
|
luks_format "${passphrase}" "${device}1"
|
2024-11-11 15:37:27 +00:00
|
|
|
# crypt / open
|
2024-11-11 11:37:07 +00:00
|
|
|
echo "${passphrase}" |
|
2024-11-11 14:40:04 +00:00
|
|
|
cryptsetup luksOpen "${device}1" "crypt"
|
2024-11-12 08:28:08 +00:00
|
|
|
# passphrase
|
|
|
|
unset passphrase
|
2024-11-11 15:37:27 +00:00
|
|
|
}
|
|
|
|
|
2024-11-11 17:06:27 +00:00
|
|
|
rescue_wipe_2_make_ovh_vle2() {
|
2024-11-11 21:16:37 +00:00
|
|
|
local device="/dev/sdb"
|
2024-11-11 15:37:27 +00:00
|
|
|
local passphrase
|
|
|
|
# crypt / close
|
2024-11-11 11:32:13 +00:00
|
|
|
cryptsetup luksClose "crypt"
|
2024-11-11 15:37:27 +00:00
|
|
|
# read passphrase
|
2024-11-12 08:28:08 +00:00
|
|
|
passphrase="$(read_passphrase)"
|
2024-11-11 15:37:27 +00:00
|
|
|
# crypt / encrypt
|
2024-11-12 22:36:20 +00:00
|
|
|
luks_format "${passphrase}" "${device}1"
|
2024-11-11 15:37:27 +00:00
|
|
|
# crypt / open
|
|
|
|
echo "${passphrase}" |
|
|
|
|
cryptsetup luksOpen "${device}1" "crypt"
|
2024-11-12 08:28:08 +00:00
|
|
|
# passphrase
|
|
|
|
unset passphrase
|
2024-11-11 15:37:27 +00:00
|
|
|
# crypt / format
|
2024-11-12 21:47:18 +00:00
|
|
|
fs_make_btrfs "/dev/mapper/crypt" "crypt" \
|
|
|
|
"00000000-0000-0000-0000-00000000000c"
|
2024-11-11 15:37:27 +00:00
|
|
|
# crypt / mount
|
|
|
|
mkdir --parents "/media/crypt"
|
|
|
|
mount --options "autodefrag,compress-force=zstd" \
|
2024-11-11 21:21:17 +00:00
|
|
|
"/dev/mapper/crypt" "/media/crypt"
|
2024-11-11 15:37:27 +00:00
|
|
|
# crypt / swap
|
2024-11-12 21:59:49 +00:00
|
|
|
fs_make_btrfs_swap "/media/crypt/swap" "4g" \
|
|
|
|
"00000000-0000-0000-0000-000000000005"
|
2024-11-11 15:37:27 +00:00
|
|
|
}
|