Update script
This commit is contained in:
parent
eb1f997830
commit
f9f1a0ec1f
1 changed files with 22 additions and 13 deletions
|
|
@ -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 <<EOF
|
||||
menuentry 'CentOS ${CENTOS_VERSION} Install (PXE)' --unrestricted {
|
||||
menuentry '$DISTRIB ${DIST_VERSION} Install (PXE)' --unrestricted {
|
||||
set root='${UUID_BOOT_DISK}'
|
||||
if [ x\$feature_platform_search_hint = xy ]; then
|
||||
search --no-floppy --fs-uuid --set=root --hint='${UUID_BOOT_DISK}' ${BOOT_UUID}
|
||||
else
|
||||
search --no-floppy --fs-uuid --set=root ${BOOT_UUID}
|
||||
fi
|
||||
linux $PARTBOOT/vmlinuz ${INST_OPTIONS} inst.ks=http://boot.reslinger.net/ks${CENTOS_VERSION}.cfg inst.stage2=$MIRROIR ${CONSOLE}
|
||||
linux $PARTBOOT/vmlinuz ${INST_OPTIONS} inst.ks=https://boot.reslinger.net/ks${DIST_VERSION}.cfg inst.stage2=$MIRROIR ${CONSOLE}
|
||||
initrd $PARTBOOT/initrd.img
|
||||
}
|
||||
EOF
|
||||
if [ -d /sys/firmware/efi -a -e /boot/efi/EFI/redhat/grub.cfg ]; then
|
||||
CONFDIR=/boot/efi/EFI/redhat
|
||||
elif [ -d /sys/firmware/efi -a -e /boot/efi/EFI/almalinux/grub.cfg ]; then
|
||||
CONFDIR=/boot/efi/EFI/almalinux
|
||||
elif [ -d /sys/firmware/efi -a -e /boot/efi/EFI/centos/grub.cfg ]; then
|
||||
CONFDIR=/boot/efi/EFI/centos
|
||||
else
|
||||
CONFDIR=/boot/grub2
|
||||
fi
|
||||
grub2-mkconfig --output="${CONFDIR}"/grub.cfg
|
||||
grub2-reboot "CentOS ${CENTOS_VERSION} Install (PXE)"
|
||||
grub2-reboot "$DISTRIB ${DIST_VERSION} Install (PXE)"
|
||||
elif [ -f /boot/grub/grub.conf ]; then
|
||||
cat >> /boot/grub/grub.conf <<EOF
|
||||
title CentOS ${CENTOS_VERSION} Install (PXE)
|
||||
title $DISTRIB ${DIST_VERSION} Install (PXE)
|
||||
root (hd0,0)
|
||||
kernel $PARTBOOT/vmlinuz ${INST_OPTIONS} inst.ks=http://boot.reslinger.net/ks${CENTOS_VERSION}.cfg inst.stage2=$MIRROIR ${CONSOLE}
|
||||
kernel $PARTBOOT/vmlinuz ${INST_OPTIONS} inst.ks=https://boot.reslinger.net/ks${DIST_VERSION}.cfg inst.stage2=$MIRROIR ${CONSOLE}
|
||||
initrd $PARTBOOT/initrd.img
|
||||
EOF
|
||||
NB="$(grep -Ev '^($| *#)' /boot/grub/grub.conf | grep -c title)"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue