mklive/scripts/menufunction.sh

243 lines
4.0 KiB
Bash
Raw Normal View History

2018-05-21 12:41:52 +00:00
2018-05-31 10:59:56 +00:00
menuhead(){
2018-05-21 12:41:52 +00:00
if [ -n $SERIAL_PORT ]; then
SERIAL="SERIAL $SERIAL_PORT $SERIAL_SPEED"
fi
2018-11-06 22:29:48 +00:00
2018-05-21 12:41:52 +00:00
cat << EOF
2018-11-06 22:29:48 +00:00
PATH $1
2018-05-21 12:41:52 +00:00
$SERIAL
UI menu.c32
prompt 0
menu title BOOT MENU
timeout 300
EOF
}
2018-05-31 10:59:56 +00:00
menulivehead(){
2018-05-21 12:41:52 +00:00
cat << EOF
label -
menu label Live Systems:
menu disable
EOF
}
2018-05-31 10:59:56 +00:00
menulive(){
2018-05-21 12:41:52 +00:00
cat << EOF
label live
menu label ${LIVE_NAME}
menu default
2018-11-06 22:29:48 +00:00
kernel /live/vmlinuz
append initrd=/live/initrd.img boot=live
2018-05-21 12:41:52 +00:00
EOF
}
2018-05-31 10:59:56 +00:00
menulivepxe(){
2018-05-21 12:41:52 +00:00
# FETCH
# ftp, http, tftp
2018-05-27 13:07:46 +00:00
if [ -n "$PXE_HTTP_BASE" ]
then
PXE_FETCH_HTTP="http://${PXE_SERVER}${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
2018-05-27 14:05:28 +00:00
PXE_FETCH_TFTP="tftp://${PXE_SERVER}${PXE_TFTP_BASE}"
2018-05-27 13:07:46 +00:00
fi
2018-05-21 12:41:52 +00:00
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
2018-05-27 16:58:59 +00:00
label live-ftp
2018-05-27 16:15:04 +00:00
menu label ${LIVE_NAME} (FTP)
2018-11-06 22:29:48 +00:00
kernel /live/vmlinuz
append initrd=/live/initrd.img boot=live fetch=${PXE_FETCH_FTP}live/filesystem.squashfs
2018-05-27 16:15:04 +00:00
TEXT HELP
2018-05-27 16:58:59 +00:00
Boot ${LIVE_NAME} via ftp.
2018-05-27 16:15:04 +00:00
${LIVE_DESC}
2018-05-27 16:58:59 +00:00
ENDTEXT
2018-05-21 12:41:52 +00:00
EOF
fi
if [ -n "$PXE_FETCH_HTTP" ]; then
cat << EOF
2018-05-27 16:58:59 +00:00
label live-http
2018-05-27 16:15:04 +00:00
menu label ${LIVE_NAME} (HTTP)
2018-11-06 22:29:48 +00:00
kernel /live/vmlinuz
append initrd=/live/initrd.img boot=live fetch=${PXE_FETCH_HTTP}live/filesystem.squashfs
2018-05-27 16:15:04 +00:00
TEXT HELP
2018-05-27 16:58:59 +00:00
Boot ${LIVE_NAME} via http.
2018-05-27 16:15:04 +00:00
${LIVE_DESC}
ENDTEXT
2018-05-21 12:41:52 +00:00
EOF
fi
if [ -n "$PXE_FETCH_TFTP" ]; then
cat << EOF
2018-05-27 16:58:59 +00:00
label live-tftp
2018-05-27 16:15:04 +00:00
menu label ${LIVE_NAME} (TFTP)
2018-11-06 22:29:48 +00:00
kernel /live/vmlinuz
append initrd=/live/initrd.img boot=live fetch=${PXE_FETCH_TFTP}live/filesystem.squashfs
2018-05-27 16:15:04 +00:00
TEXT HELP
2018-05-27 16:58:59 +00:00
Boot ${LIVE_NAME} via tftp, this is the slowest option.
2018-05-27 16:15:04 +00:00
${DESC_LIVE}
ENDTEXT
2018-05-21 12:41:52 +00:00
EOF
fi
if [ $num -gt 1 ];then
cat << EOF
2018-05-27 16:58:59 +00:00
label exit-live-menu
2018-05-21 12:41:52 +00:00
menu label Exit
menu exit
menu end
EOF
fi
}
2018-05-31 10:59:56 +00:00
menuhwhead(){
2018-05-21 12:41:52 +00:00
cat << EOF
2018-05-27 16:15:04 +00:00
menu separator
2018-05-21 12:41:52 +00:00
label -
menu label Hardware tools:
menu disable
EOF
}
2018-05-31 10:59:56 +00:00
menuhwhdt(){
2018-05-21 12:41:52 +00:00
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
}
2018-05-31 10:59:56 +00:00
menuhwmemtest(){
2018-05-21 12:41:52 +00:00
cat << EOF
label memtest86+
menu label ^Memory Failure Detection (memtest86+)
2018-11-06 22:29:48 +00:00
kernel /memtest
2018-05-21 12:41:52 +00:00
EOF
}
2018-05-31 10:59:56 +00:00
menuinstallerhead(){
2018-05-21 12:41:52 +00:00
cat << EOF
2018-05-27 16:15:04 +00:00
menu separator
2018-05-21 12:41:52 +00:00
label -
menu label Installer:
menu disable
EOF
}
2018-05-31 10:59:56 +00:00
menuinstaller(){
2018-05-21 12:41:52 +00:00
dist=$1
cat << EOF
menu begin $dist-installer-menu
menu label ${dist^} Installer
2018-05-22 19:41:55 +00:00
menu title ${dist^^} INSTALLER
2018-05-21 12:41:52 +00:00
EOF
sed -r -e "s/(default .*)//g" \
-e "s/(label) ([a-z]+)/\1 \2-${dist}/g" \
2018-11-06 22:29:48 +00:00
-e "s/(${dist}-installer)/\/\1/g" \
2018-05-21 12:41:52 +00:00
$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" \
2018-11-06 22:29:48 +00:00
-e "s/(${dist}-installer)/\/\1/g" \
2018-05-21 12:41:52 +00:00
-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
}
2018-05-27 13:07:46 +00:00
menuarchlive(){
archbasedir=$ARCH_BASEDIR
localarchpath=$ARCH_LOCALPATH
if [ -n "$localarchpath" ] && [ -d $localarchpath/$archisobasedir ];
then
2018-11-06 22:29:48 +00:00
sed -r -e "s~boot~/${archbasedir}/boot~g" \
-n -e '/arch64_http/,/^$/p' \
${localarchpath}${archbasedir}/boot/syslinux/archiso_pxe.cfg
2018-05-27 13:07:46 +00:00
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 \
2018-11-06 22:29:48 +00:00
-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" \
2018-11-06 22:29:48 +00:00
-e 's/^(APPEND .*)$/\1 ip=dhcp/g' \
-e "s/^SYSAPPEND [0-9]+/SYSAPPEND 2/g" \
2018-05-27 13:07:46 +00:00
-n -e '/arch64_http/,/^$/p'
if [ "${PIPESTATUS[0]}" -ne 0 ];
then
eerr "Failed to download archiso_pxe.cfg"
fi
2018-05-27 13:07:46 +00:00
fi
}