This commit is contained in:
Marc Beninca 2024-11-11 17:14:04 +01:00
parent 5776a03fe4
commit 6419243098
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -43,7 +43,8 @@ fr_FR.UTF-8 UTF-8
debian_disable_frontend debian_disable_frontend
# install packages # install packages
for package in "${packages[@]}"; do for package in "${packages[@]}"; do
echo ; echo "${package}" echo
echo "${package}"
apt-get install \ apt-get install \
--assume-yes \ --assume-yes \
"${package}" "${package}"
@ -83,7 +84,8 @@ rescue_hetzner_install() {
apt_clean_cache apt_clean_cache
# install packages # install packages
for package in "${packages[@]}"; do for package in "${packages[@]}"; do
echo ; echo "${package}" echo
echo "${package}"
apt-get install \ apt-get install \
--assume-yes \ --assume-yes \
"${package}" "${package}"
@ -91,7 +93,8 @@ rescue_hetzner_install() {
done done
# install backports # install backports
for package in "${backports[@]}"; do for package in "${backports[@]}"; do
echo ; echo "${package}" echo
echo "${package}"
apt-get install \ apt-get install \
--assume-yes \ --assume-yes \
--target-release "${release}-backports" \ --target-release "${release}-backports" \
@ -151,29 +154,34 @@ rescue_hetzner_wipe_8_8_0_init() {
number=0 number=0
for device in "${devices[@]}"; do for device in "${devices[@]}"; do
((number++)) ((number++))
echo ; echo "#${number}: ${device}" echo
echo "#${number}: ${device}"
# #
parted "${device}" --script mktable gpt parted "${device}" --script \
mktable gpt
# #
parted "${device}" unit "${unit}" \ parted "${device}" \
mkpart "crypt-${number}" 33282 7630885 unit "${unit}" mkpart "crypt-${number}" 33282 7630885
# #
parted "${device}" unit "${unit}" \ parted "${device}" \
mkpart "boot-${number}" 514 33282 unit "${unit}" mkpart "boot-${number}" 514 33282
# #
parted "${device}" unit "${unit}" \ parted "${device}" \
mkpart "esp-${number}" 2 514 unit "${unit}" mkpart "esp-${number}" 2 514
parted "${device}" set 3 esp on parted "${device}" \
set 3 esp on
# #
parted "${device}" unit "${unit}" \ parted "${device}" \
mkpart "bios-${number}" 1 2 unit "${unit}" mkpart "bios-${number}" 1 2
parted "${device}" set 4 bios_grub on parted "${device}" \
set 4 bios_grub on
done done
# #
number=0 number=0
for device in "${devices[@]}"; do for device in "${devices[@]}"; do
((number++)) ((number++))
echo ; echo "#${number}: ${device}4" echo
echo "#${number}: ${device}4"
# wipe bios # wipe bios
dd \ dd \
if='/dev/zero' of="${device}4" if='/dev/zero' of="${device}4"
@ -182,7 +190,8 @@ rescue_hetzner_wipe_8_8_0_init() {
number=0 number=0
for device in "${devices[@]}"; do for device in "${devices[@]}"; do
((number++)) ((number++))
echo ; echo "#${number}: ${device}3" echo
echo "#${number}: ${device}3"
# format esp # format esp
dd \ dd \
if='/dev/zero' of="${device}3" bs='1M' if='/dev/zero' of="${device}3" bs='1M'
@ -200,7 +209,8 @@ rescue_hetzner_wipe_8_8_0_init() {
number=0 number=0
for device in "${devices[@]}"; do for device in "${devices[@]}"; do
((number++)) ((number++))
echo ; echo "#${number}: ${device}2" echo
echo "#${number}: ${device}2"
# wipe boot # wipe boot
dd status='progress' \ dd status='progress' \
if='/dev/zero' of="${device}2" bs='1G' count=1 if='/dev/zero' of="${device}2" bs='1G' count=1
@ -233,7 +243,8 @@ rescue_hetzner_wipe_8_8_0_init() {
number=0 number=0
for device in "${devices[@]}"; do for device in "${devices[@]}"; do
((number++)) ((number++))
echo ; echo "#${number}: ${device}1" echo
echo "#${number}: ${device}1"
# wipe crypt head # wipe crypt head
dd status='progress' \ dd status='progress' \
if='/dev/zero' of="${device}1" bs='1G' count=1 if='/dev/zero' of="${device}1" bs='1G' count=1
@ -252,8 +263,8 @@ rescue_hetzner_wipe_8_8_0_init() {
--uuid '00000000:00000000:00000000:00000001' \ --uuid '00000000:00000000:00000000:00000001' \
"${members[@]}" "${members[@]}"
# encrypt # encrypt
echo "${passphrase}" \ echo "${passphrase}" |
| cryptsetup \ cryptsetup \
--verbose \ --verbose \
--batch-mode \ --batch-mode \
--type 'luks2' \ --type 'luks2' \
@ -266,8 +277,8 @@ rescue_hetzner_wipe_8_8_0_init() {
luksFormat \ luksFormat \
'/dev/md/crypt' '/dev/md/crypt'
# open # open
echo "${passphrase}" \ echo "${passphrase}" |
| cryptsetup luksOpen '/dev/md/crypt' 'crypt' cryptsetup luksOpen '/dev/md/crypt' 'crypt'
} }
rescue_hetzner_wipe_8_8_1_zero() { rescue_hetzner_wipe_8_8_1_zero() {
@ -284,8 +295,8 @@ rescue_hetzner_wipe_8_8_2_make() {
echo -n 'PassPhrase: ' echo -n 'PassPhrase: '
read -r -s passphrase read -r -s passphrase
# encrypt # encrypt
echo "${passphrase}" \ echo "${passphrase}" |
| cryptsetup \ cryptsetup \
--verbose \ --verbose \
--batch-mode \ --batch-mode \
--type 'luks2' \ --type 'luks2' \
@ -298,8 +309,8 @@ rescue_hetzner_wipe_8_8_2_make() {
luksFormat \ luksFormat \
'/dev/md/crypt' '/dev/md/crypt'
# open # open
echo "${passphrase}" \ echo "${passphrase}" |
| cryptsetup luksOpen '/dev/md/crypt' 'crypt' cryptsetup luksOpen '/dev/md/crypt' 'crypt'
# format crypt # format crypt
mkfs.btrfs --force \ mkfs.btrfs --force \
--checksum 'sha256' \ --checksum 'sha256' \
@ -321,6 +332,6 @@ rescue_hetzner_wipe_8_8_2_make() {
rescue_hetzner_wipe_8_8_3_close() { rescue_hetzner_wipe_8_8_3_close() {
umount '/media/boot' umount '/media/boot'
# #
umount '/media/crypt' \ umount '/media/crypt' &&
&& cryptsetup luksClose 'crypt' cryptsetup luksClose 'crypt'
} }