diff --git a/Makefile b/Makefile index 8a97c37..be87f77 100644 --- a/Makefile +++ b/Makefile @@ -24,12 +24,11 @@ shellcheck: echo " done."; \ clean: - rm -f templates/boot/grub/sipwise_*.cfg templates/boot/isolinux/sipwise_*.cfg - rm -f templatese/boot/isolinux/syslinux.cfg - rm -f templates/boot/grub/sipwise_*.cfg templates/boot/isolinux/sipwise_*.cfg rm -f templates/boot/isolinux/syslinux.cfg rm -rf templates/scripts/includes/netscript rm -f templates/scripts/includes/sipwise.gpg + rm -f templates/boot/grub/grub.cfg + rm -f templates/boot/isolinux/isolinux.cfg dist-clean: clean rm -rf artifacts diff --git a/build_iso.sh b/build_iso.sh index 6038d68..e62aaf3 100755 --- a/build_iso.sh +++ b/build_iso.sh @@ -6,11 +6,13 @@ DATE="$(date +%Y%m%d_%H%M%S)" WGET_OPT="--timeout=30 -q -c" RELEASE="$1" GRML_ISO="$2" +MR="$3" +DIST="$4" TEMPLATES="templates" usage () { - echo "Usage: $0 daily|private|public " - echo "Sample: $0 'daily' 'grml64-full_testing_latest.iso'" + echo "Usage: $0 daily|private|public " + echo "Sample: $0 'daily' 'grml64-full_testing_latest.iso' mr6.2.1 stretch" exit 1 } @@ -20,23 +22,28 @@ check_sha1 () { sha1sum -c "${_GRML_ISO}.sha1" } +if [ -z "${MR}" ]; then + echo "Parameter is missing" >&2 + usage +elif [ -z "${DIST}" ]; then + echo "Parameter is missing" >&2 + usage +fi + echo "*** Building ${RELEASE} ISO ***" case ${RELEASE} in daily) - MR="yes" SIPWISE_ISO="grml64-sipwise-daily_${DATE}.iso" GRML_URL="http://daily.grml.org/grml64-full_testing/latest/" GRML_HASH_URL="${GRML_URL}" ;; private) - MR="no" SIPWISE_ISO="grml64-sipwise-release_${DATE}.iso" GRML_URL="https://deb.sipwise.com/files/grml/" GRML_HASH_URL="http://download.grml.org/" ;; public) - MR="no" SIPWISE_ISO="sip_provider_CE_installcd.iso" GRML_URL="https://deb.sipwise.com/files/grml/" GRML_HASH_URL="http://download.grml.org/" @@ -75,14 +82,14 @@ else check_sha1 "${GRML_ISO}" fi +# build grub.cfg release options +echo "*** Building templates [TEMPLATES=${TEMPLATES} MR=${MR}] ***" +TEMPLATES="${TEMPLATES}" MR="${MR}" DIST="${DIST}" ./build_templates.sh + # make sure syslinux.cfg is same as isolinux.cfg so grml2usb works also echo "*** Copying isolinux.cfg to syslinux.cfg for grml2usb support ***" cp ${TEMPLATES}/boot/isolinux/isolinux.cfg ${TEMPLATES}/boot/isolinux/syslinux.cfg -# build grub.cfg release options -echo "*** Building templates [TEMPLATES=${TEMPLATES} MR=${MR}] ***" -TEMPLATES="${TEMPLATES}" MR="${MR}" ./build_templates.sh - echo "*** Generating Sipwise ISO ***" sudo /usr/sbin/grml2iso -c ./${TEMPLATES} -o "${SIPWISE_ISO}" "${GRML_ISO}" diff --git a/build_templates.sh b/build_templates.sh index 0aaabf5..43c5da9 100755 --- a/build_templates.sh +++ b/build_templates.sh @@ -4,43 +4,17 @@ BASE="$(dirname "$0")" TEMPLATES="${TEMPLATES:-templates}" BOOT="${BASE}/${TEMPLATES}/boot" -RELEASES=($(grep -v '#' "${BASE}"/releases | cut -d, -f1 )) -DISTS=($(grep -v '#' "${BASE}"/releases |cut -d, -f2 )) -CARRIER=($(grep -v '#' "${BASE}"/releases |cut -d, -f3 )) -MR="${MR:-no}" +MR="${MR:-trunk}" +DIST="${DIST:-stretch}" -rm -f "${BOOT}/grub/sipwise_*.cfg" -rm -f "${BOOT}/isolinux/sipwise_*.cfg" +echo "*** grub templates for RELEASE:${MR} DIST:${DIST} ***" -for index in ${!RELEASES[*]}; do - if [[ ${RELEASES[$index]} =~ ^mr[0-9]\.[0-9]$ ]] && [ "${MR}" = "no" ]; then - echo "*** [SKIP] grub template for RELEASE:${RELEASES[$index]} DIST:${DISTS[$index]} ***" - echo "*** [SKIP] isolinux template for RELEASE:${RELEASES[$index]} DIST:${DISTS[$index]} ***" - else - echo "*** grub template for RELEASE:${RELEASES[$index]} DIST:${DISTS[$index]} CARRIER:${CARRIER[$index]} ***" - sed -e "s_##VERSION##_${RELEASES[$index]}_g" \ - -e "s_##DIST##_${DISTS[$index]}_g" \ - "${BASE}/grub.cfg_ce" >> "${BOOT}/grub/sipwise_ce.cfg" - sed -e "s_##VERSION##_${RELEASES[$index]}_g" \ - -e "s_##DIST##_${DISTS[$index]}_g" \ - "${BASE}/grub.cfg_pro" >> "${BOOT}/grub/sipwise_pro.cfg" - if [ "${CARRIER[$index]}" == "yes" ]; then - sed -e "s_##VERSION##_${RELEASES[$index]}_g" \ - -e "s_##DIST##_${DISTS[$index]}_g" \ - "${BASE}/grub.cfg_carrier" >> "${BOOT}/grub/sipwise_carrier.cfg" - fi +sed -e "s_##VERSION##_${MR}_g" \ + -e "s_##DIST##_${DIST}_g" \ + "${BASE}/grub.cfg" > "${BOOT}/grub/grub.cfg" - echo "*** isolinux template for RELEASE:${RELEASES[$index]} DIST:${DISTS[$index]} CARRIER:${CARRIER[$index]} ***" - sed -e "s_##VERSION##_${RELEASES[$index]}_g" \ - -e "s_##DIST##_${DISTS[$index]}_g" "${BASE}/isolinux.cfg_ce" \ - >> "${BOOT}/isolinux/sipwise_ce.cfg" - sed -e "s_##VERSION##_${RELEASES[$index]}_g" \ - -e "s_##DIST##_${DISTS[$index]}_g" "${BASE}/isolinux.cfg_pro" \ - >> "${BOOT}/isolinux/sipwise_pro.cfg" - if [ "${CARRIER[$index]}" == "yes" ]; then - sed -e "s_##VERSION##_${RELEASES[$index]}_g" \ - -e "s_##DIST##_${DISTS[$index]}_g" "${BASE}/isolinux.cfg_carrier" \ - >> "${BOOT}/isolinux/sipwise_carrier.cfg" - fi - fi -done +echo "*** isolinux templates for RELEASE:${MR} DIST:${DIST} ***" + +sed -e "s_##VERSION##_${MR}_g" \ + -e "s_##DIST##_${DIST}_g" \ + "${BASE}/isolinux.cfg" > "${BOOT}/isolinux/isolinux.cfg" diff --git a/templates/boot/grub/grub.cfg b/grub.cfg similarity index 87% rename from templates/boot/grub/grub.cfg rename to grub.cfg index 75d0145..3eb4f13 100644 --- a/templates/boot/grub/grub.cfg +++ b/grub.cfg @@ -10,54 +10,34 @@ menuentry "Rescue system boot (%VERSION%)" { initrd /boot/%SHORT_NAME%/initrd.img } -submenu "Specific sip:providerCE releases ... ->" --class=submenu { - -menuentry "sip:providerCE - trunk version" { +menuentry "##VERSION## sip:providerCE" { echo 'Loading kernel...' - linux /boot/%SHORT_NAME%/vmlinuz live-media-path=/live/%GRML_NAME%/ boot=live bootid=%BOOTID% apm=power-off mgag200.modeset=0 vga=791 quiet nomce net.ifnames=0 ngcpce ssh=sipwise debianrelease=stretch scripts ngcphostname=spce ngcpvers=trunk nodhcp + linux /boot/%SHORT_NAME%/vmlinuz live-media-path=/live/%GRML_NAME%/ boot=live bootid=%BOOTID% apm=power-off mgag200.modeset=0 vga=791 quiet nomce net.ifnames=0 ngcpce ssh=sipwise debianrelease=##DIST## scripts ngcphostname=spce ngcpvers=##VERSION## nodhcp echo 'Loading initrd...' initrd /boot/%SHORT_NAME%/initrd.img } -source /boot/grub/sipwise_ce.cfg - -} # Specific sip:providerCE releases ... - -## begin of PRO menu {{{ -submenu "Specific sip:providerPRO releases ... ->" --class=submenu { - -menuentry "sip:providerPRO - sp1 / trunk release" { +menuentry "##VERSION## sip:providerPRO (sp1)" { echo 'Loading kernel...' - linux /boot/%SHORT_NAME%/vmlinuz live-media-path=/live/%GRML_NAME%/ boot=live bootid=%BOOTID% apm=power-off mgag200.modeset=0 vga=791 quiet nomce net.ifnames=0 ngcppro ssh=sipwise debianrelease=stretch scripts ngcpsp1 ngcpvers=trunk nodhcp + linux /boot/%SHORT_NAME%/vmlinuz live-media-path=/live/%GRML_NAME%/ boot=live bootid=%BOOTID% apm=power-off mgag200.modeset=0 vga=791 quiet nomce net.ifnames=0 ngcppro ssh=sipwise debianrelease=##DIST## scripts ngcpsp1 ngcpvers=##VERSION## nodhcp echo 'Loading initrd...' initrd /boot/%SHORT_NAME%/initrd.img } -menuentry "sip:providerPRO - sp2 / trunk release" { +menuentry "##VERSION## sip:providerPRO (sp2)" { echo 'Loading kernel...' - linux /boot/%SHORT_NAME%/vmlinuz live-media-path=/live/%GRML_NAME%/ boot=live bootid=%BOOTID% apm=power-off mgag200.modeset=0 vga=791 quiet nomce net.ifnames=0 ngcppro ssh=sipwise debianrelease=stretch scripts ngcpsp2 ngcpvers=trunk nodhcp + linux /boot/%SHORT_NAME%/vmlinuz live-media-path=/live/%GRML_NAME%/ boot=live bootid=%BOOTID% apm=power-off mgag200.modeset=0 vga=791 quiet nomce net.ifnames=0 ngcppro ssh=sipwise debianrelease=##DIST## scripts ngcpsp2 ngcpvers=##VERSION## nodhcp echo 'Loading initrd...' initrd /boot/%SHORT_NAME%/initrd.img } -source /boot/grub/sipwise_pro.cfg - -} # Specific sip:providerPRO releases - -## begin of Carrier menu {{{ -submenu "Specific sip:Carrier releases ... ->" --class=submenu { - -menuentry "sip:Carrier mgmt (web01a) / trunk" { +menuentry "##VERSION## sip:Carrier (web01a)" { echo 'Loading kernel...' - linux /boot/%SHORT_NAME%/vmlinuz live-media-path=/live/%GRML_NAME%/ boot=live bootid=%BOOTID% apm=power-off mgag200.modeset=0 vga=791 quiet nomce net.ifnames=0 ngcppro ssh=sipwise debianrelease=stretch scripts ngcpsp1 ngcpfillcache ngcpnonwrecfg ngcpvers=trunk nodhcp ngcpcrole=mgmt ngcphostname=web01a + linux /boot/%SHORT_NAME%/vmlinuz live-media-path=/live/%GRML_NAME%/ boot=live bootid=%BOOTID% apm=power-off mgag200.modeset=0 vga=791 quiet nomce net.ifnames=0 ngcppro ssh=sipwise debianrelease=##DIST## scripts ngcpsp1 ngcpnonwrecfg ngcpfillcache ngcpvers=##VERSION## nodhcp ngcpcrole=mgmt ngcphostname=web01a echo 'Loading initrd...' initrd /boot/%SHORT_NAME%/initrd.img } -source /boot/grub/sipwise_carrier.cfg - -} # Specific sip:providerCarrier 3.x releases - ## submenus submenu "Install Debian ... ->" --class=submenu { diff --git a/templates/boot/isolinux/isolinux.cfg b/isolinux.cfg similarity index 88% rename from templates/boot/isolinux/isolinux.cfg rename to isolinux.cfg index fea9e3b..6ad9643 100644 --- a/templates/boot/isolinux/isolinux.cfg +++ b/isolinux.cfg @@ -53,112 +53,51 @@ label grml ## CE/PRO submenu menu separator -label - -menu label Install specific versions of CE/PRO/Carrier -menu disable - -## begin of CE menu {{{ -menu begin ce-options -menu title Specific sip:providerCE releases ... - -label mainmenu -menu label ^Back to main menu... -menu exit -menu separator - -label cetrunk - menu label sip:providerCE - trunk version +label ce##VERSION## + menu label ##VERSION## sip:providerCE kernel /boot/%SHORT_NAME%/vmlinuz - append initrd=/boot/%SHORT_NAME%/initrd.img live-media-path=/live/%GRML_NAME%/ boot=live bootid=%BOOTID% apm=power-off mgag200.modeset=0 vga=791 quiet nomce net.ifnames=0 ngcpce ssh=sipwise debianrelease=stretch scripts ngcphostname=spce ngcpvers=trunk nodhcp + append initrd=/boot/%SHORT_NAME%/initrd.img live-media-path=/live/%GRML_NAME%/ boot=live bootid=%BOOTID% apm=power-off mgag200.modeset=0 vga=791 quiet nomce net.ifnames=0 ngcpce ssh=sipwise debianrelease=##DIST## scripts ngcphostname=spce ngcpvers=##VERSION## nodhcp text help Install sip:provider community edition, - trunk version. + version ##VERSION##. endtext -include sipwise_ce.cfg - -# back to main menu -label quit -menu hide -kernel isolinux.bin - -menu end -## end of CE menu }}} - -## begin of PRO menu {{{ -menu begin pro-options -menu title Specific sip:providerPRO releases ... - -label mainmenu -menu label ^Back to main menu... -menu exit -menu separator - -label prosp1-trunk - menu label sip:providerPRO - sp1 / trunk release +label prosp1-##VERSION## + menu label ##VERSION## sip:providerPRO (sp1) kernel /boot/%SHORT_NAME%/vmlinuz - append initrd=/boot/%SHORT_NAME%/initrd.img live-media-path=/live/%GRML_NAME%/ boot=live bootid=%BOOTID% apm=power-off mgag200.modeset=0 vga=791 quiet nomce net.ifnames=0 ngcppro ssh=sipwise debianrelease=stretch scripts ngcpsp1 ngcpvers=trunk nodhcp + append initrd=/boot/%SHORT_NAME%/initrd.img live-media-path=/live/%GRML_NAME%/ boot=live bootid=%BOOTID% apm=power-off mgag200.modeset=0 vga=791 quiet nomce net.ifnames=0 ngcppro ssh=sipwise debianrelease=##DIST## scripts ngcpsp1 ngcpvers=##VERSION## nodhcp text help Install sip:provider - professional edition, trunk version. + professional edition, version ##VERSION##. Install first node of HA setup. endtext -label prosp2-trunk - menu label sip:providerPRO - sp2 / trunk release +label prosp2-##VERSION## + menu label ##VERSION## sip:providerPRO (sp2) kernel /boot/%SHORT_NAME%/vmlinuz - append initrd=/boot/%SHORT_NAME%/initrd.img live-media-path=/live/%GRML_NAME%/ boot=live bootid=%BOOTID% apm=power-off mgag200.modeset=0 vga=791 quiet nomce net.ifnames=0 ngcppro ssh=sipwise debianrelease=stretch scripts ngcpsp2 ngcpvers=trunk nodhcp + append initrd=/boot/%SHORT_NAME%/initrd.img live-media-path=/live/%GRML_NAME%/ boot=live bootid=%BOOTID% apm=power-off mgag200.modeset=0 vga=791 quiet nomce net.ifnames=0 ngcppro ssh=sipwise debianrelease=##DIST## scripts ngcpsp2 ngcpvers=##VERSION## nodhcp text help Install sip:provider - professional edition, trunk version. + professional edition, version ##VERSION##. Install second node of HA setup. endtext -include sipwise_pro.cfg -# back to main menu -label quit -menu hide -kernel isolinux.bin - -menu end -## end of PRO menu }}} - -## begin of CARRIER menu {{{ -menu begin pro-options -menu title Specific sip:Carrier 3.X releases ... - -label mainmenu -menu label ^Back to main menu... -menu exit -menu separator - -label carrierweb01atrunk - menu label sip:Carrier mgmt/web01a / trunk +label carrier##VERSION## + menu label ##VERSION## sip:Carrier (web01a) kernel /boot/%SHORT_NAME%/vmlinuz - append initrd=/boot/%SHORT_NAME%/initrd.img live-media-path=/live/%GRML_NAME%/ boot=live bootid=%BOOTID% apm=power-off mgag200.modeset=0 vga=791 quiet nomce net.ifnames=0 ngcppro ssh=sipwise debianrelease=stretch scripts ngcpsp1 ngcpvers=trunk nodhcp ngcpnonwrecfg ngcpfillcache ngcpcrole=mgmt ngcphostname=web01a + append initrd=/boot/%SHORT_NAME%/initrd.img live-media-path=/live/%GRML_NAME%/ boot=live bootid=%BOOTID% apm=power-off mgag200.modeset=0 vga=791 quiet nomce net.ifnames=0 ngcppro ssh=sipwise debianrelease=##DIST## scripts ngcpsp1 ngcpfillcache ngcpvers=##VERSION## nodhcp ngcpnonwrecfg ngcpcrole=mgmt ngcphostname=web01a text help - Install sip:Carrier edition (trunk). + Install sip:Carrier version ##VERSION##. Install web01a node of Carrier setup. Other nodes will be installed from web01a. endtext -include sipwise_carrier.cfg - -# back to main menu -label quit -menu hide -kernel isolinux.bin - -menu end -## end of CARRIER menu }}} - - ## begin of Debian menu {{{ menu separator