menuhead(){ if [ -n $SERIAL_PORT ]; then SERIAL="SERIAL $SERIAL_PORT $SERIAL_SPEED" fi cat << EOF PATH $1 $SERIAL UI menu.c32 prompt 0 menu title BOOT MENU timeout 300 EOF } menulivehead(){ cat << EOF label - menu label Live Systems: menu disable EOF } menulive(){ cat << EOF label live menu label ${LIVE_NAME} menu default kernel /live/vmlinuz append initrd=/live/initrd.img boot=live EOF } menulivepxe(){ # FETCH # ftp, http, tftp if [ -n "$PXE_HTTP_BASE" ] then PXE_FETCH_HTTP="http://${PXE_SERVER}:${PXE_HTTP_PORT}${PXE_HTTP_BASE}" fi if [ -n "$PXE_FTP_BASE" ] then PXE_FETCH_FTP="ftp://${PXE_SERVER}${PXE_FTP_BASE}" fi if [ -n "$PXE_TFTP_BASE" ] then PXE_FETCH_TFTP="tftp://${PXE_SERVER}${PXE_TFTP_BASE}" fi num=$(echo "$PXE_FETCH_FTP $PXE_FETCH_HTTP $PXE_FETCH_TFTP" | wc -w) if [ $num -gt 1 ];then cat << EOF menu begin live-menu menu label ${LIVE_NAME} menu title ${LIVE_NAME} BOOT EOF fi if [ -n "$PXE_FETCH_FTP" ]; then cat << EOF label live-ftp menu label ${LIVE_NAME} (FTP) kernel /live/vmlinuz append initrd=/live/initrd.img boot=live fetch=${PXE_FETCH_FTP}live/filesystem.squashfs TEXT HELP Boot ${LIVE_NAME} via ftp. ${LIVE_DESC} ENDTEXT EOF fi if [ -n "$PXE_FETCH_HTTP" ]; then cat << EOF label live-http menu label ${LIVE_NAME} (HTTP) kernel /live/vmlinuz append initrd=/live/initrd.img boot=live fetch=${PXE_FETCH_HTTP}live/filesystem.squashfs TEXT HELP Boot ${LIVE_NAME} via http. ${LIVE_DESC} ENDTEXT EOF fi if [ -n "$PXE_FETCH_TFTP" ]; then cat << EOF label live-tftp menu label ${LIVE_NAME} (TFTP) kernel /live/vmlinuz append initrd=/live/initrd.img boot=live fetch=${PXE_FETCH_TFTP}live/filesystem.squashfs TEXT HELP Boot ${LIVE_NAME} via tftp, this is the slowest option. ${DESC_LIVE} ENDTEXT EOF fi if [ $num -gt 1 ];then cat << EOF label exit-live-menu menu label Exit menu exit menu end EOF fi } menuhwhead(){ cat << EOF menu separator label - menu label Hardware tools: menu disable EOF } menuhwhdt(){ cat << EOF label hdt menu label ^Hardware Detection Tool (HDT) kernel hdt.c32 text help HDT displays low-level information about the systems hardware. endtext EOF } menuhwmemtest(){ cat << EOF label memtest86+ menu label ^Memory Failure Detection (memtest86+) kernel /memtest EOF } menuinstallerhead(){ cat << EOF menu separator label - menu label Installer: menu disable EOF } menuinstaller(){ dist=$1 cat << EOF menu begin $dist-installer-menu menu label ${dist^} Installer menu title ${dist^^} INSTALLER EOF sed -r -e "s/(default .*)//g" \ -e "s/(label) ([a-z]+)/\1 \2-${dist}/g" \ -e "s/(${dist}-installer)/\/\1/g" \ $WORKDIR/INSTALLER/${dist}.cfg if [ -n "$SERIAL_PORT" ]; then sed -r -e "s/(default .*)//g" \ -e "s/(label) ([a-z]+)/\1 \2-${dist}-serial/g" \ -e "s/(menu label .*)/\1 with Serial Console/g" \ -e "s/(${dist}-installer)/\/\1/g" \ -e "/menu default/d" \ -e "s/(append.+)(--- quiet)/\1console=ttyS${SERIAL_PORT},${SERIAL_SPEED}n8 \2/" \ $WORKDIR/INSTALLER/${dist}.cfg fi cat << EOF label exit-${dist}-installer menu label Exit menu exit menu end EOF } menuarchlive(){ archbasedir=$ARCH_BASEDIR localarchpath=$ARCH_LOCALPATH if [ -n "$localarchpath" ] && [ -d $localarchpath/$archisobasedir ]; then sed -r -e "s~boot~/${archbasedir}/boot~g" \ -n -e '/arch64_http/,/^$/p' \ ${localarchpath}${archbasedir}/boot/syslinux/archiso_pxe.cfg else #echo "http://${ARCHISO_SERVER}${ARCHISO_HTTP_BASE}/${archbasedir}/boot/syslinux/archiso_pxe.cfg" 1>&2 archiso_pxe_url=http://${ARCHISO_SERVER}:${ARCHISO_HTTP_PORT}${ARCHISO_HTTP_BASE}/${archbasedir}/boot/syslinux/archiso_pxe.cfg edebug "Try to download $archiso_pxe_url" curl -s $archiso_pxe_url | sed -r \ -e "s/Boot Arch/Arch/g" \ -e "s~boot~/${archbasedir}/boot~g" \ -e "s~basedir=arch~basedir=${ARCHISO_HTTP_BASE}/${ARCH_BASEDIR}~g" \ -e "s/\\$\{pxeserver\}/${ARCHISO_SERVER}:${ARCHISO_HTTP_PORT}/g" \ -e 's/^(APPEND .*)$/\1 ip=dhcp/g' \ -e "s/^SYSAPPEND [0-9]+/SYSAPPEND 2/g" \ -n -e '/arch64_http/,/^$/p' if [ "${PIPESTATUS[0]}" -ne 0 ]; then eerr "Failed to download archiso_pxe.cfg" fi fi }