Skip to content

Commit 89f9bc4

Browse files
committed
tree: more rewrite
Signed-off-by: AuxXxilium <[email protected]>
1 parent 86f4536 commit 89f9bc4

File tree

4 files changed

+48
-51
lines changed

4 files changed

+48
-51
lines changed

files/initrd/opt/arc/arc-functions.sh

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,6 @@ function arcVersion() {
200200
if [ "${SASDRIVES}" -gt 0 ] && [ "${DT}" = "true" ]; then
201201
initConfigKey "addons.smartctl" "" "${USER_CONFIG_FILE}"
202202
fi
203-
WEBHOOKNOTIFY="$(readConfigKey "arc.webhooknotify" "${USER_CONFIG_FILE}")"
204-
DISCORDNOTIFY="$(readConfigKey "arc.discordnotify" "${USER_CONFIG_FILE}")"
205-
if [ "${WEBHOOKNOTIFY}" = "true" ] || [ "${DISCORDNOTIFY}" = "true" ]; then
206-
initConfigKey "addons.notification" "" "${USER_CONFIG_FILE}"
207-
fi
208203
}
209204

210205
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
@@ -282,6 +277,19 @@ function arcVersion() {
282277
[ $? -ne 0 ] && return
283278
fi
284279
fi
280+
USERID="$(readConfigKey "arc.userid" "${USER_CONFIG_FILE}")"
281+
ADDONS_LIST="$(readConfigMap "addons" "${USER_CONFIG_FILE}")"
282+
if [ -n "${USERID}" ] && ! echo "${ADDONS_LIST}" | grep -q "notification"; then
283+
MSG="Enable Discord Notification for Loader Mode and DSM Status?"
284+
dialog --backtitle "$(backtitle)" --colors --title "Notification" \
285+
--yesno "${MSG}" 5 65
286+
[ $? -eq 0 ] && writeConfigKey "arc.discordnotify" "true" "${USER_CONFIG_FILE}"
287+
WEBHOOKNOTIFY="$(readConfigKey "arc.webhooknotify" "${USER_CONFIG_FILE}")"
288+
DISCORDNOTIFY="$(readConfigKey "arc.discordnotify" "${USER_CONFIG_FILE}")"
289+
if [ "${WEBHOOKNOTIFY}" = "true" ] || [ "${DISCORDNOTIFY}" = "true" ]; then
290+
initConfigKey "addons.notification" "" "${USER_CONFIG_FILE}"
291+
fi
292+
fi
285293
MSG="Do you want to use Automated Mode?\nIf yes, Loader will configure, build and boot DSM."
286294
dialog --backtitle "$(backtitle)" --colors --title "Automated Mode" \
287295
--yesno "${MSG}" 6 55
@@ -3136,9 +3144,9 @@ function governorSelection () {
31363144
rm -f "${TMP_PATH}/opts" >/dev/null
31373145
touch "${TMP_PATH}/opts"
31383146
# Selectable CPU governors
3139-
[ "${KVER:0:1}" = "5" ] && echo -e "schedutil \"use schedutil to scale frequency *\"" >>"${TMP_PATH}/opts"
3140-
[ "${KVER:0:1}" = "4" ] && echo -e "conservative \"use conservative to scale frequency *\"" >>"${TMP_PATH}/opts"
3141-
[ "${KVER:0:1}" = "4" ] && echo -e "ondemand \"use ondemand to scale frequency\"" >>"${TMP_PATH}/opts"
3147+
[ "${KVER:0:1}" = "5" ] && echo -e "schedutil \"use efficient frequency scaling *\"" >>"${TMP_PATH}/opts"
3148+
[ "${KVER:0:1}" = "4" ] && echo -e "conservative \"use dynamic frequency scaling *\"" >>"${TMP_PATH}/opts"
3149+
[ "${KVER:0:1}" = "4" ] && echo -e "ondemand \"use dynamic frequency boost\"" >>"${TMP_PATH}/opts"
31423150
echo -e "performance \"always run at max frequency\"" >>"${TMP_PATH}/opts"
31433151
echo -e "powersave \"always run at lowest frequency\"" >>"${TMP_PATH}/opts"
31443152
dialog --backtitle "$(backtitle)" --title "CPU Frequency Scaling" \
@@ -3309,7 +3317,7 @@ function genHardwareID() {
33093317
writeConfigKey "arc.userid" "${USERID}" "${USER_CONFIG_FILE}"
33103318
writeConfigKey "bootscreen.hwidinfo" "true" "${USER_CONFIG_FILE}"
33113319
dialog --backtitle "$(backtitle)" --title "HardwareID" \
3312-
--msgbox "HardwareID: ${HWID}\nYour HardwareID is registered to UserID: ${USERID}!\nMake sure you select Arc Patch while configure." 7 70
3320+
--msgbox "HardwareID: ${HWID}\nYour HardwareID is registered to UserID: ${USERID}!\nMake sure you select Arc Patch while configure the Loader." 7 70
33133321
break
33143322
else
33153323
USERID=""

files/initrd/opt/arc/arc.sh

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ elif [ "${ARC_MODE}" = "config" ]; then
8686

8787
write_menu "=" "\Z4===== Main =====\Zn"
8888

89-
if [ -z "${USERID}" ] && [ "${ARC_OFFLINE}" = "false" ]; then
90-
write_menu "0" "HardwareID for Arc Patch"
89+
if [ "${ARC_OFFLINE}" = "false" ]; then
90+
write_menu_value "0" "HardwareID" "$([ -n "$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")" ] && echo "registered" || echo "register for Arc Patch")"
9191
fi
9292

9393
write_menu "1" "Choose Model"
@@ -114,9 +114,9 @@ elif [ "${ARC_MODE}" = "config" ]; then
114114
write_menu "5" "\Z1Hide Arc Options\Zn"
115115
write_menu "b" "Addons"
116116
write_menu "d" "Modules"
117-
write_menu "e" "Version"
118-
write_menu "p" "SN/Mac Options"
119-
117+
write_menu_value "e" "Version" "${PRODUCTVER:-unknown}"
118+
write_menu_value "p" "SN/Mac Options" "$([ -n "${ARC_CONF}" ] && echo "arc" || echo "random/user")"
119+
120120
if [ "${DT}" = "false" ] && [ "${SATACONTROLLER}" -gt 0 ]; then
121121
write_menu "S" "PortMap (Sata Controller)"
122122
fi
@@ -125,14 +125,14 @@ elif [ "${ARC_MODE}" = "config" ]; then
125125
write_menu "o" "DTS Map Options"
126126
fi
127127

128-
for addon in "cpufreqscaling" "storagepanel"; do
129-
if readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "${addon}"; then
130-
case "${addon}" in
131-
"cpufreqscaling") write_menu "g" "Scaling Governor" ;;
132-
"storagepanel") write_menu "P" "StoragePanel" ;;
133-
esac
134-
fi
135-
done
128+
addons_list="$(readConfigMap "addons" "${USER_CONFIG_FILE}")"
129+
if echo "${addons_list}" | grep -q "cpufreqscaling"; then
130+
GOVERNOR="$(readConfigKey "governor" "${USER_CONFIG_FILE}")"
131+
write_menu_value "g" "Scaling Governor" "${GOVERNOR:-performance}"
132+
fi
133+
if echo "${addons_list}" | grep -q "storagepanel"; then
134+
write_menu_value "P" "StoragePanel" "${STORAGEPANEL:-auto}"
135+
fi
136136

137137
if [ "${PLATFORM}" = "epyc7002" ] && [ "${PRODUCTVER}" = "7.2" ]; then
138138
write_menu_value "K" "Kernel" "${KERNEL}"

files/initrd/opt/arc/evo.sh

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -212,24 +212,17 @@ elif [ "${ARC_MODE}" = "config" ]; then
212212
while true; do
213213
rm -f "${TMP_PATH}/menu" "${TMP_PATH}/resp" >/dev/null 2>&1 || true
214214
write_menu "=" "\Z4===== Main =====\Zn"
215-
if [ -z "${USERID}" ] && [ "${ARC_OFFLINE}" = "false" ]; then
216-
write_menu_value "0" "HardwareID" "${HARDWAREID}"
215+
if [ "${ARC_OFFLINE}" = "false" ]; then
216+
write_menu_value "0" "HardwareID" "$([ -n "$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")" ] && echo "registered" || echo "register for Arc Patch")"
217217
fi
218218

219219
write_menu_value "1" "Model" "${MODEL}"
220220

221221
if [ "${CONFDONE}" = "true" ]; then
222-
write_menu_value "e" "Version" "${PRODUCTVER}"
222+
write_menu_value "e" "Version" "${PRODUCTVER:-unknown}"
223223
write_menu_value "=" "DT" "${DT}"
224224
write_menu_value "=" "Platform" "${PLATFORM}"
225-
226-
if [ -n "${USERID}" ] && [ "${ARC_OFFLINE}" = "false" ]; then
227-
write_menu_value "p" "Arc Patch" "${ARC_PATCH}"
228-
elif [ "${ARC_OFFLINE}" = "false" ]; then
229-
write_menu "p" "Arc Patch: \Z4Register HardwareID first\Zn"
230-
else
231-
write_menu "p" "SN/Mac Options"
232-
fi
225+
write_menu_value "p" "SN/Mac Options" "$([ -n "${ARC_CONF}" ] && echo "arc" || echo "random/user")"
233226

234227
if [ "${PLATFORM}" = "epyc7002" ]; then
235228
CPUINFO="$(cat /proc/cpuinfo | grep MHz | wc -l)"
@@ -241,14 +234,14 @@ elif [ "${ARC_MODE}" = "config" ]; then
241234

242235
write_menu "b" "Addons"
243236

244-
for addon in "cpufreqscaling" "storagepanel"; do
245-
if readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "${addon}"; then
246-
case "${addon}" in
247-
"cpufreqscaling") write_menu_value "g" "Scaling Governor" "${GOVERNOR}" ;;
248-
"storagepanel") write_menu_value "P" "StoragePanel" "${STORAGEPANEL:-auto}" ;;
249-
esac
250-
fi
251-
done
237+
addons_list="$(readConfigMap "addons" "${USER_CONFIG_FILE}")"
238+
if echo "${addons_list}" | grep -q "cpufreqscaling"; then
239+
GOVERNOR="$(readConfigKey "governor" "${USER_CONFIG_FILE}")"
240+
write_menu_value "g" "Scaling Governor" "${GOVERNOR:-performance}"
241+
fi
242+
if echo "${addons_list}" | grep -q "storagepanel"; then
243+
write_menu_value "P" "StoragePanel" "${STORAGEPANEL:-auto}"
244+
fi
252245

253246
write_menu "d" "Modules"
254247
write_menu_value "O" "Official Driver Priority" "${ODP}"

files/initrd/opt/arc/init.sh

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fi
2525
checkBootLoader || die "The loader is corrupted, please rewrite it!"
2626
arc_mode || die "No bootmode found!"
2727

28-
[ -f "${HOME}/.initialized" ] && exec arc.sh || true
28+
[ -f "${HOME}/.initialized" ] && arc.sh && exit 0 || true
2929

3030
BUS=$(getBus "${LOADER_DISK}")
3131
EFI=$([ -d /sys/firmware/efi ] && echo 1 || echo 0)
@@ -139,10 +139,6 @@ writeConfigKey "device.nic" "${ETHN}" "${USER_CONFIG_FILE}"
139139
echo
140140
[ "${ETHN}" -le 0 ] && die "No NIC found! - Loader does not work without Network connection."
141141

142-
# Get the VID/PID if we are in USB
143-
VID="0x46f4"
144-
PID="0x0001"
145-
146142
BUSLIST="usb sata sas scsi nvme mmc ide virtio vmbus xen"
147143
if [ "${BUS}" = "usb" ]; then
148144
VID="0x$(udevadm info --query property --name "${LOADER_DISK}" 2>/dev/null | grep "ID_VENDOR_ID" | cut -d= -f2)"
@@ -152,8 +148,8 @@ elif ! (echo "${BUSLIST}" | grep -wq "${BUS}"); then
152148
fi
153149

154150
# Save variables to user config file
155-
writeConfigKey "vid" "${VID}" "${USER_CONFIG_FILE}"
156-
writeConfigKey "pid" "${PID}" "${USER_CONFIG_FILE}"
151+
writeConfigKey "vid" "${VID:-"0x46f4"}" "${USER_CONFIG_FILE}"
152+
writeConfigKey "pid" "${PID:-"0x0001"}" "${USER_CONFIG_FILE}"
157153

158154
# Inform user and check bus
159155
echo -e "Loader Disk: \033[1;34m${LOADER_DISK}\033[0m"
@@ -176,7 +172,7 @@ case "${ARC_MODE}" in
176172
dsm|reinstall|recovery)
177173
if [ "${BUILDDONE}" = "true" ]; then
178174
echo -e "\033[1;34mStarting DSM Mode...\033[0m"
179-
exec boot.sh && exit 0
175+
boot.sh && exit 0
180176
else
181177
echo -e "\033[1;34mRebooting to Config Mode...\033[0m"
182178
rebootTo "config" || die "Reboot to Config Mode failed!"
@@ -241,8 +237,8 @@ if [ "${RAM:-0}" -le 3500 ]; then
241237
echo -e "\033[1;31mYou have less than 4GB of RAM, if errors occur in loader creation, please increase the amount of RAM.\033[0m"
242238
read -rp "Press Enter to continue..."
243239
if [ $? -eq 0 ]; then
244-
exec arc.sh
240+
arc.sh
245241
fi
246242
else
247-
exec arc.sh
243+
arc.sh
248244
fi

0 commit comments

Comments
 (0)