arc-functions: fix cmdline menu

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-07-06 19:33:46 +02:00
parent f422a83c08
commit 8f991cec67

View File

@ -278,6 +278,8 @@ function cmdlineMenu() {
while IFS=': ' read -r KEY VALUE; do
[ -n "${KEY}" ] && CMDLINE["${KEY}"]="${VALUE}"
done < <(readConfigMap "cmdline" "${USER_CONFIG_FILE}")
# Loop menu
while true; do
echo "1 \"Add a Cmdline item\"" >"${TMP_PATH}/menu"
echo "2 \"Delete Cmdline item(s)\"" >>"${TMP_PATH}/menu"
echo "3 \"CPU Fix\"" >>"${TMP_PATH}/menu"
@ -285,9 +287,7 @@ function cmdlineMenu() {
echo "5 \"PCI/IRQ Fix\"" >>"${TMP_PATH}/menu"
echo "6 \"C-State Fix\"" >>"${TMP_PATH}/menu"
echo "7 \"Show user Cmdline\"" >>"${TMP_PATH}/menu"
echo "9 \"Kernelpanic Behavior\"" >>"${TMP_PATH}/menu"
# Loop menu
while true; do
echo "8 \"Kernelpanic Behavior\"" >>"${TMP_PATH}/menu"
dialog --backtitle "$(backtitle)" --cancel-label "Exit" --menu "Choose an Option" 0 0 0 \
--file "${TMP_PATH}/menu" 2>"${TMP_PATH}/resp"
[ $? -ne 0 ] && break
@ -342,6 +342,7 @@ function cmdlineMenu() {
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
;;
2)
while true; do
if [ ${#CMDLINE[@]} -eq 0 ]; then
dialog --backtitle "$(backtitle)" --msgbox "No user cmdline to remove" 0 0
continue
@ -353,24 +354,26 @@ function cmdlineMenu() {
dialog --backtitle "$(backtitle)" \
--checklist "Select cmdline to remove" 0 0 0 ${ITEMS} \
2>"${TMP_PATH}/resp"
[ $? -ne 0 ] && return 1
[ $? -ne 0 ] && break
resp=$(cat ${TMP_PATH}/resp)
[ -z "${resp}" ] && return 1
[ -z "${resp}" ] && break
for I in ${resp}; do
unset 'CMDLINE[${I}]'
deleteConfigKey "cmdline.\"${I}\"" "${USER_CONFIG_FILE}"
done
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
done
;;
3)
while true; do
dialog --clear --backtitle "$(backtitle)" \
--title "CPU Fix" --menu "Fix?" 0 0 0 \
1 "Install" \
2 "Uninstall" \
2>"${TMP_PATH}/resp"
resp=$(cat ${TMP_PATH}/resp)
[ -z "${resp}" ] && return 1
[ -z "${resp}" ] && break
if [ ${resp} -eq 1 ]; then
writeConfigKey "cmdline.nmi_watchdog" "0" "${USER_CONFIG_FILE}"
writeConfigKey "cmdline.tsc" "reliable" "${USER_CONFIG_FILE}"
@ -384,15 +387,17 @@ function cmdlineMenu() {
fi
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
done
;;
4)
while true; do
dialog --clear --backtitle "$(backtitle)" \
--title "RAM Fix" --menu "Fix?" 0 0 0 \
1 "Install" \
2 "Uninstall" \
2>"${TMP_PATH}/resp"
resp=$(cat ${TMP_PATH}/resp)
[ -z "${resp}" ] && return 1
[ -z "${resp}" ] && break
if [ ${resp} -eq 1 ]; then
writeConfigKey "cmdline.disable_mtrr_trim" "0" "${USER_CONFIG_FILE}"
writeConfigKey "cmdline.crashkernel" "auto" "${USER_CONFIG_FILE}"
@ -406,15 +411,17 @@ function cmdlineMenu() {
fi
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
done
;;
5)
while true; do
dialog --clear --backtitle "$(backtitle)" \
--title "PCI/IRQ Fix" --menu "Fix?" 0 0 0 \
1 "Install" \
2 "Uninstall" \
2>"${TMP_PATH}/resp"
resp=$(cat ${TMP_PATH}/resp)
[ -z "${resp}" ] && return 1
[ -z "${resp}" ] && break
if [ ${resp} -eq 1 ]; then
writeConfigKey "cmdline.pci" "routeirq" "${USER_CONFIG_FILE}"
dialog --backtitle "$(backtitle)" --title "PCI/IRQ Fix" \
@ -426,15 +433,17 @@ function cmdlineMenu() {
fi
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
done
;;
6)
while true; do
dialog --clear --backtitle "$(backtitle)" \
--title "C-State Fix" --menu "Fix?" 0 0 0 \
1 "Install" \
2 "Uninstall" \
2>"${TMP_PATH}/resp"
resp=$(cat ${TMP_PATH}/resp)
[ -z "${resp}" ] && return 1
[ -z "${resp}" ] && break
if [ ${resp} -eq 1 ]; then
writeConfigKey "cmdline.intel_idle.max_cstate" "1" "${USER_CONFIG_FILE}"
dialog --backtitle "$(backtitle)" --title "C-State Fix" \
@ -446,6 +455,7 @@ function cmdlineMenu() {
fi
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
done
;;
7)
ITEMS=""
@ -456,6 +466,7 @@ function cmdlineMenu() {
--aspect 18 --msgbox "${ITEMS}" 0 0
;;
8)
while true; do
rm -f "${TMP_PATH}/opts" >/dev/null
echo "5 \"Reboot after 5 seconds\"" >>"${TMP_PATH}/opts"
echo "0 \"No reboot\"" >>"${TMP_PATH}/opts"
@ -463,11 +474,14 @@ function cmdlineMenu() {
dialog --backtitle "$(backtitle)" --colors --title "Kernelpanic" \
--default-item "${KERNELPANIC}" --menu "Choose a time(seconds)" 0 0 0 --file "${TMP_PATH}/opts" \
2>${TMP_PATH}/resp
[ $? -ne 0 ] && return 1
[ $? -ne 0 ] && break
resp=$(cat ${TMP_PATH}/resp)
[ -z "${resp}" ] && return 1
[ -z "${resp}" ] && break
KERNELPANIC=${resp}
writeConfigKey "arc.kernelpanic" "${KERNELPANIC}" "${USER_CONFIG_FILE}"
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
done
;;
esac
done