Skip to content

Commit

Permalink
修复直接动需要按键问题,更新欢迎信息和引导类型输出格式
Browse files Browse the repository at this point in the history
  • Loading branch information
wjz304 committed Dec 6, 2024
1 parent df27459 commit dd5b312
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
16 changes: 9 additions & 7 deletions files/initrd/opt/rr/boot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ BUS=$(getBus "${LOADER_DISK}")
clear
COLUMNS=$(ttysize 2>/dev/null | awk '{print $1}')
COLUMNS=${COLUMNS:-80}
TITLE="$(printf "$(TEXT "Welcome to %s")" "$([ -z "${RR_RELEASE}" ] && echo "${RR_TITLE}" || echo "${RR_TITLE}(${RR_RELEASE})")")"
WTITLE="$(printf "$(TEXT "Welcome to %s")" "$([ -z "${RR_RELEASE}" ] && echo "${RR_TITLE}" || echo "${RR_TITLE}(${RR_RELEASE})")")"
DATE="$(date)"
printf "\033[1;44m%*s\n" "${COLUMNS}" ""
printf "\033[1;44m%*s\033[A\n" "${COLUMNS}" ""
printf "\033[1;31m%*s\033[0m\n" "$(((${#TITLE} + ${COLUMNS}) / 2))" "${TITLE}"
printf "\033[1;31m%*s\033[0m\n" "$(((${#WTITLE} + ${COLUMNS}) / 2))" "${WTITLE}"
printf "\033[1;44m%*s\033[A\n" "${COLUMNS}" ""
printf "\033[1;32m%*s\033[0m\n" "${COLUMNS}" "${DATE}"

TITLE="BOOTING:"
TITLE+="$([ ${EFI} -eq 1 ] && echo " [UEFI]" || echo " [BIOS]")"
TITLE+="$([ "${BUS}" = "usb" ] && echo " [${BUS^^} flashdisk]" || echo " [${BUS^^} DoM]")"
printf "\033[1;33m%*s\033[0m\n" $(((${#TITLE} + ${COLUMNS}) / 2)) "${TITLE}"
BTITLE="Boot Type:"
BTITLE+="$([ ${EFI} -eq 1 ] && echo " [UEFI]" || echo " [BIOS]")"
BTITLE+="$([ "${BUS}" = "usb" ] && echo " [${BUS^^} flashdisk]" || echo " [${BUS^^} DoM]")"
printf "\033[1;33m%*s\033[0m\n" $(((${#BTITLE} + ${COLUMNS}) / 2)) "${BTITLE}"

# Check if DSM zImage changed, patch it if necessary
ZIMAGE_HASH="$(readConfigKey "zimage-hash" "${USER_CONFIG_FILE}")"
Expand Down Expand Up @@ -264,7 +264,8 @@ function _bootwait() {

DIRECT="$(readConfigKey "directboot" "${USER_CONFIG_FILE}")"
if [ "${DIRECT}" = "true" ] || [ "${MEV:-physical}" = "parallels" ]; then
grub-editenv ${USER_GRUBENVFILE} set rr_version="$([ -z "${RR_RELEASE}" ] && echo "${RR_TITLE}" || echo "${RR_TITLE}(${RR_RELEASE})")"
grub-editenv ${USER_GRUBENVFILE} set rr_version="${WTITLE}"
grub-editenv ${USER_GRUBENVFILE} set rr_booting="${BTITLE}"
grub-editenv ${USER_GRUBENVFILE} set dsm_model="${MODEL}(${PLATFORM})"
grub-editenv ${USER_GRUBENVFILE} set dsm_version="${PRODUCTVER}(${BUILDNUM}$([ ${SMALLNUM:-0} -ne 0 ] && echo "u${SMALLNUM}"))"
grub-editenv ${USER_GRUBENVFILE} set dsm_kernel="${KERNEL}"
Expand All @@ -285,6 +286,7 @@ if [ "${DIRECT}" = "true" ] || [ "${MEV:-physical}" = "parallels" ]; then
exit 0
else
grub-editenv ${USER_GRUBENVFILE} unset rr_version
grub-editenv ${USER_GRUBENVFILE} unset rr_booting
grub-editenv ${USER_GRUBENVFILE} unset dsm_model
grub-editenv ${USER_GRUBENVFILE} unset dsm_version
grub-editenv ${USER_GRUBENVFILE} unset dsm_kernel
Expand Down
6 changes: 4 additions & 2 deletions files/mnt/p1/boot/grub/grub.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,12 @@ search --set=root --label "RR3"
if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
if [ "${default}" = "direct" ]; then
set timeout="1"
set pager=0
menuentry 'Boot DSM kernel directly' --id direct {
set_gfxpayload
echo "RR-version: ${rr_version}"
echo -n "bootuptime: "; date
echo "RRVersion: ${rr_version}"
echo "${rr_booting}"
echo -n "Boot Time: "; date
echo ""
echo "Model: ${dsm_model}"
echo "version: ${dsm_version}"
Expand Down

0 comments on commit dd5b312

Please sign in to comment.