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 #3162

Merged
merged 8 commits into from
Aug 24, 2024
Merged

Dev #3162

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
47 changes: 41 additions & 6 deletions files/initrd/opt/arc/arc-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function addonSelection() {
touch "${TMP_PATH}/opts"
while read -r ADDON DESC; do
arrayExistItem "${ADDON}" "${!ADDONS[@]}" && ACT="on" || ACT="off"
if [ "${ADDON}" == "amepatch" ] && [ "${ARCPATCH}" == "false" ]; then
if [[ "${ADDON}" == "amepatch" || "${ADDON}" == "sspatch" || "${ADDON}" == "arcdns" ]] && [ "${ARCPATCH}" == "false" ]; then
continue
else
echo -e "${ADDON} \"${DESC}\" ${ACT}" >>"${TMP_PATH}/opts"
Expand Down Expand Up @@ -687,6 +687,43 @@ 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 "addons.arcdns" "${USER_CONFIG_FILE}")"
domain="$(echo ${ARCDNS} | cut -d'/' -f1)"
token="$(echo ${ARCDNS} | cut -d'/' -f2)"
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:-domain}" 1 10 50 0 "Token:" 2 1 "${token:-token}" 2 10 50 0 \
2>"${TMP_PATH}/resp"
[ $? -ne 0 ] && break
domain="$(cat "${TMP_PATH}/resp" | sed -n '1p')"
token="$(cat "${TMP_PATH}/resp" | sed -n '2p')"
if [ -z "${domain}" ] || [ -z "${token}" ] || [ "${domain}" = "domain" ] || [ "${token}" = "token" ]; then
dialog --backtitle "$(backtitle)" --title "ArcDNS" \
--infobox "Invalid Domain or Token, retry!" 0 0
deleteConfigKey "addons.arcdns" "${USER_CONFIG_FILE}"
sleep 3
continue
else
ARCDNS="${domain}/${token}"
dialog --backtitle "$(backtitle)" --colors --title "ArcDNS" \
--msgbox "ArcDNS set successful!" 0 0
writeConfigKey "addons.arcdns" "${ARCDNS}" "${USER_CONFIG_FILE}"
break
fi
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 Expand Up @@ -837,7 +874,7 @@ function updateMenu() {
7 "Update Modules" \
8 "Update Patches" \
9 "Update Custom Kernel" \
0 "Branch: (${ARCBRANCH:-"stable"})" \
0 "Branch: ${ARCBRANCH}" \
2>"${TMP_PATH}/resp"
[ $? -ne 0 ] && break
case "$(cat ${TMP_PATH}/resp)" in
Expand Down Expand Up @@ -1065,11 +1102,9 @@ function updateMenu() {
opts=$(cat ${TMP_PATH}/opts)
[ -z "${opts}" ] && return 1
if [ ${opts} -eq 1 ]; then
writeConfigKey "arc.branch" "" "${USER_CONFIG_FILE}"
rm -f "${PART1_PATH}/ARC-BRANCH"
writeConfigKey "arc.branch" "stable" "${USER_CONFIG_FILE}"
elif [ ${opts} -eq 2 ]; then
writeConfigKey "arc.branch" "next" "${USER_CONFIG_FILE}"
echo "next" >"${PART1_PATH}/ARC-BRANCH"
fi
ARCBRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
dialog --backtitle "$(backtitle)" --title "Switch Buildsystem" --aspect 18 \
Expand Down Expand Up @@ -1216,7 +1251,7 @@ function sysinfo() {
done
# Print Config Informations
TEXT+="\n\Z4> Arc: ${ARC_VERSION}\Zn"
[ -n "${ARCBRANCH}" ] && TEXT+="\n Branch: \Zb${ARCBRANCH}\Zn"
TEXT+="\n Branch: \Zb${ARCBRANCH}\Zn"
TEXT+="\n Subversion: \ZbAddons ${ADDONSVERSION} | Configs ${CONFIGSVERSION} | LKM ${LKMVERSION} | Modules ${MODULESVERSION} | Patches ${PATCHESVERSION}\Zn"
TEXT+="\n Config | Build: \Zb${CONFDONE} | ${BUILDDONE}\Zn"
TEXT+="\n Config Version: \Zb${CONFIGVER}\Zn"
Expand Down
10 changes: 7 additions & 3 deletions 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 @@ -1053,12 +1056,12 @@ else
d) modulesMenu; NEXT="d" ;;
g) governorMenu; NEXT="g" ;;
e) ONLYVERSION="true" && arcVersion; NEXT="e" ;;
p) ONLYPATCH="true" && arcPatch; NEXT="p" ;;
S) storageMenu; NEXT="S" ;;
o) dtsMenu; NEXT="o" ;;
P) storagepanelMenu; NEXT="P" ;;
Q) sequentialIOMenu; NEXT="Q" ;;
p) ONLYPATCH="true" && arcPatch; NEXT="p" ;;
D) staticIPMenu; NEXT="D" ;;
R) arcDNSMenu; NEXT="R" ;;
r) resetArcPatch; NEXT="r" ;;
# Boot Section
6) [ "${BOOTOPTS}" == "true" ] && BOOTOPTS='false' || BOOTOPTS='true'
Expand All @@ -1085,6 +1088,7 @@ else
s) downgradeMenu; NEXT="s" ;;
t) resetPassword; NEXT="t" ;;
N) addNewDSMUser; NEXT="N" ;;
D) staticIPMenu; NEXT="D" ;;
J) resetDSMNetwork; NEXT="J" ;;
K) [ "${KERNEL}" == "official" ] && KERNEL='custom' || KERNEL='official'
writeConfigKey "kernel" "${KERNEL}" "${USER_CONFIG_FILE}"
Expand Down
3 changes: 2 additions & 1 deletion files/initrd/opt/arc/boot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ rm -rf /sys/fs/pstore/* >/dev/null 2>&1 || true

BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
[ "${BUILDDONE}" = "false" ] && die "Loader build not completed!"
ARCBRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"

# Get Loader Disk Bus
[ -z "${LOADER_DISK}" ] && die "Loader Disk not found!"
Expand All @@ -24,7 +25,7 @@ clear
COLUMNS=${COLUMNS:-50}
BANNER="$(figlet -c -w "$(((${COLUMNS})))" "Arc Loader")"
TITLE="Version:"
TITLE+=" ${ARC_TITLE}"
TITLE+=" ${ARC_TITLE} | ${ARCBRANCH}"
printf "\033[1;30m%*s\n" ${COLUMNS} ""
printf "\033[1;30m%*s\033[A\n" ${COLUMNS} ""
printf "\033[1;34m%*s\033[0m\n" ${COLUMNS} "${BANNER}"
Expand Down
4 changes: 2 additions & 2 deletions files/initrd/opt/arc/include/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function upgradeLoader () {
(
# Download update file
echo "Downloading ${TAG}"
if [ -n "${ARCBRANCH}" ]; then
if [ "${ARCBRANCH}" != "stable" ]; then
local URL="https://github.com/AuxXxilium/arc/releases/download/${TAG}/arc-${TAG}-${ARCBRANCH}.img.zip"
else
local URL="https://github.com/AuxXxilium/arc/releases/download/${TAG}/arc-${TAG}.img.zip"
Expand Down Expand Up @@ -141,7 +141,7 @@ function updateLoader() {
(
# Download update file
echo "Downloading ${TAG}"
if [ -n "${ARCBRANCH}" ]; then
if [ "${ARCBRANCH}" != "stable" ]; then
local URL="https://github.com/AuxXxilium/arc/releases/download/${TAG}/update-${ARCBRANCH}.zip"
local SHA="https://github.com/AuxXxilium/arc/releases/download/${TAG}/checksum-${ARCBRANCH}.sha256"
else
Expand Down
6 changes: 5 additions & 1 deletion files/initrd/opt/arc/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ fi
# Config Init
initConfigKey "addons" "{}" "${USER_CONFIG_FILE}"
initConfigKey "arc" "{}" "${USER_CONFIG_FILE}"
initConfigKey "arc.branch" "" "${USER_CONFIG_FILE}"
initConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
initConfigKey "arc.confdone" "false" "${USER_CONFIG_FILE}"
initConfigKey "arc.dynamic" "false" "${USER_CONFIG_FILE}"
Expand Down Expand Up @@ -85,7 +86,10 @@ if grep -q "automated_arc" /proc/cmdline; then
else
writeConfigKey "automated" "false" "${USER_CONFIG_FILE}"
fi
[ -f "${PART1_PATH}/ARC-BRANCH" ] && writeConfigKey "arc.branch" "next" "${USER_CONFIG_FILE}" || writeConfigKey "arc.branch" "" "${USER_CONFIG_FILE}"
if [ -f "${PART1_PATH}/ARC-BRANCH" ]; then
ARCBRANCH=$(cat "${PART1_PATH}/ARC-BRANCH") && writeConfigKey "arc.branch" "${ARCBRANCH}" "${USER_CONFIG_FILE}"
rm -f "${PART1_PATH}/ARC-BRANCH" >/dev/null 2>&1 || true
fi
[ -f "${PART3_PATH}/automated" ] && rm -f "${PART3_PATH}/automated" >/dev/null 2>&1 || true
# Check for compatibility
compatboot
Expand Down
1 change: 1 addition & 0 deletions img-gen-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ sudo mount ${LOOPX}p3 "/tmp/p3"
VERSION=$(date +'%y.%-m.dev')
echo "${VERSION}" >files/p1/ARC-VERSION
echo "${VERSION}" >VERSION
echo "stable" >files/p1/ARC-BRANCH
sed 's/^ARC_VERSION=.*/ARC_VERSION="'${VERSION}'"/' -i files/initrd/opt/arc/include/consts.sh

echo "Repack initrd"
Expand Down
1 change: 1 addition & 0 deletions img-gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ sudo mount ${LOOPX}p3 "/tmp/p3"
VERSION=$(date +'%y.%-m.dev')
echo "${VERSION}" >files/p1/ARC-VERSION
echo "${VERSION}" >VERSION
echo "stable" >files/p1/ARC-BRANCH
sed 's/^ARC_VERSION=.*/ARC_VERSION="'${VERSION}'"/' -i files/initrd/opt/arc/include/consts.sh

echo "Repack initrd"
Expand Down
Loading