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