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
|
for PARAM in "$@"; do
|
||||||
case "$PARAM" in
|
case "$PARAM" in
|
||||||
--version=*) CENTOS_VERSION="${PARAM/*=}" ;;
|
--version=*) DIST_VERSION="${PARAM/*=}" ;;
|
||||||
--distrib=*) DISTRIB="${PARAM/*=}" ;;
|
--distrib=*) DISTRIB="${PARAM/*=}" ;;
|
||||||
|
--static) STATIC=true ;;
|
||||||
|
--help)
|
||||||
|
echo "syntaxe: $0 [--help] [--static] [--version=7|8] [--distrib=CentOS|AlmaLinux]"
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
if [ -z "${CENTOS_VERSION}" ]; then
|
if [ -z "${DIST_VERSION}" ]; then
|
||||||
CENTOS_VERSION=8
|
DIST_VERSION=8
|
||||||
fi
|
fi
|
||||||
if [ -z "${DISTRIB}" ]; then
|
if [ -z "${DISTRIB}" ]; then
|
||||||
DISTRIB="CentOS"
|
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/,$//')"
|
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|')
|
ARCH=$(uname -m | sed 's|i.86|i386|')
|
||||||
|
|
||||||
if [ "${CENTOS_VERSION}" == "8" ]; then
|
if [ "${DIST_VERSION}" == "8" ]; then
|
||||||
MIRROIR=http://mirror.centos.org/centos/8/BaseOS/$ARCH/os
|
|
||||||
#MIRROIR=http://lune.saacy.reslinger.net/repos/CentOS8/$ARCH/os
|
#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://centos.mirrors.ovh.net/ftp.centos.org/7/os/$ARCH
|
||||||
MIRROIR=http://mirror.centos.org/centos/7/os/$ARCH
|
MIRROIR=http://mirror.centos.org/centos/7/os/$ARCH
|
||||||
#MIRROIR=http://lune.saacy.reslinger.net/repos/CentOS7/$ARCH/os
|
#MIRROIR=http://lune.saacy.reslinger.net/repos/CentOS7/$ARCH/os
|
||||||
else
|
else
|
||||||
echo "Version ${CENTOS_VERSION} non reconnue" >&2
|
echo "Version ${DIST_VERSION} non reconnue" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
#DESKTOP=desktop
|
#DESKTOP=desktop
|
||||||
|
|
@ -66,7 +73,7 @@ fi
|
||||||
if [ ! -z "$STATIC" ]; then
|
if [ ! -z "$STATIC" ]; then
|
||||||
INST_OPTIONS="ip=$IP::$GW:$MASK:$(hostname -s):$IF:off:${DNS/,*} ${INST_OPTIONS}"
|
INST_OPTIONS="ip=$IP::$GW:$MASK:$(hostname -s):$IF:off:${DNS/,*} ${INST_OPTIONS}"
|
||||||
fi
|
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
|
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"
|
# 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/ $//')"
|
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
|
fi
|
||||||
|
|
||||||
cat >> /etc/grub.d/40_custom <<EOF
|
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}'
|
set root='${UUID_BOOT_DISK}'
|
||||||
if [ x\$feature_platform_search_hint = xy ]; then
|
if [ x\$feature_platform_search_hint = xy ]; then
|
||||||
search --no-floppy --fs-uuid --set=root --hint='${UUID_BOOT_DISK}' ${BOOT_UUID}
|
search --no-floppy --fs-uuid --set=root --hint='${UUID_BOOT_DISK}' ${BOOT_UUID}
|
||||||
else
|
else
|
||||||
search --no-floppy --fs-uuid --set=root ${BOOT_UUID}
|
search --no-floppy --fs-uuid --set=root ${BOOT_UUID}
|
||||||
fi
|
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
|
initrd $PARTBOOT/initrd.img
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
if [ -d /sys/firmware/efi -a -e /boot/efi/EFI/redhat/grub.cfg ]; then
|
if [ -d /sys/firmware/efi -a -e /boot/efi/EFI/redhat/grub.cfg ]; then
|
||||||
CONFDIR=/boot/efi/EFI/redhat
|
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
|
elif [ -d /sys/firmware/efi -a -e /boot/efi/EFI/centos/grub.cfg ]; then
|
||||||
CONFDIR=/boot/efi/EFI/centos
|
CONFDIR=/boot/efi/EFI/centos
|
||||||
else
|
else
|
||||||
CONFDIR=/boot/grub2
|
CONFDIR=/boot/grub2
|
||||||
fi
|
fi
|
||||||
grub2-mkconfig --output="${CONFDIR}"/grub.cfg
|
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
|
elif [ -f /boot/grub/grub.conf ]; then
|
||||||
cat >> /boot/grub/grub.conf <<EOF
|
cat >> /boot/grub/grub.conf <<EOF
|
||||||
title CentOS ${CENTOS_VERSION} Install (PXE)
|
title $DISTRIB ${DIST_VERSION} Install (PXE)
|
||||||
root (hd0,0)
|
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
|
initrd $PARTBOOT/initrd.img
|
||||||
EOF
|
EOF
|
||||||
NB="$(grep -Ev '^($| *#)' /boot/grub/grub.conf | grep -c title)"
|
NB="$(grep -Ev '^($| *#)' /boot/grub/grub.conf | grep -c title)"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue