diff --git a/Dockerfile b/Dockerfile index af02aa9..19f1674 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,6 @@ RUN echo "deb [arch=amd64] http://fai-project.org/download bookworm koeln" > /et apt-get update && \ apt-get -y upgrade && \ apt-get -y install fai-server fai-doc fai-setup-storage && \ - apt-get -y install lftp curl && \ + apt-get -y install lftp curl whiptail && \ apt-get -y install qemu-utils && \ apt-get -y install reprepro xorriso squashfs-tools vim diff --git a/build_iso.sh b/build_iso.sh index 3585275..0923896 100755 --- a/build_iso.sh +++ b/build_iso.sh @@ -20,6 +20,86 @@ docker volume rm build_debian_iso_ext 2>/dev/null set -ex +function addIndexToArray { + local -n myarray=$1 + for idx in $(seq 1 $((${#myarray[@]}/2))); do + arrVar+=("$idx"")") + arrVar+=("${myarray[$(($idx*2-2))]}") + arrVar+=("${myarray[$(($idx*2-1))]}") + done +} + +listClasses=("SEAPATH_DBG" "ON" "SEAPATH_COCKPIT" "ON" "SEAPATH_KERBEROS" "ON") +arrVar=() +echo ${listClasses[@]} +addIndexToArray listClasses +echo ${arrVar[@]} + +CHOICES=$(whiptail --separate-output --checklist "Choose package classes to add to iso" 18 60 7 \ +"${arrVar[@]}" 3>&1 1>&2 2>&3) +finalClasses=() +for CHOICE in $CHOICES; do + c=`echo $CHOICE | sed "s/)//"` + c=$((($c-1)*2)) + echo ${listClasses[$c]} + finalClasses="$finalClasses""${listClasses[$c]}""," +done + +addFlagCombination() { + listFlags=("french" "FRENCH rather than english" "ON" "dbg" "DEBUG packages" "OFF" "raid" "lvm RAID" "ON" "cockpit" "COCKPIT packages" "OFF" "kerberos" "KERBEROS packages" "OFF" "cluster" "CLUSTER rather than standalone" "ON") + arrVar=() + if CHOICES=$(whiptail --separate-output --checklist "Choose flags combination to add to grub" 18 60 7 "${listFlags[@]}" 3>&1 1>&2 2>&3); then + # code 0 + finalFlags=() + if [ -z "$CHOICES" ]; then + finalFlags="noflag" + else + for CHOICE in $CHOICES; do + finalFlags="$finalFlags""${CHOICE}""," + done + finalFlags=${finalFlags::-1} + fi + menuItems+=("$finalFlags") + fi +} + +menuItems=() + +while [ 1 ] +do + menuItemsStr="" + for menuItem in ${menuItems[@]}; do + menuItemsStr="$menuItemsStr\n""$menuItem" + done + whiptail --msgbox "this is the list of grub menu entries:\ncluster,raid$menuItemsStr\n" 20 100 + CHOICE=$( + whiptail --title "grub menu" --cancel-button "exit" --menu "Make your choice:" 22 100 14 \ + "1)" "add grub entry (flag combinaison)" \ + "2)" "continue" \ + 3>&2 2>&1 1>&3 + ) + [[ "$?" = 1 ]] && break + + case $CHOICE in + "1)") addFlagCombination + ;; + "2)") break + ;; + esac +done + +echo "" > /tmp/seapathlistfai.txt +for menuItem in ${menuItems[@]}; do + echo "menuentry \"SEAPATH installation - $menuItem\" { + search --set=root --file /FAI-CD + linux /boot/vmlinuz FAI_FLAGS="$menuItem,verbose,sshd,createvt,reboot" FAI_ACTION=install FAI_CONFIG_SRC=file:///var/lib/fai/config rd.live.image root=live:CDLABEL=FAI_CD ipv6.disable=1 + initrd /boot/initrd.img +}" >> /tmp/seapathlistfai.txt +done + +sed -i -ne '/## BEGIN CUSTOM MENU ITEMS/ {p; r /tmp/seapathlistfai.txt' -e ':a; n; /## END CUSTOM MENU ITEMS/ {p; b}; ba}; p' $wd/etc_fai/grub.cfg +rm -f /tmp/seapathlistfai.txt + # Creating the NFSROOT # Removing *.profile since we don't use them # Removing 50-host-classes to prevent DEMO and FAIBASE to be added to the list of classes @@ -48,7 +128,7 @@ docker cp $wd/srv_fai_config/. fai-setup:/ext/srv/fai/config/ $COMPOSECMD -f $wd/docker-compose.yml down # Creating the mirror -CLASSES="FAIBASE,DEBIAN,GRUB_EFI,SEAPATH_COMMON,SEAPATH_HOST,SEAPATH_DBG,SEAPATH_KERBEROS,SEAPATH_COCKPIT" +CLASSES="FAIBASE,DEBIAN,GRUB_EFI,SEAPATH_COMMON,${finalClasses[@]}LAST" $COMPOSECMD -f $wd/docker-compose.yml run --rm fai-setup bash -c "\ cp /etc/fai/apt/keys/* /etc/apt/trusted.gpg.d/ &&\ fai-mirror -c $CLASSES /ext/mirror" diff --git a/etc_fai/grub.cfg b/etc_fai/grub.cfg index a29d485..234d001 100644 --- a/etc_fai/grub.cfg +++ b/etc_fai/grub.cfg @@ -1,5 +1,5 @@ ## grub2 configuration -set default="SEAPATH installation - no raid, no kerberos, no debug tools" +set default="SEAPATH installation - Cluster mode with RAID, English, no kerberos, no debug tools" set timeout=5 # make sure we can access partitions @@ -14,59 +14,26 @@ set color_highlight=red/black set menu_color_normal=white/black set menu_color_highlight=black/yellow -menuentry " +------------------------------------------------------+" { -set timeout=20 -} - -menuentry " | Fully Automatic Installation |" { -set timeout=20 - -} -menuentry " | _VERSIONSTRING_ |" --unrestricted { -set timeout=20 -} -menuentry " | (c) Thomas Lange lange@debian.org |" { -set timeout=20 -} -menuentry " +------------------------------------------------------+" { -set timeout=20 -} - -menuentry "" { -set timeout=20 -} - -menuentry "SEAPATH installation - select installation type from menu" { +menuentry "SEAPATH installation - Cluster mode with RAID, English, no kerberos, no debug tools" { search --set=root --file /FAI-CD - linux /boot/vmlinuz FAI_FLAGS="menu,verbose,sshd,createvt,reboot" FAI_ACTION=install FAI_CONFIG_SRC=file:///var/lib/fai/config rd.live.image root=live:CDLABEL=FAI_CD ipv6.disable=1 console=tty1 + linux /boot/vmlinuz FAI_FLAGS="cluster,raid,verbose,sshd,createvt,reboot" FAI_ACTION=install FAI_CONFIG_SRC=file:///var/lib/fai/config rd.live.image root=live:CDLABEL=FAI_CD ipv6.disable=1 console=tty1 initrd /boot/initrd.img } -menuentry "SEAPATH installation - no raid, no kerberos, no debug tools" { - search --set=root --file /FAI-CD - linux /boot/vmlinuz FAI_FLAGS="verbose,sshd,createvt,reboot" FAI_ACTION=install FAI_CONFIG_SRC=file:///var/lib/fai/config rd.live.image root=live:CDLABEL=FAI_CD ipv6.disable=1 console=tty1 - initrd /boot/initrd.img -} -menuentry "SEAPATH installation - RAID, no kerberos, no debug tools" { - search --set=root --file /FAI-CD - linux /boot/vmlinuz FAI_FLAGS="raid,verbose,sshd,createvt,reboot" FAI_ACTION=install FAI_CONFIG_SRC=file:///var/lib/fai/config rd.live.image root=live:CDLABEL=FAI_CD ipv6.disable=1 console=tty1 - initrd /boot/initrd.img -} -menuentry "SEAPATH installation - RAIDDEMO TTYS0, no kerberos, no debug tools" { - search --set=root --file /FAI-CD - linux /boot/vmlinuz FAI_FLAGS="raiddemo,verbose,sshd,createvt,reboot" FAI_ACTION=install FAI_CONFIG_SRC=file:///var/lib/fai/config rd.live.image root=live:CDLABEL=FAI_CD ipv6.disable=1 console=ttyS0 - initrd /boot/initrd.img -} -menuentry "SEAPATH installation - no raid, KERBEROS, no debug tools" { + +## BEGIN CUSTOM MENU ITEMS + +menuentry "SEAPATH installation - french,raid,cluster" { search --set=root --file /FAI-CD - linux /boot/vmlinuz FAI_FLAGS="kerberos,verbose,sshd,createvt,reboot" FAI_ACTION=install FAI_CONFIG_SRC=file:///var/lib/fai/config rd.live.image root=live:CDLABEL=FAI_CD ipv6.disable=1 console=tty1 + linux /boot/vmlinuz FAI_FLAGS=french,raid,cluster,verbose,sshd,createvt,reboot FAI_ACTION=install FAI_CONFIG_SRC=file:///var/lib/fai/config rd.live.image root=live:CDLABEL=FAI_CD ipv6.disable=1 initrd /boot/initrd.img } -menuentry "SEAPATH installation - no raid, no kerberos, DEBUG tools" { +menuentry "SEAPATH installation - noflag" { search --set=root --file /FAI-CD - linux /boot/vmlinuz FAI_FLAGS="dbg,verbose,sshd,createvt,reboot" FAI_ACTION=install FAI_CONFIG_SRC=file:///var/lib/fai/config rd.live.image root=live:CDLABEL=FAI_CD ipv6.disable=1 console=tty1 + linux /boot/vmlinuz FAI_FLAGS=noflag,verbose,sshd,createvt,reboot FAI_ACTION=install FAI_CONFIG_SRC=file:///var/lib/fai/config rd.live.image root=live:CDLABEL=FAI_CD ipv6.disable=1 initrd /boot/initrd.img } +## END CUSTOM MENU ITEMS menuentry "Boot OS from first partition on first disk" { if [ "$grub_platform" = "efi" ]; then diff --git a/srv_fai_config/class/99-seapath b/srv_fai_config/class/99-seapath index 9f418d2..4ccd2cb 100755 --- a/srv_fai_config/class/99-seapath +++ b/srv_fai_config/class/99-seapath @@ -3,11 +3,14 @@ # do not use this if a menu will be presented [ "$flag_menu" ] && exit 0 -echo DEBIAN FAIBASE FRENCH BOOKWORM64 SEAPATH_COMMON SEAPATH_HOST +echo DEBIAN FAIBASE BOOKWORM64 SEAPATH_COMMON SEAPATH_HOST +[ "$flag_french" ] && echo "FRENCH" +[ "$flag_cluster" ] && echo "SEAPATH_CLUSTER" [ "$flag_raid" ] && echo "SEAPATH_RAID" [ "$flag_raiddemo" ] && echo "SEAPATH_RAID SEAPATH_RAID_DEMO" [ "$flag_dbg" ] && echo "SEAPATH_DBG" [ "$flag_kerberos" ] && echo "SEAPATH_KERBEROS" +[ "$flag_cockpit" ] && echo "SEAPATH_COCKPIT" exit 0 diff --git a/srv_fai_config/package_config/SEAPATH_CLUSTER b/srv_fai_config/package_config/SEAPATH_CLUSTER new file mode 100644 index 0000000..cec9452 --- /dev/null +++ b/srv_fai_config/package_config/SEAPATH_CLUSTER @@ -0,0 +1,14 @@ +# This packages are specific to Cluster Mode +PACKAGES install-norec +ceph +ceph-base +ceph-common +ceph-mgr +ceph-mon +ceph-osd +corosync +crmsh +libcephfs2 +pacemaker +python3-ceph-argparse +python3-cephfs diff --git a/srv_fai_config/package_config/SEAPATH_HOST b/srv_fai_config/package_config/SEAPATH_HOST index 9430a0a..8295094 100644 --- a/srv_fai_config/package_config/SEAPATH_HOST +++ b/srv_fai_config/package_config/SEAPATH_HOST @@ -1,14 +1,6 @@ -# This packages are specific to the Host and should not be installed on the VM +# This packages are specific to the Host (Standalone or Cluster) and should not be installed on the VM PACKAGES install-norec busybox -ceph -ceph-base -ceph-common -ceph-mgr -ceph-mon -ceph-osd -corosync -crmsh firmware-amd-graphics firmware-misc-nonfree firmware-linux-nonfree @@ -16,7 +8,6 @@ firmware-linux-free gunicorn intel-cmt-cat ipmitool -libcephfs2 libvirt-clients libvirt-daemon libvirt-daemon-driver-storage-rbd @@ -26,9 +17,6 @@ msr-tools nginx ntfs-3g openvswitch-switch -pacemaker -python3-ceph-argparse -python3-cephfs python3-flaskext.wtf python3-xmltodict qemu-block-extra