rescue/hetzner
This commit is contained in:
parent
4d64db0b70
commit
dda61e2594
1 changed files with 14 additions and 14 deletions
|
@ -7,9 +7,9 @@ rwx_rescue_wipe_0_init_hetzner_8_8() {
|
|||
local number
|
||||
local passphrase
|
||||
# read passphrase
|
||||
passphrase="$(sh_read_passphrase)"
|
||||
passphrase="$(rwx_read_passphrase)"
|
||||
# warn
|
||||
sh_warn_wipe "${@}"
|
||||
rwx_warn_wipe "${@}"
|
||||
#
|
||||
number=0
|
||||
for device in "${@}"; do
|
||||
|
@ -34,7 +34,7 @@ rwx_rescue_wipe_0_init_hetzner_8_8() {
|
|||
echo
|
||||
echo "#${number}: ${device}4"
|
||||
# wipe bios
|
||||
sh_fs_wipe "${device}4"
|
||||
rwx_fs_wipe "${device}4"
|
||||
done
|
||||
#
|
||||
number=0
|
||||
|
@ -43,8 +43,8 @@ rwx_rescue_wipe_0_init_hetzner_8_8() {
|
|||
echo
|
||||
echo "#${number}: ${device}3"
|
||||
# format esp
|
||||
sh_fs_wipe "${device}3" "1M"
|
||||
sh_fs_make_fat "${device}3" "esp-${number}" "0000000${number}"
|
||||
rwx_fs_wipe "${device}3" "1M"
|
||||
rwx_fs_make_fat "${device}3" "esp-${number}" "0000000${number}"
|
||||
# mount esp
|
||||
mkdir --parents "/media/esp/${number}"
|
||||
mount "${device}3" "/media/esp/${number}"
|
||||
|
@ -56,17 +56,17 @@ rwx_rescue_wipe_0_init_hetzner_8_8() {
|
|||
echo
|
||||
echo "#${number}: ${device}2"
|
||||
# wipe boot
|
||||
sh_fs_wipe "${device}2" "1G" 1
|
||||
rwx_fs_wipe "${device}2" "1G" 1
|
||||
done
|
||||
#
|
||||
members=""
|
||||
for device in "${@}"; do
|
||||
members="${members} ${device}2"
|
||||
done
|
||||
sh_fs_raid_create \
|
||||
rwx_fs_raid_create \
|
||||
"boot" "00000000:00000000:00000000:00000002" ${members}
|
||||
#
|
||||
sh_fs_make_btrfs "/dev/md/boot" "boot" \
|
||||
rwx_fs_make_btrfs "/dev/md/boot" "boot" \
|
||||
"00000000-0000-0000-0000-00000000000b"
|
||||
# mount boot
|
||||
mkdir --parents "/media/boot"
|
||||
|
@ -80,17 +80,17 @@ rwx_rescue_wipe_0_init_hetzner_8_8() {
|
|||
echo
|
||||
echo "#${number}: ${device}1"
|
||||
# wipe crypt head
|
||||
sh_fs_wipe "${device}1" "1G" 1
|
||||
rwx_fs_wipe "${device}1" "1G" 1
|
||||
done
|
||||
#
|
||||
members=""
|
||||
for device in "${@}"; do
|
||||
members="${members} ${device}1"
|
||||
done
|
||||
sh_fs_raid_create \
|
||||
rwx_fs_raid_create \
|
||||
"crypt" "00000000:00000000:00000000:00000001" ${members}
|
||||
# encrypt
|
||||
sh_fs_luks_format "${passphrase}" "/dev/md/crypt"
|
||||
rwx_fs_luks_format "${passphrase}" "/dev/md/crypt"
|
||||
# open
|
||||
echo "${passphrase}" |
|
||||
cryptsetup luksOpen "/dev/md/crypt" "crypt"
|
||||
|
@ -103,9 +103,9 @@ rwx_rescue_wipe_2_make_hetzner_8_8() {
|
|||
# close
|
||||
cryptsetup luksClose "crypt"
|
||||
# read passphrase
|
||||
passphrase="$(sh_read_passphrase)"
|
||||
passphrase="$(rwx_read_passphrase)"
|
||||
# encrypt
|
||||
sh_fs_luks_format "${passphrase}" "/dev/md/crypt"
|
||||
rwx_fs_luks_format "${passphrase}" "/dev/md/crypt"
|
||||
# open
|
||||
echo "${passphrase}" |
|
||||
cryptsetup luksOpen "/dev/md/crypt" "crypt"
|
||||
|
@ -120,6 +120,6 @@ rwx_rescue_wipe_2_make_hetzner_8_8() {
|
|||
--options "autodefrag,compress-force=zstd" \
|
||||
"/dev/mapper/crypt" "/media/crypt"
|
||||
# make swap file
|
||||
sh_fs_make_btrfs_swap "/media/crypt/swap" "64g" \
|
||||
rwx_fs_make_btrfs_swap "/media/crypt/swap" "64g" \
|
||||
"00000000-0000-0000-0000-000000000005"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue