From f9f1a0ec1f873d988235f66e6515568511728030 Mon Sep 17 00:00:00 2001 From: Adrien Reslinger Date: Sat, 10 Jul 2021 00:03:15 +0200 Subject: [PATCH 1/2] Update script --- files/usr/local/sbin/install_pxe.sh | 35 ++++++++++++++++++----------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/files/usr/local/sbin/install_pxe.sh b/files/usr/local/sbin/install_pxe.sh index e09d3b0..2471da5 100755 --- a/files/usr/local/sbin/install_pxe.sh +++ b/files/usr/local/sbin/install_pxe.sh @@ -2,12 +2,15 @@ for PARAM in "$@"; do case "$PARAM" in - --version=*) CENTOS_VERSION="${PARAM/*=}" ;; + --version=*) DIST_VERSION="${PARAM/*=}" ;; --distrib=*) DISTRIB="${PARAM/*=}" ;; + --static) STATIC=true ;; + --help) + echo "syntaxe: $0 [--help] [--static] [--version=7|8] [--distrib=CentOS|AlmaLinux]" esac done -if [ -z "${CENTOS_VERSION}" ]; then - CENTOS_VERSION=8 +if [ -z "${DIST_VERSION}" ]; then + DIST_VERSION=8 fi if [ -z "${DISTRIB}" ]; then DISTRIB="CentOS" @@ -27,15 +30,19 @@ MAC="$(ip addr show $IF | grep ether\ | awk '{print $2}' | cut -d/ -f2 | tr [A- DNS="$(grep nameserver /etc/resolv.conf | grep -v 127.0.0.1 | awk '{printf $2","}' | sed 's/,$//')" ARCH=$(uname -m | sed 's|i.86|i386|') -if [ "${CENTOS_VERSION}" == "8" ]; then - MIRROIR=http://mirror.centos.org/centos/8/BaseOS/$ARCH/os +if [ "${DIST_VERSION}" == "8" ]; then #MIRROIR=http://lune.saacy.reslinger.net/repos/CentOS8/$ARCH/os -elif [ "${CENTOS_VERSION}" == "7" ]; then + if [ "$DISTRIB" == "CentOS" ]; then + MIRROIR=http://mirror.centos.org/centos/8/BaseOS/$ARCH/os + elif [ "$DISTRIB" == "AlmaLinux" ]; then + MIRROIR=https://repo.almalinux.org/almalinux/8/BaseOS/x86_64/os + fi +elif [ "${DIST_VERSION}" == "7" ]; then #MIRROIR=http://centos.mirrors.ovh.net/ftp.centos.org/7/os/$ARCH MIRROIR=http://mirror.centos.org/centos/7/os/$ARCH #MIRROIR=http://lune.saacy.reslinger.net/repos/CentOS7/$ARCH/os else - echo "Version ${CENTOS_VERSION} non reconnue" >&2 + echo "Version ${DIST_VERSION} non reconnue" >&2 exit 1 fi #DESKTOP=desktop @@ -66,7 +73,7 @@ fi if [ ! -z "$STATIC" ]; then INST_OPTIONS="ip=$IP::$GW:$MASK:$(hostname -s):$IF:off:${DNS/,*} ${INST_OPTIONS}" fi -if [ -f /boot/grub2/grub.cfg -o -f /boot/efi/EFI/centos/grub.cfg -o -f /boot/efi/EFI/redhat/grub.cfg ]; then +if [ -f /boot/grub2/grub.cfg -o $(find /boot/efi/EFI -name grub.cfg | egrep -c '(almalinux|centos|redhat)') -gt 0 ]; then if [ $(sed 's/ /\n/g' /proc/cmdline | grep -c console) -gt 1 ]; then # echo "On ajoute les console pour avoir une config également en serial" CONSOLE="$(for i in `sed 's/ /\n/g' /proc/cmdline | grep console`; do echo -n "$i "; done | sed 's/ $//')" @@ -86,31 +93,33 @@ if [ -f /boot/grub2/grub.cfg -o -f /boot/efi/EFI/centos/grub.cfg -o -f /boot/efi fi cat >> /etc/grub.d/40_custom <> /boot/grub/grub.conf < Date: Sat, 10 Jul 2021 00:03:23 +0200 Subject: [PATCH 2/2] Update template --- templates/etc/dnf/automatic.conf.j2 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/templates/etc/dnf/automatic.conf.j2 b/templates/etc/dnf/automatic.conf.j2 index ed8ecad..1406a17 100644 --- a/templates/etc/dnf/automatic.conf.j2 +++ b/templates/etc/dnf/automatic.conf.j2 @@ -5,6 +5,10 @@ upgrade_type = default random_sleep = 0 +# Maximum time in seconds to wait until the system is on-line and able to +# connect to remote repositories. +network_online_timeout = 60 + # To just receive updates use dnf-automatic-notifyonly.timer # Whether updates should be downloaded when they are available, by @@ -61,7 +65,7 @@ email_host = localhost # The shell command to use to send email. This is a Python format string, # as used in str.format(). The format function will pass shell-quoted arguments # called body, subject, email_from, email_to. -# command_format = "mail -s {subject} -r {email_from} {email_to}" +# command_format = "mail -Ssendwait -s {subject} -r {email_from} {email_to}" # The contents of stdin to pass to the command. It is a format string with the # same arguments as `command_format`.