tree: rework more

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-11-13 18:05:58 +01:00
parent fb183e437e
commit 95c1eb6897
5 changed files with 48 additions and 41 deletions

View File

@ -828,13 +828,14 @@ function backupMenu() {
dialog --backtitle "$(backtitle)" --title "Online Restore" --msgbox "Online Restore successful!" 5 40 dialog --backtitle "$(backtitle)" --title "Online Restore" --msgbox "Online Restore successful!" 5 40
else else
dialog --backtitle "$(backtitle)" --title "Online Restore" --msgbox "Online Restore failed!" 5 40 dialog --backtitle "$(backtitle)" --title "Online Restore" --msgbox "Online Restore failed!" 5 40
mv -f "${USER_CONFIG_FILE}.bak" "${USER_CONFIG_FILE}" [ -f "${USER_CONFIG_FILE}.bak" ] && mv -f "${USER_CONFIG_FILE}.bak" "${USER_CONFIG_FILE}"
fi fi
;; ;;
5) 5)
if [ -f "${USER_CONFIG_FILE}" ]; then if [ -f "${USER_CONFIG_FILE}" ]; then
HWID="$(genHWID)" HWID="$(genHWID)"
if curl -sk -X POST -F "file=@${USER_CONFIG_FILE}" "https://arc.auxxxilium.tech?cup=${HWID}&userid=${USERID}"; then 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 dialog --backtitle "$(backtitle)" --title "Online Backup" --msgbox "Online Backup successful!" 5 40
else else
dialog --backtitle "$(backtitle)" --title "Online Backup" --msgbox "Online Backup failed!" 5 40 dialog --backtitle "$(backtitle)" --title "Online Backup" --msgbox "Online Backup failed!" 5 40
@ -1227,7 +1228,8 @@ function getCMDline () {
function uploadDiag () { function uploadDiag () {
if [ -f "${TMP_PATH}/sysinfo.yml" ]; then if [ -f "${TMP_PATH}/sysinfo.yml" ]; then
HWID="$(genHWID)" HWID="$(genHWID)"
if curl -sk -X POST -F "file=@${TMP_PATH}/sysinfo.yml" "https://arc.auxxxilium.tech?sysinfo=${HWID}&userid=${USERID}"; then curl -sk -X POST -F "file=@${TMP_PATH}/sysinfo.yml" "https://arc.auxxxilium.tech?sysinfo=${HWID}&userid=${USERID}" 2>/dev/null
if [ $? -eq 0 ]; then
dialog --backtitle "$(backtitle)" --title "Sysinfo Upload" --msgbox "Your Code: ${HWID}" 5 40 dialog --backtitle "$(backtitle)" --title "Sysinfo Upload" --msgbox "Your Code: ${HWID}" 5 40
else else
dialog --backtitle "$(backtitle)" --title "Sysinfo Upload" --msgbox "Failed to upload diag file!" 0 0 dialog --backtitle "$(backtitle)" --title "Sysinfo Upload" --msgbox "Failed to upload diag file!" 0 0
@ -2221,7 +2223,7 @@ function getpatfiles() {
--infobox "Downloading DSM Boot Files..." 3 40 --infobox "Downloading DSM Boot Files..." 3 40
# Get new Files # Get new Files
DSM_URL="https://raw.githubusercontent.com/AuxXxilium/arc-dsm/main/files/${MODEL/+/%2B}/${PRODUCTVER}/${PAT_HASH}.tar" DSM_URL="https://raw.githubusercontent.com/AuxXxilium/arc-dsm/main/files/${MODEL/+/%2B}/${PRODUCTVER}/${PAT_HASH}.tar"
if curl -skL "${DSM_URL}" -o "${DSM_FILE}"; then if curl -skL "${DSM_URL}" -o "${DSM_FILE}" 2>/dev/null; then
VALID="true" VALID="true"
fi fi
elif [ ! -f "${DSM_FILE}" ] && [ "${ARCOFFLINE}" == "true" ]; then elif [ ! -f "${DSM_FILE}" ] && [ "${ARCOFFLINE}" == "true" ]; then
@ -2256,28 +2258,31 @@ function getpatfiles() {
# Generate HardwareID # Generate HardwareID
function genHardwareID() { function genHardwareID() {
HWID="$(genHWID)" HWID="$(genHWID)"
while true; do
if [ -n "${HWID}" ]; then if [ -n "${HWID}" ]; then
USERID="$(curl -skL "https://arc.auxxxilium.tech?hwid=${HWID}")" USERID="$(curl -skL "https://arc.auxxxilium.tech?hwid=${HWID}" 2>/dev/null)"
if echo "${USERID}" | grep -vq "Hardware ID"; then if echo "${USERID}" | grep -vq "Hardware ID"; then
dialog --backtitle "$(backtitle)" --title "HardwareID" \ dialog --backtitle "$(backtitle)" --title "HardwareID" \
--msgbox "HardwareID: ${HWID}\nYour HardwareID is registered to UserID: ${USERID}!" 6 70 --msgbox "HardwareID: ${HWID}\nYour HardwareID is registered to UserID: ${USERID}!" 6 70
writeConfigKey "arc.hwid" "${HWID}" "${USER_CONFIG_FILE}" writeConfigKey "arc.hwid" "${HWID}" "${USER_CONFIG_FILE}"
writeConfigKey "arc.userid" "${USERID}" "${USER_CONFIG_FILE}" writeConfigKey "arc.userid" "${USERID}" "${USER_CONFIG_FILE}"
break
else else
dialog --backtitle "$(backtitle)" --title "HardwareID" \ dialog --backtitle "$(backtitle)" --title "HardwareID" \
--yes-label "Retry" --no-label "Cancel" --yesno "HardwareID: ${HWID}\nRegister your HardwareID on\nhttps://arc.auxxxilium.tech (Discord Account needed)." 8 60 --yes-label "Retry" --no-label "Cancel" --yesno "HardwareID: ${HWID}\nRegister your HardwareID on\nhttps://arc.auxxxilium.tech (Discord Account needed)." 7 60
[ $? -ne 0 ] && USERID="" && return 1 [ $? -ne 0 ] && USERID="" && break
writeConfigKey "arc.hwid" "" "${USER_CONFIG_FILE}" writeConfigKey "arc.hwid" "" "${USER_CONFIG_FILE}"
writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}" writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}"
genHardwareID
fi fi
else else
dialog --backtitle "$(backtitle)" --title "HardwareID" \ dialog --backtitle "$(backtitle)" --title "HardwareID" \
--msgbox "HardwareID: Verification failed!" 6 50 --msgbox "HardwareID: ID Generation failed!" 6 50
USERID="" USERID=""
writeConfigKey "arc.hwid" "" "${USER_CONFIG_FILE}" writeConfigKey "arc.hwid" "" "${USER_CONFIG_FILE}"
writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}" writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}"
break
fi fi
done
return return
} }
@ -2285,30 +2290,29 @@ function genHardwareID() {
# Check HardwareID # Check HardwareID
function checkHardwareID() { function checkHardwareID() {
HWID="$(genHWID)" HWID="$(genHWID)"
USERID="$(curl -skL "https://arc.auxxxilium.tech?hwid=${HWID}")" USERID="$(curl -skL "https://arc.auxxxilium.tech?hwid=${HWID}" 2>/dev/null)"
if echo "${USERID}" | grep -vq "Hardware ID"; then if echo "${USERID}" | grep -vq "Hardware ID"; then
writeConfigKey "arc.hwid" "${HWID}" "${USER_CONFIG_FILE}"
writeConfigKey "arc.userid" "${USERID}" "${USER_CONFIG_FILE}"
cp -f "${S_FILE}" "${S_FILE}.bak" cp -f "${S_FILE}" "${S_FILE}.bak"
if curl -skL "https://arc.auxxxilium.tech?hwid=${HWID}&userid=${USERID}" > "${S_FILE}"; then if curl -skL "https://arc.auxxxilium.tech?hwid=${HWID}&userid=${USERID}" -o "${S_FILE}" 2>/dev/null; then
dialog --backtitle "$(backtitle)" --title "HardwareID" \ dialog --backtitle "$(backtitle)" --title "HardwareID" \
--infobox "HardwareID: ${HWID}\nYour HardwareID is registered to UserID: ${USERID}!" 6 70 --infobox "HardwareID: ${HWID}\nYour HardwareID is registered to UserID: ${USERID}!" 6 70
sleep 3 writeConfigKey "arc.hwid" "${HWID}" "${USER_CONFIG_FILE}"
writeConfigKey "arc.userid" "${USERID}" "${USER_CONFIG_FILE}"
else else
dialog --backtitle "$(backtitle)" --title "HardwareID" \
--infobox "HardwareID: Your HardwareID couldn't be verified!" 6 50
USERID=""
writeConfigKey "arc.hwid" "" "${USER_CONFIG_FILE}" writeConfigKey "arc.hwid" "" "${USER_CONFIG_FILE}"
writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}" writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}"
dialog --backtitle "$(backtitle)" --title "HardwareID" \
--infobox "Couldn't verify your HardwareID!\nArc Patch not enabled!" 6 40
USERID=""
cp -f "${S_FILE}.bak" "${S_FILE}"
sleep 3
fi fi
else else
dialog --backtitle "$(backtitle)" --title "HardwareID" \ dialog --backtitle "$(backtitle)" --title "HardwareID" \
--infobox "HardwareID: Verification failed!" 6 50 --infobox "HardwareID: Your HardwareID isn't registered!" 6 50
USERID="" USERID=""
sleep 2 writeConfigKey "arc.hwid" "" "${USER_CONFIG_FILE}"
writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}"
fi fi
sleep 3
return return
} }

View File

@ -94,6 +94,8 @@ function arcModel() {
if [ ! -f "${S_FILE}" ] || [ ! -f "${P_FILE}" ]; then if [ ! -f "${S_FILE}" ] || [ ! -f "${P_FILE}" ]; then
updateConfigs updateConfigs
fi fi
# Check for Hardware ID
checkHardwareID
# Loop menu # Loop menu
RESTRICT=1 RESTRICT=1
PS="$(readConfigEntriesArray "platforms" "${P_FILE}" | sort)" PS="$(readConfigEntriesArray "platforms" "${P_FILE}" | sort)"
@ -151,14 +153,15 @@ function arcModel() {
fi fi
[ -n "$(grep -w "${M}" "${S_FILE}")" ] && BETA="Arc" || BETA="Syno" [ -n "$(grep -w "${M}" "${S_FILE}")" ] && BETA="Arc" || BETA="Syno"
[ -z "$(grep -w "${A}" "${P_FILE}")" ] && COMPATIBLE=0 [ -z "$(grep -w "${A}" "${P_FILE}")" ] && COMPATIBLE=0
if [ -n "${ARCKEY}" ]; then if [ -n "${ARCCONF}" ]; then
[ ${COMPATIBLE} -eq 1 ] && echo -e "${M} \"\t$(printf "\Zb%-15s\Zn \Zb%-5s\Zn \Zb%-5s\Zn \Zb%-12s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "${A}" "${DTS}" "${ARC}" "${IGPUS}" "${HBAS}" "${M_2_CACHE}" "${M_2_STORAGE}" "${USBS}" "${BETA}")\" ">>"${TMP_PATH}/menu" [ ${COMPATIBLE} -eq 1 ] && echo -e "${M} \"\t$(printf "\Zb%-15s\Zn \Zb%-5s\Zn \Zb%-5s\Zn \Zb%-12s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "${A}" "${DTS}" "${ARC}" "${IGPUS}" "${HBAS}" "${M_2_CACHE}" "${M_2_STORAGE}" "${USBS}" "${BETA}")\" ">>"${TMP_PATH}/menu"
else else
[ ${COMPATIBLE} -eq 1 ] && echo -e "${M} \"\t$(printf "\Zb%-15s\Zn \Zb%-5s\Zn \Zb%-12s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "${A}" "${DTS}" "${IGPUS}" "${HBAS}" "${M_2_CACHE}" "${M_2_STORAGE}" "${USBS}" "${BETA}")\" ">>"${TMP_PATH}/menu" [ ${COMPATIBLE} -eq 1 ] && echo -e "${M} \"\t$(printf "\Zb%-15s\Zn \Zb%-5s\Zn \Zb%-12s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "${A}" "${DTS}" "${IGPUS}" "${HBAS}" "${M_2_CACHE}" "${M_2_STORAGE}" "${USBS}" "${BETA}")\" ">>"${TMP_PATH}/menu"
fi fi
done < <(cat "${TMP_PATH}/modellist") done < <(cat "${TMP_PATH}/modellist")
[ -n "${ARCKEY}" ] && MSG="Supported Models for your Hardware (x = supported / + = need Addons)\n$(printf "\Zb%-16s\Zn \Zb%-15s\Zn \Zb%-5s\Zn \Zb%-5s\Zn \Zb%-12s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "Model" "Platform" "DT" "Arc" "Intel iGPU" "HBA" "M.2 Cache" "M.2 Volume" "USB Mount" "Source")" || MSG="Supported Models for your Hardware (x = supported / + = need Addons) | Syno Models can have faulty Values.\n$(printf "\Zb%-16s\Zn \Zb%-15s\Zn \Zb%-5s\Zn \Zb%-12s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "Model" "Platform" "DT" "Intel iGPU" "HBA" "M.2 Cache" "M.2 Volume" "USB Mount" "Source")" ARCCONF="$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")"
[ -n "${ARCKEY}" ] && TITLEMSG="Arc Model" || TITLEMSG="Model" [ -n "${ARCCONF}" ] && MSG="Supported Models for your Hardware (x = supported / + = need Addons)\n$(printf "\Zb%-16s\Zn \Zb%-15s\Zn \Zb%-5s\Zn \Zb%-5s\Zn \Zb%-12s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "Model" "Platform" "DT" "Arc" "Intel iGPU" "HBA" "M.2 Cache" "M.2 Volume" "USB Mount" "Source")" || MSG="Supported Models for your Hardware (x = supported / + = need Addons) | Syno Models can have faulty Values.\n$(printf "\Zb%-16s\Zn \Zb%-15s\Zn \Zb%-5s\Zn \Zb%-12s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "Model" "Platform" "DT" "Intel iGPU" "HBA" "M.2 Cache" "M.2 Volume" "USB Mount" "Source")"
[ -n "${ARCCONF}" ] && TITLEMSG="Arc Model" || TITLEMSG="Model"
dialog --backtitle "$(backtitlep)" --title "${TITLEMSG}" --colors \ dialog --backtitle "$(backtitlep)" --title "${TITLEMSG}" --colors \
--cancel-label "Show all" --help-button --help-label "Exit" \ --cancel-label "Show all" --help-button --help-label "Exit" \
--extra-button --extra-label "Info" \ --extra-button --extra-label "Info" \
@ -671,7 +674,7 @@ function make() {
SN="$(readConfigKey "sn" "${USER_CONFIG_FILE}")" SN="$(readConfigKey "sn" "${USER_CONFIG_FILE}")"
BOOTMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")" BOOTMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
if [ "${BOOTMODE}" != "automated" ] && [ "${ARCOFFLINE}" != "true" ] && [[ "${ARCPATCH}" != "true" || -z "${ARCCONF}" ]]; then if [ "${BOOTMODE}" != "automated" ] && [ "${ARCOFFLINE}" != "true" ] && [[ "${ARCPATCH}" != "true" || -z "${ARCCONF}" ]]; then
if ! curl -skL "https://auxxxilium.tech/check.yml" -o "${TMP_PATH}/check.yml" 2>/dev/null; then if ! curl -skL "https://arc.auxxxilium.tech/check.yml" -o "${TMP_PATH}/check.yml" 2>/dev/null; then
SN=$(generateSerial "${MODEL}" "false") SN=$(generateSerial "${MODEL}" "false")
else else
if grep -q "${SN}" "${TMP_PATH}/check.yml"; then if grep -q "${SN}" "${TMP_PATH}/check.yml"; then

View File

@ -326,7 +326,7 @@ elif [ "${DIRECTBOOT}" == "false" ]; then
echo -e "\033[1;37mBooting DSM...\033[0m" echo -e "\033[1;37mBooting DSM...\033[0m"
# Boot to DSM # Boot to DSM
[ "${KERNELLOAD}" == "kexec" ] && kexec -e || poweroff [ "${KERNELLOAD}" == "kexec" ] && exec kexec -e || exec poweroff
fi fi
exit 0 exit 0

View File

@ -319,8 +319,8 @@ function updateModules() {
############################################################################### ###############################################################################
# Update Configs # Update Configs
function updateConfigs() { function updateConfigs() {
local ARCKEY="$(readConfigKey "arc.key" "${USER_CONFIG_FILE}")"
[ -f "${MODEL_CONFIG_PATH}/VERSION" ] && local CONFIGSVERSION="$(cat "${MODEL_CONFIG_PATH}/VERSION")" || CONFIGSVERSION="0.0.0" [ -f "${MODEL_CONFIG_PATH}/VERSION" ] && local CONFIGSVERSION="$(cat "${MODEL_CONFIG_PATH}/VERSION")" || CONFIGSVERSION="0.0.0"
local USERID="$(readConfigKey "arc.userid" "${USER_CONFIG_FILE}")"
if [ -z "${1}" ]; then if [ -z "${1}" ]; then
idx=0 idx=0
while [ ${idx} -le 5 ]; do # Loop 5 times, if successful, break while [ ${idx} -le 5 ]; do # Loop 5 times, if successful, break
@ -362,6 +362,7 @@ function updateConfigs() {
dialog --backtitle "$(backtitle)" --title "Update Configs" \ dialog --backtitle "$(backtitle)" --title "Update Configs" \
--infobox "Update successful!" 3 50 --infobox "Update successful!" 3 50
sleep 2 sleep 2
[ -z "${USERID}" ] && checkHardwareID || true
else else
return 1 return 1
fi fi

View File

@ -38,7 +38,6 @@ initConfigKey "arc" "{}" "${USER_CONFIG_FILE}"
initConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}" initConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
initConfigKey "arc.confdone" "false" "${USER_CONFIG_FILE}" initConfigKey "arc.confdone" "false" "${USER_CONFIG_FILE}"
initConfigKey "arc.dynamic" "false" "${USER_CONFIG_FILE}" initConfigKey "arc.dynamic" "false" "${USER_CONFIG_FILE}"
initConfigKey "arc.key" "" "${USER_CONFIG_FILE}"
initConfigKey "arc.offline" "false" "${USER_CONFIG_FILE}" initConfigKey "arc.offline" "false" "${USER_CONFIG_FILE}"
initConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}" initConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
initConfigKey "arc.version" "${ARC_VERSION}" "${USER_CONFIG_FILE}" initConfigKey "arc.version" "${ARC_VERSION}" "${USER_CONFIG_FILE}"
@ -156,7 +155,7 @@ elif [ "${ARCMODE}" == "update" ]; then
elif [ "${BUILDDONE}" == "true" ] && [ "${ARCMODE}" == "dsm" ]; then elif [ "${BUILDDONE}" == "true" ] && [ "${ARCMODE}" == "dsm" ]; then
echo -e "\033[1;34mStarting DSM Mode...\033[0m" echo -e "\033[1;34mStarting DSM Mode...\033[0m"
if [ -f "${ARC_PATH}/boot.sh" ]; then if [ -f "${ARC_PATH}/boot.sh" ]; then
boot.sh && exit 0 exec boot.sh && exit 0
else else
echo -e "\033[1;31mError: Can't find Arc System Files...\033[0m" echo -e "\033[1;31mError: Can't find Arc System Files...\033[0m"
fi fi