This commit is contained in:
Marc Beninca 2024-11-13 14:00:10 +01:00
parent d028d83f7a
commit 8d53e86bcd
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -1,9 +1,8 @@
rescue_wipe_0_init_hetzner_8_8() { rescue_wipe_0_init_hetzner_8_8() {
local device local device
local devices=( set \
"/dev/sda" "/dev/sda" \
"/dev/sdb" "/dev/sdb"
)
local members local members
local number local number
local passphrase local passphrase
@ -11,11 +10,11 @@ rescue_wipe_0_init_hetzner_8_8() {
passphrase="$(read_passphrase)" passphrase="$(read_passphrase)"
# #
lsblk lsblk
echo -n "WIPE" "${devices[@]}" "/?\\ OR CANCEL /!\\" echo -n "WIPE" "${@}" "/?\\ OR CANCEL /!\\"
read -r read -r
# #
number=0 number=0
for device in "${devices[@]}"; do for device in "${@}"; do
number=$((number + 1)) number=$((number + 1))
echo echo
echo "#${number}: ${device}" echo "#${number}: ${device}"
@ -32,7 +31,7 @@ rescue_wipe_0_init_hetzner_8_8() {
done done
# #
number=0 number=0
for device in "${devices[@]}"; do for device in "${@}"; do
number=$((number + 1)) number=$((number + 1))
echo echo
echo "#${number}: ${device}4" echo "#${number}: ${device}4"
@ -41,7 +40,7 @@ rescue_wipe_0_init_hetzner_8_8() {
done done
# #
number=0 number=0
for device in "${devices[@]}"; do for device in "${@}"; do
number=$((number + 1)) number=$((number + 1))
echo echo
echo "#${number}: ${device}3" echo "#${number}: ${device}3"
@ -54,7 +53,7 @@ rescue_wipe_0_init_hetzner_8_8() {
done done
# #
number=0 number=0
for device in "${devices[@]}"; do for device in "${@}"; do
number=$((number + 1)) number=$((number + 1))
echo echo
echo "#${number}: ${device}2" echo "#${number}: ${device}2"
@ -63,7 +62,7 @@ rescue_wipe_0_init_hetzner_8_8() {
done done
# #
members=() members=()
for device in "${devices[@]}"; do for device in "${@}"; do
members+=("${device}2") members+=("${device}2")
done done
mdadm \ mdadm \
@ -71,7 +70,7 @@ rescue_wipe_0_init_hetzner_8_8() {
--level 0 \ --level 0 \
--metadata 1 \ --metadata 1 \
--name "md:boot" \ --name "md:boot" \
--raid-devices ${#devices[@]} \ --raid-devices ${#} \
--uuid "00000000:00000000:00000000:00000002" \ --uuid "00000000:00000000:00000000:00000002" \
"${members[@]}" "${members[@]}"
# #
@ -84,7 +83,7 @@ rescue_wipe_0_init_hetzner_8_8() {
"/dev/md/boot" "/media/boot" "/dev/md/boot" "/media/boot"
# #
number=0 number=0
for device in "${devices[@]}"; do for device in "${@}"; do
number=$((number + 1)) number=$((number + 1))
echo echo
echo "#${number}: ${device}1" echo "#${number}: ${device}1"
@ -93,7 +92,7 @@ rescue_wipe_0_init_hetzner_8_8() {
done done
# #
members=() members=()
for device in "${devices[@]}"; do for device in "${@}"; do
members+=("${device}1") members+=("${device}1")
done done
mdadm \ mdadm \
@ -101,7 +100,7 @@ rescue_wipe_0_init_hetzner_8_8() {
--level 0 \ --level 0 \
--metadata 1 \ --metadata 1 \
--name "md:crypt" \ --name "md:crypt" \
--raid-devices ${#devices[@]} \ --raid-devices ${#} \
--uuid "00000000:00000000:00000000:00000001" \ --uuid "00000000:00000000:00000000:00000001" \
"${members[@]}" "${members[@]}"
# encrypt # encrypt