71 lines
1.7 KiB
Bash
71 lines
1.7 KiB
Bash
rescue_wipe_0_init_ovh_vle2() {
|
|
local device="/dev/sdb"
|
|
local passphrase
|
|
# read passphrase
|
|
passphrase="$(read_passphrase)"
|
|
# warn
|
|
warn_wipe "${device}"
|
|
#
|
|
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 \
|
|
set 4 bios_grub on
|
|
# bios / wipe
|
|
fs_wipe "${device}4"
|
|
# esp / wipe
|
|
fs_wipe "${device}3" "1M"
|
|
# esp / format
|
|
fs_make_fat "${device}3" "esp" "00000001"
|
|
# esp / mount
|
|
mkdir --parents "/media/esp"
|
|
mount "${device}3" "/media/esp"
|
|
# boot / wipe
|
|
fs_wipe "${device}2" "1G" 1
|
|
# boot / format
|
|
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
|
|
fs_wipe "${device}1" "1G" 1
|
|
# crypt / encrypt
|
|
luks_format "${passphrase}" "${device}1"
|
|
# crypt / open
|
|
echo "${passphrase}" |
|
|
cryptsetup luksOpen "${device}1" "crypt"
|
|
# passphrase
|
|
unset passphrase
|
|
}
|
|
|
|
rescue_wipe_2_make_ovh_vle2() {
|
|
local device="/dev/sdb"
|
|
local passphrase
|
|
# crypt / close
|
|
cryptsetup luksClose "crypt"
|
|
# read passphrase
|
|
passphrase="$(read_passphrase)"
|
|
# crypt / encrypt
|
|
luks_format "${passphrase}" "${device}1"
|
|
# crypt / open
|
|
echo "${passphrase}" |
|
|
cryptsetup luksOpen "${device}1" "crypt"
|
|
# passphrase
|
|
unset passphrase
|
|
# crypt / format
|
|
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
|
|
fs_make_btrfs_swap "/media/crypt/swap" "4g" \
|
|
"00000000-0000-0000-0000-000000000005"
|
|
}
|