boot: add option to customize

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-10-25 19:36:40 +02:00
parent 3f916ce79e
commit 138d683318
4 changed files with 64 additions and 17 deletions

View File

@ -68,7 +68,7 @@ function addonSelection() {
declare -A ADDONS
writeConfigKey "addons" "{}" "${USER_CONFIG_FILE}"
for ADDON in ${resp}; do
USERADDONS["${ADDON}"]=""
ADDONS["${ADDON}"]=""
writeConfigKey "addons.\"${ADDON}\"" "" "${USER_CONFIG_FILE}"
done
ADDONSINFO="$(readConfigEntriesArray "addons" "${USER_CONFIG_FILE}")"
@ -2104,4 +2104,35 @@ function genHardwareID() {
exit 1
fi
return
}
###############################################################################
# Bootsreen Menu
function bootScreen () {
rm -f "${TMP_PATH}/boot" "${TMP_PATH}/opts" "${TMP_PATH}/resp" >/dev/null
unset BOOTSCREENS
declare -A BOOTSCREENS
while IFS=': ' read -r KEY VALUE; do
[ -n "${KEY}" ] && BOOTSCREENS["${KEY}"]="${VALUE}"
done < <(readConfigMap "boot" "${USER_CONFIG_FILE}")
echo -e "dsminfo" >"${TMP_PATH}/boot"
echo -e "systeminfo" >>"${TMP_PATH}/boot"
echo -e "diskinfo" >>"${TMP_PATH}/boot"
echo -e "dsmlogo" >>"${TMP_PATH}/boot"
while read -r BOOTSCREEN; do
arrayExistItem "${BOOTSCREEN}" "${!BOOTSCREENS[@]}" && ACT="on" || ACT="off"
echo -e "${BOOTSCREEN} \"${DESC}\" ${ACT}" >>"${TMP_PATH}/opts"
done < <(cat "${TMP_PATH}/boot")
dialog --backtitle "$(backtitle)" --title "Bootscreen" --colors --aspect 18 \
--checklist "Select Bootscreen Informations\Zn\nSelect with SPACE, Confirm with ENTER!" 0 0 0 \
--file "${TMP_PATH}/opts" 2>"${TMP_PATH}/resp"
[ $? -ne 0 ] && return 1
resp=$(cat ${TMP_PATH}/resp)
unset BOOTSCREENS
declare -A BOOTSCREENS
writeConfigKey "boot" "{}" "${USER_CONFIG_FILE}"
for BOOTSCREEN in ${resp}; do
BOOTSCREENS["${BOOTSCREEN}"]=""
writeConfigKey "boot.\"${BOOTSCREEN}\"" "true" "${USER_CONFIG_FILE}"
done
}

View File

@ -945,7 +945,8 @@ else
if [ "${LOADEROPTS}" == "true" ]; then
echo "= \"\Z4========= Loader =========\Zn \" " >>"${TMP_PATH}/menu"
echo "= \"\Z1=== Edit with caution! ===\Zn \" " >>"${TMP_PATH}/menu"
echo "D \"StaticIP for Loader/DSM\" " >>"${TMP_PATH}/menu"
echo "D \"StaticIP for Loader/DSM \" " >>"${TMP_PATH}/menu"
echo "f \"Bootscreen Options \" " >>"${TMP_PATH}/menu"
echo "W \"RD Compression: \Z4${RD_COMPRESSED}\Zn \" " >>"${TMP_PATH}/menu"
echo "X \"Sata DOM: \Z4${SATADOM}\Zn \" " >>"${TMP_PATH}/menu"
echo "u \"LKM Version: \Z4${LKM}\Zn \" " >>"${TMP_PATH}/menu"
@ -1089,6 +1090,7 @@ else
NEXT="8"
;;
D) staticIPMenu; NEXT="D" ;;
f) bootScreen; NEXT="f" ;;
W) [ "${RD_COMPRESSED}" == "true" ] && RD_COMPRESSED='false' || RD_COMPRESSED='true'
writeConfigKey "rd-compressed" "${RD_COMPRESSED}" "${USER_CONFIG_FILE}"
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"

View File

@ -8,7 +8,6 @@ set -e
# Clear logs for dbgutils addons
rm -rf "${PART1_PATH}/logs" >/dev/null 2>&1 || true
rm -rf /sys/fs/pstore/* >/dev/null 2>&1 || true
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
[ "${BUILDDONE}" == "false" ] && die "Loader build not completed!"
@ -57,18 +56,30 @@ LKM="$(readConfigKey "lkm" "${USER_CONFIG_FILE}")"
CPU="$(echo $(cat /proc/cpuinfo 2>/dev/null | grep 'model name' | uniq | awk -F':' '{print $2}'))"
RAMTOTAL="$(awk '/MemTotal:/ {printf "%.0f\n", $2 / 1024 / 1024 + 0.5}' /proc/meminfo 2>/dev/null)"
VENDOR="$(dmesg 2>/dev/null | grep -i "DMI:" | head -1 | sed 's/\[.*\] DMI: //i')"
DSMINFO="$(readConfigKey "boot.dsminfo" "${USER_CONFIG_FILE}")"
SYSTEMINFO="$(readConfigKey "boot.systeminfo" "${USER_CONFIG_FILE}")"
DISKINFO="$(readConfigKey "boot.diskinfo" "${USER_CONFIG_FILE}")"
if [ "${DSMINFO}" == "true" ]; then
echo -e "\033[1;37mDSM:\033[0m"
echo -e "Model: \033[1;37m${MODELID:-${MODEL}}\033[0m"
echo -e "Platform: \033[1;37m${PLATFORM}\033[0m"
echo -e "Version: \033[1;37m${PRODUCTVER} (${BUILDNUM}$([ ${SMALLNUM:-0} -ne 0 ] && echo "u${SMALLNUM}"))\033[0m"
echo -e "LKM: \033[1;37m${LKM}\033[0m"
echo
fi
if [ "${SYSTEMINFO}" == "true" ]; then
echo -e "\033[1;37mSystem:\033[0m"
echo -e "Vendor: \033[1;37m${VENDOR}\033[0m"
echo -e "CPU: \033[1;37m${CPU}\033[0m"
echo -e "Memory: \033[1;37m${RAMTOTAL}GB\033[0m"
echo
fi
if [ "${DISKINFO}" == "true" ]; then
echo -e "\033[1;37mDisks:\033[0m"
echo -e "Disks: \033[1;37m$(lsblk -dpno NAME | grep -v "${LOADER_DISK}" | wc -l)\033[0m"
fi
echo -e "\033[1;37mDSM:\033[0m"
echo -e "Model: \033[1;37m${MODELID:-${MODEL}}\033[0m"
echo -e "Platform: \033[1;37m${PLATFORM}\033[0m"
echo -e "Version: \033[1;37m${PRODUCTVER} (${BUILDNUM}$([ ${SMALLNUM:-0} -ne 0 ] && echo "u${SMALLNUM}"))\033[0m"
echo -e "LKM: \033[1;37m${LKM}\033[0m"
echo
echo -e "\033[1;37mSystem:\033[0m"
echo -e "Vendor: \033[1;37m${VENDOR}\033[0m"
echo -e "CPU: \033[1;37m${CPU}\033[0m"
echo -e "Memory: \033[1;37m${RAMTOTAL}GB\033[0m"
echo
if ! readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q nvmesystem; then
HASATA=0
@ -282,7 +293,7 @@ elif [ "${DIRECTBOOT}" == "false" ]; then
rm -f WB WC
echo -en "\r$(printf "%$((${#MSG} * 2))s" " ")\n"
DSMLOGO="$(readConfigKey "dsmlogo" "${USER_CONFIG_FILE}")"
DSMLOGO="$(readConfigKey "boot.dsmlogo" "${USER_CONFIG_FILE}")"
if [ "${DSMLOGO}" == "true" ] && [ -c "/dev/fb0" ]; then
[[ "${IPCON}" =~ ^169\.254\..* ]] && IPCON=""
if [ -n "${IPCON}" ]; then

View File

@ -10,7 +10,6 @@ set -e
[ -z "${LOADER_DISK}" ] && die "Loader Disk not found!"
checkBootLoader || die "The loader is corrupted, please rewrite it!"
BUS=$(getBus "${LOADER_DISK}")
[ ! -f /var/run/dhcpcd/pid ] && /etc/init.d/S41dhcpcd restart >/dev/null 2>&1 || true
# Check if machine has EFI
[ -d /sys/firmware/efi ] && EFI=1 || EFI=0
@ -44,10 +43,13 @@ initConfigKey "arc.key" "" "${USER_CONFIG_FILE}"
initConfigKey "arc.offline" "false" "${USER_CONFIG_FILE}"
initConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
initConfigKey "arc.version" "${ARC_VERSION}" "${USER_CONFIG_FILE}"
initConfigKey "boot" "{}" "${USER_CONFIG_FILE}"
initConfigKey "boot.dsminfo" "true" "${USER_CONFIG_FILE}"
initConfigKey "boot.systeminfo" "true" "${USER_CONFIG_FILE}"
initConfigKey "boot.dsmlogo" "true" "${USER_CONFIG_FILE}"
initConfigKey "bootipwait" "30" "${USER_CONFIG_FILE}"
initConfigKey "device" "{}" "${USER_CONFIG_FILE}"
initConfigKey "directboot" "false" "${USER_CONFIG_FILE}"
initConfigKey "dsmlogo" "true" "${USER_CONFIG_FILE}"
initConfigKey "emmcboot" "false" "${USER_CONFIG_FILE}"
initConfigKey "hddsort" "false" "${USER_CONFIG_FILE}"
initConfigKey "kernel" "official" "${USER_CONFIG_FILE}"
@ -117,6 +119,7 @@ writeConfigKey "device.nic" "${ETHN}" "${USER_CONFIG_FILE}"
# No network devices
echo
[ ${ETHN} -le 0 ] && die "No NIC found! - Loader does not work without Network connection."
[ ! -f /var/run/dhcpcd/pid ] && /etc/init.d/S41dhcpcd restart >/dev/null 2>&1 || true
# Get the VID/PID if we are in USB
VID="0x46f4"