Skip to content

Commit e909670

Browse files
authored
Merge pull request #6 from hetzneronline/master
Merge Upstream into our fork
2 parents 8bf61da + 851d99a commit e909670

13 files changed

+201
-92
lines changed

almalinux.sh

+6
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ generate_config_grub() {
9292

9393
sed -i "s/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\"$grub_cmdline_linux\"/" "$FOLD/hdd/etc/default/grub"
9494

95+
if ((IMG_VERSION > 85)) && ((IMG_VERSION <= 92)) && [[ -z "$GRUB_DEFAULT_OVERRIDE" ]]; then
96+
GRUB_DEFAULT_OVERRIDE='saved'
97+
fi
98+
99+
if [[ -n "$GRUB_DEFAULT_OVERRIDE" ]]; then sed -i "s/^GRUB_DEFAULT=.*/GRUB_DEFAULT=$GRUB_DEFAULT_OVERRIDE/" "$FOLD/hdd/etc/default/grub"; fi
100+
95101
rm -f "$FOLD/hdd/boot/grub2/grub.cfg"
96102
if [ "$UEFI" -eq 1 ]; then
97103
execute_chroot_command "grub2-mkconfig -o /boot/efi/EFI/almalinux/grub.cfg 2>&1"; declare -i EXITCODE="$?"

archlinux.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ extract_image() {
3333
local hdd_dir="$FOLD/hdd"
3434
debug '# extract archlinux-bootstrap to disk'
3535
debug "# run tar xzf $ARCHLINUX_BOOTSTRAP -C $hdd_dir"
36-
tar xzf "$ARCHLINUX_BOOTSTRAP" -C "$hdd_dir" |& debugoutput || return 1
36+
tar --zstd -xf "$ARCHLINUX_BOOTSTRAP" -C "$hdd_dir" |& debugoutput || return 1
3737

3838
# pacman CheckSpace requires a mount to verify free space
3939
local chroot_dir="$hdd_dir/root.x86_64"

centos.sh

+6
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ generate_config_grub() {
9292

9393
sed -i "s/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\"$grub_cmdline_linux\"/" "$FOLD/hdd/etc/default/grub"
9494

95+
if ((IMG_VERSION > 80)) && ((IMG_VERSION <= 90)) && ((IMG_VERSION != 610)) && [[ -z "$GRUB_DEFAULT_OVERRIDE" ]]; then
96+
GRUB_DEFAULT_OVERRIDE='saved'
97+
fi
98+
99+
if [[ -n "$GRUB_DEFAULT_OVERRIDE" ]]; then sed -i "s/^GRUB_DEFAULT=.*/GRUB_DEFAULT=$GRUB_DEFAULT_OVERRIDE/" "$FOLD/hdd/etc/default/grub"; fi
100+
95101
rm -f "$FOLD/hdd/boot/grub2/grub.cfg"
96102
if [ "$UEFI" -eq 1 ]; then
97103
execute_chroot_command "grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg 2>&1"; declare -i EXITCODE="$?"

chroot.functions.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ execute_chroot_command_wo_debug() {
1515
TMPDIR= unshare -f -p chroot "$FOLD/hdd" /usr/bin/env bash -c "$@"
1616
local r=$?
1717
for ((i=${#dirs[@]}-1; i>=0; i--)); do
18-
until umount "$FOLD/hdd/${dirs[i]}"; do :; done
18+
until umount -fl "$FOLD/hdd/${dirs[i]}"; do :; done
1919
done
2020
return $r
2121
}

config.sh

+9-2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export SYSTEMD_NSPAWN_TMP_DIR="$FOLD/systemd_nspawn"
4141
export MODULES="virtio_pci virtio_blk via82cxxx sata_via sata_sil sata_nv sd_mod ahci atiixp raid0 raid1 raid5 raid6 raid10 3w-xxxx 3w-9xxx aacraid powernow-k8"
4242
export STATSSERVER4="88.198.31.148"
4343
export STATSSERVER6="[2a01:4f8:0:a0a1::bad:1]"
44+
export INSTALLATION_REPORT_URL='https://dcs-staging.hetzner.company/apis/data_center_metrics/v1/installimage_installation_reports'
4445
export HDDMINSIZE="7000000"
4546

4647
export DNSRESOLVER=("185.12.64.1" "185.12.64.2")
@@ -95,7 +96,7 @@ export CPANEL_INSTALLER_SRC=http://mirror.hetzner.com/tools/cpanelinc/cpanel
9596

9697
export PLESK_INSTALLER_SRC=http://mirror.hetzner.com/tools/parallels/plesk
9798
export PLESK_MIRROR=http://mirror.hetzner.com/plesk
98-
export PLESK_STD_VERSION=PLESK_18_0_57
99+
export PLESK_STD_VERSION=PLESK_18_0_62
99100
export PLESK_DOWNLOAD_RETRY_COUNT=999
100101
export PLESK_COMPONENTS=(
101102
awstats
@@ -138,13 +139,19 @@ export NOCOL="\033[00m"
138139

139140
export ARCHLINUX_DIR="$SCRIPTPATH/../archlinux"
140141
export ARCHLINUX_RELEASE_KEY="$ARCHLINUX_DIR/release-key.pgp"
141-
export ARCHLINUX_BOOTSTRAP="$ARCHLINUX_DIR/archlinux-bootstrap-latest-x86_64.tar.gz"
142+
export ARCHLINUX_BOOTSTRAP="$ARCHLINUX_DIR/archlinux-bootstrap-latest-x86_64.tar.zst"
143+
144+
export IMAGE_STILL_BETA_OVERRIDES=()
142145

143146
other_images() {
144147
find "$IMAGESPATH"/ -maxdepth 1 -type f -name "CoreOS*" -a -not -name "*.sig" -printf '%f\n'
145148
echo 'Proxmox-Virtualization-Environment-on-Debian-Bookworm'
146149
echo 'Proxmox-Virtualization-Environment-on-Debian-Bullseye'
147150
find "$IMAGESPATH/" -maxdepth 1 -type f -iname '*beta*' -a -not -name '*.sig' -printf '%f\n'
151+
local beta_image
152+
for beta_image in "${IMAGE_STILL_BETA_OVERRIDES[@]}"; do
153+
find "$IMAGESPATH/" -maxdepth 1 -type f -name "$beta_image" -a -not -name '*.sig' -printf '%f\n'
154+
done
148155
}
149156

150157
other_image_warning() {

functions.sh

+50-14
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,20 @@ generate_menu() {
153153
;;
154154
esac
155155

156+
# remove still beta images unless menu is Other
157+
if [[ "$1" != 'Other' ]]; then
158+
local image beta_image new_rawlist=()
159+
while read image; do
160+
for beta_image in "${IMAGE_STILL_BETA_OVERRIDES[@]}"; do
161+
if [[ "$image" == "$beta_image" ]]; then
162+
continue 2
163+
fi
164+
done
165+
new_rawlist+=("$image")
166+
done <<< "$RAWLIST"
167+
RAWLIST="$(printf '%s\n' "${new_rawlist[@]}")"
168+
fi
169+
156170
# generate formatted list for usage with "dialog"
157171
for i in $RAWLIST; do
158172
TEMPVAR="$i"
@@ -550,7 +564,7 @@ create_config() {
550564
local LIMIT=2096128
551565
local THREE_TB=2861588
552566
local DRIVE_SIZE; DRIVE_SIZE="$(sfdisk -s "$(smallest_hd)" 2>/dev/null)"
553-
DRIVE_SIZE="$(echo "$DRIVE_SIZE" / 1024 | bc)"
567+
DRIVE_SIZE="$(echo "$DRIVE_SIZE" / 1024 | bc)" # MiB
554568

555569
# adjust swap dynamically according to RAM
556570
# RAM < 2 GB : SWAP=2 * RAM
@@ -569,6 +583,12 @@ create_config() {
569583
SWAPSIZE=$((RAM / 2 / 1024 + 1))
570584
fi
571585

586+
# revert swap size to 4G if swap wouldnt fit into smallest disk
587+
DRIVE_SIZE_GIB=$((DRIVE_SIZE / 1024))
588+
if (( SWAPSIZE >= DRIVE_SIZE_GIB )); then
589+
SWAPSIZE=4
590+
fi
591+
572592
ESPPART='PART /boot/efi esp 256M\n'
573593

574594
if [ "$UEFI" -eq 1 ]; then
@@ -1018,7 +1038,7 @@ validate_vars() {
10181038
graph_error "ERROR: CentOS 6 is EOL since Nov 2020 and installimage does not support CentOS 6 anymore"
10191039
return 1
10201040
fi
1021-
if (( UEFI == 1 )) && rhel_9_based_image; then
1041+
if (( UEFI == 1 )) && rhel_9_based_image && test -z "$RHEL9_UEFI_OVERRIDE" ; then
10221042
graph_error "ERROR: we do not yet support $IAM $IMG_VERSION on EFI systems"
10231043
return 1
10241044
fi
@@ -2200,8 +2220,11 @@ make_fstab_entry() {
22002220
if grep -q '^/dev/disk/by-' <<< "$1"; then
22012221
p='-part'
22022222
else
2203-
p="$(echo $1 | grep nvme)"
2204-
[ -n "$p" ] && p='p'
2223+
local p; p=""
2224+
local nvme; nvme="$(echo $1 | grep nvme)"
2225+
[ -n "$nvme" ] && p='p'
2226+
local disk_by; disk_by="$(echo $1 | grep '^/dev/disk/by-')"
2227+
[ -n "$disk_by" ] && p='-part'
22052228
fi
22062229

22072230
if [ "$4" = "swap" ] ; then
@@ -2323,10 +2346,10 @@ make_swraid() {
23232346
continue
23242347
elif [ -n "$(echo "$line" | grep "/boot")" -a "$metadata_boot" == "--metadata=0.90" ] || [ "$metadata" == "--metadata=0.90" ]; then
23252348
# update fstab - replace /dev/sdaX with /dev/mdY
2326-
echo $line | sed "s/$SEDHDD\(p\)\?[0-9]\+/\/dev\/md$md_count/g" >> $fstab
2349+
echo $line | sed "s/$SEDHDD\(p\|-part\)\?[0-9]\+/\/dev\/md$md_count/g" >> $fstab
23272350
else
23282351
# update fstab - replace /dev/sdaX with /dev/md/Y
2329-
echo $line | sed "s/$SEDHDD\(p\)\?[0-9]\+/\/dev\/md\/$md_count/g" >> $fstab
2352+
echo $line | sed "s/$SEDHDD\(p\|-part\)\?[0-9]\+/\/dev\/md\/$md_count/g" >> $fstab
23302353
fi
23312354

23322355
# create raid array
@@ -2337,8 +2360,12 @@ make_swraid() {
23372360
local n=0
23382361
for n in $(seq 1 $COUNT_DRIVES) ; do
23392362
TARGETDISK="$(eval echo \$DRIVE${n})"
2340-
local p="$(echo $TARGETDISK | grep nvme)"
2341-
[ -n "$p" ] && p='p'
2363+
local p; p=""
2364+
local nvme; nvme="$(echo $TARGETDISK | grep nvme)"
2365+
[ -n "$nvme" ] && p='p'
2366+
local disk_by; disk_by="$(echo $TARGETDISK | grep '^/dev/disk/by-')"
2367+
[ -n "$disk_by" ] && p='-part'
2368+
23422369
components="$components $TARGETDISK$p$PARTNUM"
23432370
done
23442371

@@ -2390,8 +2417,11 @@ make_lvm() {
23902417
if [ -n "$1" ] ; then
23912418
local fstab=$1
23922419
local disk=$DRIVE1
2393-
local p; p="$(echo "$disk" | grep nvme)"
2394-
[ -n "$p" ] && p='p'
2420+
local p; p=""
2421+
local nvme; nvme="$(echo $TARGETDISK | grep nvme)"
2422+
[ -n "$nvme" ] && p='p'
2423+
local disk_by; disk_by="$(echo $TARGETDISK | grep '^/dev/disk/by-')"
2424+
[ -n "$disk_by" ] && p='-part'
23952425

23962426
# TODO: needs to be removed
23972427
# get device names for PVs depending if we use swraid or not
@@ -2421,7 +2451,7 @@ make_lvm() {
24212451
# remove all Physical Volumes
24222452
debug "# Removing all Physical Volumes"
24232453
while read -r pv vg; do
2424-
if [[ "$vg" =~ $PRESERVE_VG ]]; then
2454+
if [[ -n "$PRESERVE_VG" ]] && [[ "$vg" =~ $PRESERVE_VG ]]; then
24252455
debug "Not removing VG $vg"
24262456
else
24272457
pvremove -ff "$pv" 2>&1 | debugoutput
@@ -3850,7 +3880,8 @@ exit_function() {
38503880
echo " https://robot.hetzner.com/"
38513881
echo
38523882

3853-
report_install
3883+
report_install_old
3884+
report_install_new
38543885
}
38553886

38563887
#function to check if it is a intel or amd cpu
@@ -3981,8 +4012,13 @@ function hdinfo() {
39814012
*)
39824013
local smartctl_json model_name serial_number
39834014
if ! smartctl_json="$(smartctl -i -j "$dev" 2> /dev/null)"; then
3984-
echo '# unknown'
3985-
return
4015+
if is_usb_disk "$dev"; then
4016+
echo '# USB disk'
4017+
return
4018+
else
4019+
echo '# unknown'
4020+
return
4021+
fi
39864022
fi
39874023
model_name="$(jq -r '.model_name // empty' <<< "$smartctl_json" 2> /dev/null)" || :
39884024
serial_number="$(disk_serial "$dev")" || :

install.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,8 @@ fi
558558
#
559559
# Report install.conf and debug.txt to $STATSSERVER
560560
#
561-
report_install
561+
report_install_old
562+
report_install_new
562563

563564
#
564565
# Save installimage configuration and debug file on the new system

network_config.functions.sh

+2
Original file line numberDiff line numberDiff line change
@@ -835,6 +835,8 @@ setup_network_config() {
835835
cat "$stderr_file" | debugoutput
836836
return 1
837837
fi
838+
# delete chroot related lines from $stderr_file
839+
sed -i '/Running in chroot/d' "$stderr_file"
838840
if [[ -s "$stderr_file" ]]; then
839841
debug 'fatal: netplan generate stderr not empty:'
840842
cat "$stderr_file" | debugoutput

passwd.functions.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ rescue_gen_password_hash() {
3232
return 1
3333
fi
3434
cp /etc/shado{w,w.installimage_bak}
35-
"$SCRIPTPATH/util/passwd$rescue_algo.sh" <<< "$password"$'\n'"$password" &> /dev/null || return 1
35+
local passwd_cmd='passwd'
36+
if [[ -e /usr/bin/passwd_real ]]; then passwd_cmd='passwd_real'; fi
37+
PASSWD_CMD="$passwd_cmd" "$SCRIPTPATH/util/passwd$rescue_algo.sh" <<< "$password"$'\n'"$password" &> /dev/null || return 1
3638
local password_hash
3739
if ! password_hash="$(rescue_root_password_hash)"; then
3840
debug 'internal error: get rescue root password hash failed'

post-install/proxmox6

-70
This file was deleted.

0 commit comments

Comments
 (0)