Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #6056

Merged
merged 9 commits into from
Jan 31, 2025
Merged

Dev #6056

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/grub.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium>
# Copyright (C) 2025 AuxXxilium <https://github.com/AuxXxilium>
#
# This is free software, licensed under the MIT License.
# See /LICENSE for more information.
Expand Down Expand Up @@ -33,7 +33,7 @@ jobs:

- name: Make Grub
run: |
rm -f grub.img.gz
rm -f "files/initrd/opt/arc/grub.img.gz"
. scripts/grub.sh "grub-2.12" "i386-pc i386-efi x86_64-efi" "ARC"

- name: Check and Push
Expand Down
125 changes: 73 additions & 52 deletions files/initrd/opt/arc/arc-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1377,21 +1377,24 @@ function backupMenu() {
while true; do
if [ -n "${USERID}" ] && [ "${ARCOFFLINE}" != "true" ] && [ "${CONFDONE}" = "true" ]; then
dialog --backtitle "$(backtitle)" --title "Backup" --cancel-label "Exit" --menu "Choose an Option" 0 0 0 \
1 "Restore Arc Config from DSM" \
2 "Restore Hardware Key from DSM" \
3 "Restore Arc Config from Online" \
4 "Backup Arc Config to Online" \
1 "Restore Arc Config (from DSM)" \
2 "Restore Hardware Key (local)" \
3 "Backup Hardware Key (local)" \
4 "Restore Arc Config (from Online)" \
5 "Backup Arc Config (to Online)" \
2>"${TMP_PATH}/resp"
elif [ -n "${USERID}" ] && [ "${ARCOFFLINE}" != "true" ]; then
dialog --backtitle "$(backtitle)" --title "Backup" --cancel-label "Exit" --menu "Choose an Option" 0 0 0 \
1 "Restore Arc Config from DSM" \
2 "Restore Hardware Key from DSM" \
3 "Restore Arc Config from Online" \
1 "Restore Arc Config (from DSM)" \
2 "Restore Hardware Key (local)" \
3 "Backup Hardware Key (local)" \
4 "Restore Arc Config (from Online)" \
2>"${TMP_PATH}/resp"
else
dialog --backtitle "$(backtitle)" --title "Backup" --cancel-label "Exit" --menu "Choose an Option" 0 0 0 \
1 "Restore Arc Config from DSM" \
2 "Restore Hardware Key from DSM" \
1 "Restore Arc Config (from DSM)" \
2 "Restore Hardware Key (local)" \
3 "Backup Hardware Key (local)" \
2>"${TMP_PATH}/resp"
fi
[ $? -ne 0 ] && break
Expand Down Expand Up @@ -1451,33 +1454,40 @@ function backupMenu() {
rm -f "${HOME}/.initialized" && exec init.sh
;;
2)
DSMROOTS="$(findDSMRoot)"
if [ -z "${DSMROOTS}" ]; then
dialog --backtitle "$(backtitle)" --title "Restore Encryption Key" \
--msgbox "No DSM system partition(md0) found!\nPlease insert all disks before continuing." 0 0
return
fi
mkdir -p "${TMP_PATH}/mdX"
for I in ${DSMROOTS}; do
# fixDSMRootPart "${I}"
mount -t ext4 "${I}" "${TMP_PATH}/mdX"
if [ -f "${TMP_PATH}/mdX/usr/arc/backup/p2/machine.key" ]; then
cp -f "${TMP_PATH}/mdX/usr/arc/backup/p2/machine.key" "${PART2_PATH}/machine.key"
dialog --backtitle "$(backtitle)" --title "Restore Encryption Key" --aspect 18 \
--msgbox "Encryption Key restore successful!" 0 0
break
fi
done
umount "${TMP_PATH}/mdX"
if [ -f "${PART2_PATH}/machine.key" ]; then
dialog --backtitle "$(backtitle)" --title "Restore Encryption Key" \
--msgbox "Upload the machine.key file to ${PART3_PATH}/users\nand press OK after the upload is done." 0 0
[ $? -ne 0 ] && return 1
if [ -f "${PART3_PATH}/users/machine.key" ]; then
mv -f "${PART3_PATH}/users/machine.key" "${PART2_PATH}/machine.key"
dialog --backtitle "$(backtitle)" --title "Restore Encryption Key" --aspect 18 \
--msgbox "Encryption Key restore successful!" 0 0
else
dialog --backtitle "$(backtitle)" --title "Restore Encryption Key" --aspect 18 \
--msgbox "No Encryption Key found!" 0 0
dialog --backtitle "$(backtitle)" --title "Restore Encryption Key" \
--msgbox "File not found!" 0 0
return 1
fi
return
;;
3)
dialog --backtitle "$(backtitle)" --title "Backup Encryption Key" \
--msgbox "To backup the Encryption Key press OK." 0 0
[ $? -ne 0 ] && return 1

if [ -f "${PART2_PATH}/machine.key" ]; then
cp -f "${PART2_PATH}/machine.key" "/var/www/data/machine.key"
URL="http://${IPCON}${HTTPPORT:+:$HTTPPORT}/machine.key"
MSG="Please use ${URL} to download the machine.key file."
else
MSG="File not found!"
fi
dialog --backtitle "$(backtitle)" --colors --title "Backup Encryption Key" \
--msgbox "${MSG}" 0 0
if [ "${MSG}" = "File not found!" ]; then
return 1
fi
return
;;
4)
[ -f "${USER_CONFIG_FILE}" ] && mv -f "${USER_CONFIG_FILE}" "${USER_CONFIG_FILE}.bak"
HWID="$(genHWID)"
if curl -skL "https://arc.auxxxilium.tech?cdown=${HWID}" -o "${USER_CONFIG_FILE}" 2>/dev/null; then
Expand Down Expand Up @@ -1509,14 +1519,16 @@ function backupMenu() {
sleep 2
rm -f "${HOME}/.initialized" && exec init.sh
;;
4)
5)
HWID="$(genHWID)"
curl -sk -X POST -F "file=@${USER_CONFIG_FILE}" "https://arc.auxxxilium.tech?cup=${HWID}&userid=${USERID}" 2>/dev/null
if [ $? -eq 0 ]; then
dialog --backtitle "$(backtitle)" --title "Online Backup" --msgbox "Online Backup successful!" 5 40
else
dialog --backtitle "$(backtitle)" --title "Online Backup" --msgbox "Online Backup failed!" 5 40
return 1
fi
return
;;
*)
break
Expand All @@ -1542,11 +1554,12 @@ function updateMenu() {
1)
# Ask for Tag
TAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | grep -v "dev" | sort -rV | head -1)"
OLD="$(cat ${PART1_PATH}/ARC-VERSION)"
OLD="${ARC_VERSION}"
dialog --clear --backtitle "$(backtitle)" --title "Update Loader" \
--menu "Current: ${OLD} -> Which Version?" 7 50 0 \
1 "Latest ${TAG}" \
2 "Select Version" \
3 "Upload .zip File" \
2>"${TMP_PATH}/opts"
[ $? -ne 0 ] && break
opts=$(cat ${TMP_PATH}/opts)
Expand All @@ -1558,6 +1571,25 @@ function updateMenu() {
2>"${TMP_PATH}/input"
TAG=$(cat "${TMP_PATH}/input")
[ -z "${TAG}" ] && return 1
elif [ ${opts} -eq 3 ]; then
mkdir -p "${PART3_PATH}/users"
dialog --backtitle "$(backtitle)" --title "Update Loader" \
--msgbox "Upload the update-*.zip File to ${PART3_PATH}/users\nand press OK after upload is done." 0 0
[ $? -ne 0 ] && return 1
UPDATEFOUND="false"
for UPDATEFILE in "${PART3_PATH}/users/update-*.zip"; do
if [ -e "${UPDATEFILE}" ]; then
mv -f "${UPDATEFILE}" "${TMP_PATH}/update.zip"
TAG="zip"
UPDATEFOUND="true"
break
fi
done
if [ "${UPDATEFOUND}" = "false" ]; then
dialog --backtitle "$(backtitle)" --title "Update Loader" \
--msgbox "File not found!" 0 0
return 1
fi
fi
updateLoader "${TAG}"
;;
Expand All @@ -1571,7 +1603,7 @@ function updateMenu() {
4)
dialog --backtitle "$(backtitle)" --title "Switch Arc Branch" \
--menu "Choose a Branch" 0 0 0 \
1 "evolution - New Evolution System" \
1 "evo - New Evolution System" \
3 "dev - Development System" \
2>"${TMP_PATH}/opts"
[ $? -ne 0 ] && break
Expand Down Expand Up @@ -2686,14 +2718,9 @@ function greplogs() {

if [ -n "$(ls -A ${TMP_PATH}/logs 2>/dev/null)" ]; then
tar -czf "${TMP_PATH}/logs.tar.gz" -C "${TMP_PATH}" logs
if [ -z "${SSH_TTY}" ]; then # web
mv -f "${TMP_PATH}/logs.tar.gz" "/var/www/data/logs.tar.gz"
URL="http://${IPCON}${HTTPPORT:+:$HTTPPORT}/logs.tar.gz"
MSG+="Please via ${URL} to download the logs,\nAnd go to Github or Discord to create an issue and upload the logs."
else
sz -be -B 536870912 "${TMP_PATH}/logs.tar.gz"
MSG+="Please go to Github or Discord to create an issue and upload the logs."
fi
mv -f "${TMP_PATH}/logs.tar.gz" "/var/www/data/logs.tar.gz"
URL="http://${IPCON}${HTTPPORT:+:$HTTPPORT}/logs.tar.gz"
MSG+="Please via ${URL} to download the logs,\nAnd go to Github or Discord to create an issue and upload the logs."
fi
dialog --backtitle "$(backtitle)" --colors --title "Grep Logs" \
--msgbox "${MSG}" 0 0
Expand All @@ -2706,17 +2733,11 @@ function getbackup() {
if [ -d "${PART1_PATH}/dsmbackup" ]; then
rm -f "${TMP_PATH}/dsmconfig.tar.gz" >/dev/null
tar -czf "${TMP_PATH}/dsmconfig.tar.gz" -C "${PART1_PATH}" dsmbackup
if [ -z "${SSH_TTY}" ]; then # web
cp -f "${TMP_PATH}/dsmconfig.tar.gz" "/var/www/data/dsmconfig.tar.gz"
chmod 644 "/var/www/data/dsmconfig.tar.gz"
URL="http://${IPCON}${HTTPPORT:+:$HTTPPORT}/dsmconfig.tar.gz"
dialog --backtitle "$(backtitle)" --colors --title "DSM Config" \
--msgbox "Please via ${URL}\nto download the dsmconfig and unzip it and back it up in order by file name." 0 0
else
sz -be -B 536870912 "${TMP_PATH}/dsmconfig.tar.gz"
dialog --backtitle "$(backtitle)" --colors --title "DSM Config" \
--msgbox "Please unzip it and back it up in order by file name." 0 0
fi
cp -f "${TMP_PATH}/dsmconfig.tar.gz" "/var/www/data/dsmconfig.tar.gz"
chmod 644 "/var/www/data/dsmconfig.tar.gz"
URL="http://${IPCON}${HTTPPORT:+:$HTTPPORT}/dsmconfig.tar.gz"
dialog --backtitle "$(backtitle)" --colors --title "DSM Config" \
--msgbox "Please via ${URL}\nto download the dsmconfig and unzip it and back it up in order by file name." 0 0
else
MSG=""
MSG+="\Z1No dsmbackup found!\Zn\n\n"
Expand Down
26 changes: 13 additions & 13 deletions files/initrd/opt/arc/arc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function backtitle() {
BACKTITLE="${ARC_TITLE}$([ -n "${NEWTAG}" ] && [ -n "${ARC_VERSION}" ] && [ ${ARC_VERSION//[!0-9]/} -lt ${NEWTAG//[!0-9]/} ] && echo " > ${NEWTAG}") | "
BACKTITLE+="${MODEL:-(Model)} | "
BACKTITLE+="${PRODUCTVER:-(Version)} | "
BACKTITLE+="${IPCON:-(IP)} | "
BACKTITLE+="${IPCON:-(no IP)} | "
BACKTITLE+="Patch: ${ARCPATCH} | "
BACKTITLE+="Config: ${CONFDONE} | "
BACKTITLE+="Build: ${BUILDDONE} | "
Expand Down Expand Up @@ -108,26 +108,26 @@ elif [ "${ARCMODE}" = "config" ]; then
done

if [ "${PLATFORM}" = "epyc7002" ]; then
write_menu_with_color "K" "Kernel" "${KERNEL}"
write_menu_value "K" "Kernel" "${KERNEL}"
fi

if [ "${DT}" = "true" ]; then
write_menu_with_color "H" "Hotplug/SortDrives" "${HDDSORT}"
write_menu_value "H" "Hotplug/SortDrives" "${HDDSORT}"
else
write_menu_with_color "h" "USB as Internal" "${USBMOUNT}"
write_menu_value "h" "USB as Internal" "${USBMOUNT}"
fi
else
write_menu "4" "\Z1Show Arc DSM Options\Zn"
fi

if [ "${BOOTOPTS}" = "true" ]; then
write_menu "6" "\Z1Hide Boot Options\Zn"
write_menu_with_color "m" "Boot Kernelload" "${KERNELLOAD}"
write_menu_with_color "E" "eMMC Boot Support" "${EMMCBOOT}"
write_menu_value "m" "Boot Kernelload" "${KERNELLOAD}"
write_menu_value "E" "eMMC Boot Support" "${EMMCBOOT}"
if [ "${DIRECTBOOT}" = "false" ]; then
write_menu_with_color "i" "Boot IP Waittime" "${BOOTIPWAIT}"
write_menu_value "i" "Boot IP Waittime" "${BOOTIPWAIT}"
fi
write_menu_with_color "q" "Directboot" "${DIRECTBOOT}"
write_menu_value "q" "Directboot" "${DIRECTBOOT}"
else
write_menu "6" "\Z1Show Boot Options\Zn"
fi
Expand All @@ -143,15 +143,15 @@ elif [ "${ARCMODE}" = "config" ]; then
write_menu "M" "Mount DSM Storage Pool"
write_menu "l" "Edit User Config"
write_menu "s" "Allow Downgrade Version"
write_menu_with_color "O" "Official Driver Priority" "${ODP}"
write_menu_value "O" "Official Driver Priority" "${ODP}"
else
write_menu "7" "\Z1Show DSM Options\Zn"
fi
fi

if [ "${LOADEROPTS}" = "true" ]; then
write_menu "8" "\Z1Hide Loader Options\Zn"
write_menu_with_color "c" "Offline Mode" "${ARCOFFLINE}"
write_menu_value "c" "Offline Mode" "${ARCOFFLINE}"
write_menu "D" "StaticIP for Loader/DSM"
write_menu "f" "Bootscreen Options"
write_menu "U" "Change Loader Password"
Expand All @@ -160,9 +160,9 @@ elif [ "${ARCMODE}" = "config" ]; then
write_menu "L" "Grep Logs from dbgutils"
write_menu "B" "Grep DSM Config from Backup"
write_menu "=" "\Z1== Edit with caution! ==\Zn"
write_menu_with_color "W" "RD Compression" "${RD_COMPRESSED}"
write_menu_with_color "X" "Sata DOM" "${SATADOM}"
write_menu_with_color "u" "LKM Version" "${LKM}"
write_menu_value "W" "RD Compression" "${RD_COMPRESSED}"
write_menu_value "X" "Sata DOM" "${SATADOM}"
write_menu_value "u" "LKM Version" "${LKM}"
write_menu "C" "Clone Loader to another Disk"
write_menu "n" "Grub Bootloader Config"
write_menu "y" "Choose a Keymap for Loader"
Expand Down
12 changes: 10 additions & 2 deletions files/initrd/opt/arc/boot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
BUILDNUM="$(readConfigKey "buildnum" "${USER_CONFIG_FILE}")"
SMALLNUM="$(readConfigKey "smallnum" "${USER_CONFIG_FILE}")"
LKM="$(readConfigKey "lkm" "${USER_CONFIG_FILE}")"
KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_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')"
Expand Down Expand Up @@ -83,7 +85,7 @@ if [ "${DSMINFO}" = "true" ]; then
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 "Kernel: \033[1;37m${KVER}\033[0m"
echo -e "Kernel: \033[1;37m${KVER} (${KERNEL}\033[0m"
echo -e "LKM: \033[1;37m${LKM}\033[0m"
echo
fi
Expand Down Expand Up @@ -124,9 +126,15 @@ if checkBIOS_VT_d && [ $(echo "${KVER:-4}" | cut -d'.' -f1) -lt 5 ]; then
fi

# Read necessary variables
readData
VID="$(readConfigKey "vid" "${USER_CONFIG_FILE}")"
PID="$(readConfigKey "pid" "${USER_CONFIG_FILE}")"
SN="$(readConfigKey "sn" "${USER_CONFIG_FILE}")"
KERNELPANIC="$(readConfigKey "kernelpanic" "${USER_CONFIG_FILE}")"
DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")"
KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
EMMCBOOT="$(readConfigKey "emmcboot" "${USER_CONFIG_FILE}")"
MODBLACKLIST="$(readConfigKey "modblacklist" "${USER_CONFIG_FILE}")"
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"

declare -A CMDLINE

Expand Down
Loading