Skip to content

Commit

Permalink
arc-functions: add something new
Browse files Browse the repository at this point in the history
Signed-off-by: AuxXxilium <[email protected]>
  • Loading branch information
AuxXxilium committed Aug 24, 2024
1 parent 8949e72 commit 646d7ce
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
33 changes: 33 additions & 0 deletions files/initrd/opt/arc/arc-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,39 @@ function sequentialIOMenu() {
return
}

###############################################################################
# Shows arcDNS menu to user
function arcDNSMenu() {
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
if [ "${CONFDONE}" == "true" ]; then
while true; do
ARCDNS="$(readConfigKey "arc.dns" "${USER_CONFIG_FILE}")"
MSG="Register your Subdomain at arcdns.tech\n"
MSG+="Enter the Values from ArcDNS below:\n"
dialog --backtitle "$(backtitle)" --title "Add DSM User" \
--form "${MSG}" 8 60 3 "Domain:" 1 1 "domain" 1 10 50 0 "Token:" 2 1 "token" 2 10 50 0 \
2>"${TMP_PATH}/resp"
[ $? -ne 0 ] && return
domain="$(cat "${TMP_PATH}/resp" | sed -n '1p')"
token="$(cat "${TMP_PATH}/resp" | sed -n '2p')"
if [ -z "${domain}" ] || [ -z "${token}" ]; then
dialog --backtitle "$(backtitle)" --title "ArcDNS" \
--msgbox "Invalid Domain or Token, retry!" 0 0
continue
else
ARCDNS="https://arcdns.tech/update/${domain}/${token}"
dialog --backtitle "$(backtitle)" --colors --title "ArcDNS" \
--msgbox "ArcDNS set successful!" 0 0
fi
writeConfigKey "arc.dns" "${ARCDNS}" "${USER_CONFIG_FILE}"
break
done
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
fi
return
}

###############################################################################
# Shows backup menu to user
function backupMenu() {
Expand Down
6 changes: 5 additions & 1 deletion files/initrd/opt/arc/arc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ function arcSettings() {
}

###############################################################################
# Calls boot.sh to boot into DSM Recovery
# Show Summary of Config
function arcSummary() {
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
Expand Down Expand Up @@ -951,6 +951,9 @@ else
if readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "sequentialio"; then
echo "Q \"SequentialIO Options \" " >>"${TMP_PATH}/menu"
fi
if readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "arcdns"; then
echo "R \"ArcDNS Options \" " >>"${TMP_PATH}/menu"
fi
if [ -n "${ARCKEY}" ]; then
echo "r \"Reset Arc Patch \" " >>"${TMP_PATH}/menu"
fi
Expand Down Expand Up @@ -1057,6 +1060,7 @@ else
o) dtsMenu; NEXT="o" ;;
P) storagepanelMenu; NEXT="P" ;;
Q) sequentialIOMenu; NEXT="Q" ;;
Q) arcDNSMenu; NEXT="Q" ;;
p) ONLYPATCH="true" && arcPatch; NEXT="p" ;;
D) staticIPMenu; NEXT="D" ;;
r) resetArcPatch; NEXT="r" ;;
Expand Down
3 changes: 3 additions & 0 deletions files/initrd/opt/arc/ramdisk-patch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
BUILDNUM="$(readConfigKey "buildnum" "${USER_CONFIG_FILE}")"
SMALLNUM="$(readConfigKey "smallnum" "${USER_CONFIG_FILE}")"
ARCBRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
ARCDNS="$(readConfigKey "arc.dns" "${USER_CONFIG_FILE}")"
# Read new PAT Info from Config
PAT_URL="$(readConfigKey "paturl" "${USER_CONFIG_FILE}")"
PAT_HASH="$(readConfigKey "pathash" "${USER_CONFIG_FILE}")"
Expand Down Expand Up @@ -179,6 +180,8 @@ for ADDON in "redpill" "revert" "misc" "eudev" "disks" "localrss" "notify" "upda
[ -f "${USER_UP_PATH}/${MODEL}.dts" ] && cp -f "${USER_UP_PATH}/${MODEL}.dts" "${RAMDISK_PATH}/addons/model.dts"
elif [ "${ADDON}" == "cpufreqscaling" ]; then
PARAMS=${CPUGOVERNOR}
elif [ "${ADDON}" == "arcdns" ]; then
PARAMS=${ARCDNS}
fi
installAddon "${ADDON}" "${PLATFORM}" || exit 1
echo "/addons/${ADDON}.sh \${1} ${PARAMS}" >>"${RAMDISK_PATH}/addons/addons.sh" 2>>"${LOG_FILE}" || exit 1
Expand Down

0 comments on commit 646d7ce

Please sign in to comment.