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 <