Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
62b8ec0a0b | ||
|
|
b4874b6e77 | ||
|
|
5a4d341267 | ||
|
|
1ea4215393 | ||
|
|
95c7032602 | ||
|
|
2877465fb4 | ||
|
|
bd156aff6e | ||
|
|
7746eb3ca7 | ||
|
|
c4a6d4ccd3 | ||
|
|
5310500b1a | ||
|
|
b89c67f115 | ||
|
|
5b7e4e68cc | ||
|
|
ac5d39ec71 | ||
|
|
23142cefb5 | ||
|
|
6d90c3a187 | ||
|
|
b23429fdc6 | ||
|
|
c9c502be88 | ||
|
|
d9084b90fc | ||
|
|
0877680812 | ||
|
|
16f166d17a | ||
|
|
9f3ac81146 | ||
|
|
355f30b899 | ||
|
|
2c57429fdb | ||
|
|
8c432b7335 | ||
|
|
bc32568f19 | ||
|
|
7766f57fef | ||
|
|
39d2ce6344 | ||
|
|
8e1442eb66 |
4
.github/workflows/grub.yml
vendored
4
.github/workflows/grub.yml
vendored
@@ -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.
|
||||
@@ -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
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -9,15 +9,12 @@
|
||||
. "${ARC_PATH}/include/addons.sh"
|
||||
. "${ARC_PATH}/include/modules.sh"
|
||||
. "${ARC_PATH}/include/update.sh"
|
||||
. "${ARC_PATH}/include/storage.sh"
|
||||
. "${ARC_PATH}/include/network.sh"
|
||||
|
||||
# Get Keymap and Timezone and check System
|
||||
onlineCheck
|
||||
KEYMAP="$(readConfigKey "keymap" "${USER_CONFIG_FILE}")"
|
||||
ARCOFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")"
|
||||
systemCheck
|
||||
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
readData
|
||||
|
||||
###############################################################################
|
||||
@@ -26,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} | "
|
||||
@@ -36,702 +33,6 @@ function backtitle() {
|
||||
echo "${BACKTITLE}"
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Model Selection
|
||||
function arcModel() {
|
||||
[ "${ARCOFFLINE}" != "true" ] && checkHardwareID || true
|
||||
dialog --backtitle "$(backtitle)" --title "Model" \
|
||||
--infobox "Reading Models..." 3 25
|
||||
ARCCONF="$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")"
|
||||
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
# Loop menu
|
||||
RESTRICT=1
|
||||
PS="$(readConfigEntriesArray "platforms" "${P_FILE}" | sort)"
|
||||
echo -n "" >"${TMP_PATH}/modellist"
|
||||
while read -r P; do
|
||||
PM="$(readConfigEntriesArray "${P}" "${D_FILE}" | sort)"
|
||||
while read -r M; do
|
||||
echo "${M} ${P}" >>"${TMP_PATH}/modellist"
|
||||
done < <(echo "${PM}")
|
||||
done < <(echo "${PS}")
|
||||
if [ "${ARCMODE}" = "config" ]; then
|
||||
while true; do
|
||||
echo -n "" >"${TMP_PATH}/menu"
|
||||
while read -r M A; do
|
||||
COMPATIBLE=1
|
||||
DT="$(readConfigKey "platforms.${A}.dt" "${P_FILE}")"
|
||||
FLAGS="$(readConfigArray "platforms.${A}.flags" "${P_FILE}")"
|
||||
ARCCONFM="$(readConfigKey "${M}.serial" "${S_FILE}")"
|
||||
ARC=""
|
||||
BETA=""
|
||||
[ -n "${ARCCONFM}" ] && ARC="x" || ARC=""
|
||||
[ "${DT}" = "true" ] && DTS="x" || DTS=""
|
||||
IGPU=""
|
||||
IGPUS=""
|
||||
IGPUID="$(lspci -nd ::300 2>/dev/null | grep "8086" | cut -d' ' -f3 | sed 's/://g')"
|
||||
if [ -n "${IGPUID}" ]; then grep -iq "${IGPUID}" ${ARC_PATH}/include/i915ids && IGPU="all" || IGPU="epyc7002"; else IGPU=""; fi
|
||||
if [[ "${A}" = "apollolake" || "${A}" = "geminilake" ]] && [ "${IGPU}" = "all" ]; then
|
||||
IGPUS="+"
|
||||
elif [ "${A}" = "epyc7002" ] && [[ "${IGPU}" = "epyc7002" || "${IGPU}" = "all" ]]; then
|
||||
IGPUS="x"
|
||||
else
|
||||
IGPUS=""
|
||||
fi
|
||||
[ "${DT}" = "true" ] && HBAS="" || HBAS="x"
|
||||
[ "${M}" = "SA6400" ] && HBAS="x"
|
||||
[ "${DT}" = "false" ] && USBS="int/ext" || USBS="ext"
|
||||
M_2_CACHE="x"
|
||||
[[ "${M}" = "DS220+" || "${M}" = "DS224+" ]] && M_2_CACHE=""
|
||||
[[ "${M}" = "DS220+" || "${M}" = "DS224+" || "${DT}" = "false" ]] && M_2_STORAGE="" || M_2_STORAGE="+"
|
||||
# Check id model is compatible with CPU
|
||||
if [ ${RESTRICT} -eq 1 ]; then
|
||||
for F in ${FLAGS}; do
|
||||
if ! grep -q "^flags.*${F}.*" /proc/cpuinfo; then
|
||||
COMPATIBLE=0
|
||||
fi
|
||||
done
|
||||
if [ "${A}" != "epyc7002" ] && [ "${DT}" = "true" ] && [ "${EXTERNALCONTROLLER}" = "true" ]; then
|
||||
COMPATIBLE=0
|
||||
fi
|
||||
if [ "${A}" != "epyc7002" ] && [ ${SATACONTROLLER} -eq 0 ] && [ "${EXTERNALCONTROLLER}" = "false" ]; then
|
||||
COMPATIBLE=0
|
||||
fi
|
||||
if [ "${A}" = "epyc7002" ] && [[ ${SCSICONTROLLER} -ne 0 || ${RAIDCONTROLLER} -ne 0 ]]; then
|
||||
COMPATIBLE=0
|
||||
fi
|
||||
if [ "${A}" != "epyc7002" ] && [ ${NVMEDRIVES} -gt 0 ] && [ "${BUS}" = "usb" ] && [ ${SATADRIVES} -eq 0 ] && [ "${EXTERNALCONTROLLER}" = "false" ]; then
|
||||
COMPATIBLE=0
|
||||
elif [ "${A}" != "epyc7002" ] && [ ${NVMEDRIVES} -gt 0 ] && [ "${BUS}" = "sata" ] && [ ${SATADRIVES} -eq 1 ] && [ "${EXTERNALCONTROLLER}" = "false" ]; then
|
||||
COMPATIBLE=0
|
||||
fi
|
||||
[ -z "$(grep -w "${M}" "${S_FILE}")" ] && COMPATIBLE=0
|
||||
fi
|
||||
[ -n "$(grep -w "${M}" "${S_FILE}")" ] && BETA="Arc" || BETA="Syno"
|
||||
[ -z "$(grep -w "${A}" "${P_FILE}")" ] && COMPATIBLE=0
|
||||
if [ -n "${ARCCONF}" ]; then
|
||||
[ ${COMPATIBLE} -eq 1 ] && echo -e "${M} \"\t$(printf "\Zb%-15s\Zn \Zb%-5s\Zn \Zb%-5s\Zn \Zb%-5s\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
|
||||
[ ${COMPATIBLE} -eq 1 ] && echo -e "${M} \"\t$(printf "\Zb%-15s\Zn \Zb%-5s\Zn \Zb%-5s\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
|
||||
done < <(cat "${TMP_PATH}/modellist")
|
||||
ARCCONF="$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")"
|
||||
[ -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%-5s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "Model" "Platform" "DT" "Arc" "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%-5s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "Model" "Platform" "DT" "iGPU" "HBA" "M.2 Cache" "M.2 Volume" "USB Mount" "Source")"
|
||||
[ -n "${ARCCONF}" ] && TITLEMSG="Arc Model" || TITLEMSG="Model"
|
||||
dialog --backtitle "$(backtitle)" --title "${TITLEMSG}" --colors \
|
||||
--cancel-label "Show all" --help-button --help-label "Exit" \
|
||||
--extra-button --extra-label "Info" \
|
||||
--menu "${MSG}" 0 115 0 \
|
||||
--file "${TMP_PATH}/menu" 2>"${TMP_PATH}/resp"
|
||||
RET=$?
|
||||
case ${RET} in
|
||||
0)
|
||||
resp=$(cat ${TMP_PATH}/resp)
|
||||
[ -z "${resp}" ] && return
|
||||
break
|
||||
;;
|
||||
1)
|
||||
[ ${RESTRICT} -eq 1 ] && RESTRICT=0 || RESTRICT=1
|
||||
;;
|
||||
3)
|
||||
resp=$(cat ${TMP_PATH}/resp)
|
||||
PLATFORM="$(grep -w "${resp}" "${TMP_PATH}/modellist" | awk '{print $2}' | head -n 1)"
|
||||
dialog --backtitle "$(backtitle)" --colors \
|
||||
--title "Platform Info" --textbox "./informations/${PLATFORM}.yml" 70 80
|
||||
;;
|
||||
*)
|
||||
return
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
# Reset Model Config if changed
|
||||
if [ "${ARCMODE}" = "config" ] && [ "${MODEL}" != "${resp}" ]; then
|
||||
MODEL="${resp}"
|
||||
writeConfigKey "addons" "{}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "arc.remap" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "buildnum" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "cmdline" "{}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "emmcboot" "false" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "hddsort" "false" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "kernel" "official" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "odp" "false" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "model" "${MODEL}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "paturl" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "pathash" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "platform" "${PLATFORM}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "productver" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "ramdisk-hash" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "smallnum" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "sn" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "zimage-hash" "" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
PLATFORM="$(grep -w "${MODEL}" "${TMP_PATH}/modellist" | awk '{print $2}' | head -1)"
|
||||
writeConfigKey "platform" "${PLATFORM}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "arc.confdone" "false" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
|
||||
# Read Platform Data
|
||||
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
|
||||
EMMCBOOT="$(readConfigKey "emmcboot" "${USER_CONFIG_FILE}")"
|
||||
HDDSORT="$(readConfigKey "hddsort" "${USER_CONFIG_FILE}")"
|
||||
KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
|
||||
ODP="$(readConfigKey "odp" "${USER_CONFIG_FILE}")"
|
||||
arcVersion
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Arc Version Section
|
||||
function arcVersion() {
|
||||
# Read Model Config
|
||||
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
|
||||
DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")"
|
||||
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
|
||||
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
# Get PAT Data from Config
|
||||
PAT_URL_CONF="$(readConfigKey "paturl" "${USER_CONFIG_FILE}")"
|
||||
PAT_HASH_CONF="$(readConfigKey "pathash" "${USER_CONFIG_FILE}")"
|
||||
# Check for Custom Build
|
||||
if [ "${ARCMODE}" = "config" ] && [ "${ARCRESTORE}" != "true" ]; then
|
||||
# Select Build for DSM
|
||||
ITEMS="$(readConfigEntriesArray "platforms.${PLATFORM}.productvers" "${P_FILE}" | sort -r)"
|
||||
dialog --clear --no-items --nocancel --title "DSM Version" --backtitle "$(backtitle)" \
|
||||
--no-items --menu "Select DSM Version" 7 30 0 ${ITEMS} \
|
||||
2>"${TMP_PATH}/resp"
|
||||
[ $? -ne 0 ] && return
|
||||
resp=$(cat ${TMP_PATH}/resp)
|
||||
[ -z "${resp}" ] && return
|
||||
if [ "${PRODUCTVER}" != "${resp}" ]; then
|
||||
PRODUCTVER="${resp}"
|
||||
writeConfigKey "productver" "${PRODUCTVER}" "${USER_CONFIG_FILE}"
|
||||
# Reset Config if changed
|
||||
writeConfigKey "buildnum" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "paturl" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "pathash" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "ramdisk-hash" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "smallnum" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "zimage-hash" "" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
dialog --backtitle "$(backtitle)" --title "Version" \
|
||||
--infobox "Reading DSM Build..." 3 25
|
||||
PAT_URL=""
|
||||
PAT_HASH=""
|
||||
URLVER=""
|
||||
while true; do
|
||||
PVS="$(readConfigEntriesArray "${PLATFORM}.\"${MODEL}\"" "${D_FILE}" | sort -r)"
|
||||
echo -n "" >"${TMP_PATH}/versions"
|
||||
while read -r V; do
|
||||
if [ "${V:0:3}" != "${PRODUCTVER}" ] || [ "${V}" = "${PREV}" ]; then
|
||||
continue
|
||||
else
|
||||
echo "${V}" >>"${TMP_PATH}/versions"
|
||||
fi
|
||||
PREV="${V}"
|
||||
done < <(echo "${PVS}")
|
||||
DSMPVS="$(cat ${TMP_PATH}/versions)"
|
||||
dialog --backtitle "$(backtitle)" --colors --title "DSM Build" \
|
||||
--no-items --menu "Select DSM Build" 0 0 0 ${DSMPVS} \
|
||||
2>${TMP_PATH}/resp
|
||||
RET=$?
|
||||
[ ${RET} -ne 0 ] && return
|
||||
PV=$(cat ${TMP_PATH}/resp)
|
||||
PAT_URL="$(readConfigKey "${PLATFORM}.\"${MODEL}\".\"${PV}\".url" "${D_FILE}")"
|
||||
PAT_HASH="$(readConfigKey "${PLATFORM}.\"${MODEL}\".\"${PV}\".hash" "${D_FILE}")"
|
||||
writeConfigKey "productver" "${PV:0:3}" "${USER_CONFIG_FILE}"
|
||||
if [ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ]; then
|
||||
VALID="true"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ -z "${PAT_URL}" ] || [ -z "${PAT_HASH}" ]; then
|
||||
while true; do
|
||||
MSG="Failed to get PAT Data.\n"
|
||||
MSG+="Please manually fill in the URL and Hash of PAT.\n"
|
||||
MSG+="You will find these Data at: https://github.com/AuxXxilium/arc-dsm/blob/main/webdata.txt"
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Arc Build" --default-button "OK" \
|
||||
--form "${MSG}" 11 120 2 "Url" 1 1 "${PAT_URL}" 1 8 110 0 "Hash" 2 1 "${PAT_HASH}" 2 8 110 0 \
|
||||
2>"${TMP_PATH}/resp"
|
||||
RET=$?
|
||||
[ ${RET} -ne 0 ] && return
|
||||
PAT_URL="$(cat "${TMP_PATH}/resp" | sed -n '1p')"
|
||||
PAT_HASH="$(cat "${TMP_PATH}/resp" | sed -n '2p')"
|
||||
[ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ] && VALID="true" && break
|
||||
done
|
||||
fi
|
||||
if [ "${PAT_URL}" != "${PAT_URL_CONF}" ] || [ "${PAT_HASH}" != "${PAT_HASH_CONF}" ]; then
|
||||
writeConfigKey "paturl" "${PAT_URL}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "pathash" "${PAT_HASH}" "${USER_CONFIG_FILE}"
|
||||
rm -f "${ORI_ZIMAGE_FILE}" "${ORI_RDGZ_FILE}" "${MOD_ZIMAGE_FILE}" "${MOD_RDGZ_FILE}" >/dev/null 2>&1 || true
|
||||
rm -f "${PART1_PATH}/grub_cksum.syno" "${PART1_PATH}/GRUB_VER" >/dev/null 2>&1 || true
|
||||
rm -f "${USER_UP_PATH}/"*.tar >/dev/null 2>&1 || true
|
||||
fi
|
||||
if [ "${ONLYVERSION}" != "true" ]; then
|
||||
MSG="Do you want to try Automated Mode?\nIf yes, Loader will configure, build and boot DSM."
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Automated Mode" \
|
||||
--yesno "${MSG}" 6 55
|
||||
if [ $? -eq 0 ]; then
|
||||
writeConfigKey "arc.mode" "automated" "${USER_CONFIG_FILE}"
|
||||
else
|
||||
writeConfigKey "arc.mode" "config" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
fi
|
||||
elif [ "${ARCMODE}" = "automated" ] || [ "${ARCRESTORE}" = "true" ]; then
|
||||
VALID="true"
|
||||
fi
|
||||
# Change Config if Files are valid
|
||||
if [ "${VALID}" = "true" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Arc Config" \
|
||||
--infobox "Reconfiguring Cmdline, Modules and Synoinfo" 3 60
|
||||
# Reset Synoinfo
|
||||
writeConfigKey "synoinfo" "{}" "${USER_CONFIG_FILE}"
|
||||
while IFS=': ' read -r KEY VALUE; do
|
||||
writeConfigKey "synoinfo.\"${KEY}\"" "${VALUE}" "${USER_CONFIG_FILE}"
|
||||
done < <(readConfigMap "platforms.${PLATFORM}.synoinfo" "${P_FILE}")
|
||||
# Reset Modules
|
||||
KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
|
||||
[ "${PLATFORM}" = "epyc7002" ] && KVERP="${PRODUCTVER}-${KVER}" || KVERP="${KVER}"
|
||||
if [ -n "${PLATFORM}" ] && [ -n "${KVERP}" ]; then
|
||||
writeConfigKey "modules" "{}" "${USER_CONFIG_FILE}"
|
||||
mergeConfigModules "$(getAllModules "${PLATFORM}" "${KVERP}" | awk '{print $1}')" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
# Check Addons for Platform
|
||||
ADDONS="$(readConfigKey "addons" "${USER_CONFIG_FILE}")"
|
||||
DEVICENIC="$(readConfigKey "device.nic" "${USER_CONFIG_FILE}")"
|
||||
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")"
|
||||
if [ "${ADDONS}" = "{}" ]; then
|
||||
initConfigKey "addons.acpid" "" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "addons.cpuinfo" "" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "addons.storagepanel" "" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "addons.updatenotify" "" "${USER_CONFIG_FILE}"
|
||||
if [ ${NVMEDRIVES} -gt 0 ]; then
|
||||
if [ "${PLATFORM}" = "epyc7002" ] && [ ${SATADRIVES} -eq 0 ] && [ ${SASDRIVES} -eq 0 ]; then
|
||||
initConfigKey "addons.nvmesystem" "" "${USER_CONFIG_FILE}"
|
||||
elif [ "${MODEL}" = "DS918+" ] || [ "${MODEL}" = "DS1019+" ] || [ "${MODEL}" = "DS1621xs+" ] || [ "${MODEL}" = "RS1619xs+" ]; then
|
||||
initConfigKey "addons.nvmecache" "" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "addons.nvmevolume" "" "${USER_CONFIG_FILE}"
|
||||
else
|
||||
initConfigKey "addons.nvmevolume" "" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
fi
|
||||
if [ "${MACHINE}" = "Native" ]; then
|
||||
initConfigKey "addons.cpufreqscaling" "" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "addons.powersched" "" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "addons.sensors" "" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
if [ "${PLATFORM}" = "apollolake" ] || [ "${PLATFORM}" = "geminilake" ]; then
|
||||
if [ -n "${IGPUID}" ]; then grep -iq "${IGPUID}" ${ARC_PATH}/include/i915ids && IGPU="all" || IGPU="epyc7002"; else IGPU=""; fi
|
||||
[ "${IGPU}"="all" ] && initConfigKey "addons.i915" "" "${USER_CONFIG_FILE}" || true
|
||||
fi
|
||||
if echo "${PAT_URL}" 2>/dev/null | grep -q "7.2.2"; then
|
||||
initConfigKey "addons.allowdowngrade" "" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
if [ -n "${ARCCONF}" ]; then
|
||||
initConfigKey "addons.arcdns" "" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
if [ ${SASDRIVES} -gt 0 ] && [ "${DT}" = "false" ]; then
|
||||
initConfigKey "addons.smartctl" "" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
fi
|
||||
while IFS=': ' read -r ADDON PARAM; do
|
||||
[ -z "${ADDON}" ] && continue
|
||||
if ! checkAddonExist "${ADDON}" "${PLATFORM}"; then
|
||||
deleteConfigKey "addons.\"${ADDON}\"" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
done < <(readConfigMap "addons" "${USER_CONFIG_FILE}")
|
||||
# Check for Only Version
|
||||
if [ "${ONLYVERSION}" = "true" ]; then
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
ONLYVERSION="false"
|
||||
return
|
||||
else
|
||||
arcPatch
|
||||
fi
|
||||
else
|
||||
dialog --backtitle "$(backtitle)" --title "Arc Config" --aspect 18 \
|
||||
--infobox "Arc Config failed!\nExit." 4 40
|
||||
writeConfigKey "arc.confdone" "false" "${USER_CONFIG_FILE}"
|
||||
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
|
||||
sleep 5
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Arc Patch Section
|
||||
function arcPatch() {
|
||||
# Read Model Values
|
||||
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
|
||||
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")"
|
||||
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
if [ "${ARCMODE}" = "automated" ] && [ "${ARCPATCH}" != "user" ]; then
|
||||
if [ -n "${ARCCONF}" ]; then
|
||||
generate_and_write_serial "true"
|
||||
else
|
||||
generate_and_write_serial "false"
|
||||
fi
|
||||
elif [ "${ARCMODE}" = "config" ]; then
|
||||
if [ -n "${ARCCONF}" ]; then
|
||||
dialog --clear --backtitle "$(backtitle)" \
|
||||
--nocancel --title "SN/Mac Options" \
|
||||
--menu "Choose an Option" 7 60 0 \
|
||||
1 "Use Arc Patch (AME, QC, Push Notify and more)" \
|
||||
2 "Use random SN/Mac (Reduced DSM Features)" \
|
||||
3 "Use my own SN/Mac (Be sure your Data is valid)" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
else
|
||||
dialog --clear --backtitle "$(backtitle)" \
|
||||
--nocancel --title "SN/Mac Options" \
|
||||
--menu "Choose an Option" 7 60 0 \
|
||||
2 "Use random SN/Mac (Reduced DSM Features)" \
|
||||
3 "Use my own SN/Mac (Be sure your Data is valid)" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
fi
|
||||
|
||||
resp=$(cat "${TMP_PATH}/resp")
|
||||
[ -z "${resp}" ] && return 1
|
||||
|
||||
case ${resp} in
|
||||
1)
|
||||
generate_and_write_serial "true"
|
||||
;;
|
||||
2)
|
||||
generate_and_write_serial "false"
|
||||
;;
|
||||
3)
|
||||
while true; do
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Serial" \
|
||||
--inputbox "Please enter a valid SN!" 7 50 "" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
[ $? -ne 0 ] && break 2
|
||||
SN="$(cat "${TMP_PATH}/resp" | tr '[:lower:]' '[:upper:]')"
|
||||
[ -z "${SN}" ] && return
|
||||
break
|
||||
done
|
||||
writeConfigKey "arc.patch" "user" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "sn" "${SN}" "${USER_CONFIG_FILE}"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
|
||||
arcSettings
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Arc Settings Section
|
||||
function arcSettings() {
|
||||
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
|
||||
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
|
||||
KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
|
||||
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
PAT_URL="$(readConfigKey "paturl" "${USER_CONFIG_FILE}")"
|
||||
PAT_HASH="$(readConfigKey "pathash" "${USER_CONFIG_FILE}")"
|
||||
DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")"
|
||||
|
||||
# Network Config for Loader
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Network Config" \
|
||||
--infobox "Generating Network Config..." 3 40
|
||||
sleep 2
|
||||
getnet || return
|
||||
|
||||
if [ "${ONLYPATCH}" = "true" ]; then
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
ONLYPATCH="false"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Select Portmap for Loader
|
||||
if [ "${DT}" = "false" ] && [ ${SATADRIVES} -gt 0 ]; then
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Storage Map" \
|
||||
--infobox "Generating Storage Map..." 3 40
|
||||
sleep 2
|
||||
getmapSelection || return
|
||||
fi
|
||||
|
||||
# Select Addons
|
||||
if [ "${ARCMODE}" = "config" ]; then
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Addons" \
|
||||
--infobox "Loading Addons Table..." 3 40
|
||||
addonSelection || return
|
||||
fi
|
||||
|
||||
# CPU Frequency Scaling & Governor
|
||||
if readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling"; then
|
||||
if [ "${ARCMODE}" = "config" ] && [ "${MACHINE}" = "Native" ]; then
|
||||
dialog --backtitle "$(backtitle)" --colors --title "CPU Frequency Scaling" \
|
||||
--infobox "Generating Governor Table..." 3 40
|
||||
governorSelection || return
|
||||
elif [ "${ARCMODE}" = "automated" ] && [ "${MACHINE}" = "Native" ]; then
|
||||
if [ "${PLATFORM}" = "epyc7002" ]; then
|
||||
writeConfigKey "governor" "schedutil" "${USER_CONFIG_FILE}"
|
||||
else
|
||||
writeConfigKey "governor" "conservative" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Warnings and Checks
|
||||
if [ "${ARCMODE}" = "config" ]; then
|
||||
[ "${DT}" = "true" ] && [ "${EXTERNALCONTROLLER}" = "true" ] && dialog --backtitle "$(backtitle)" --title "Arc Warning" --msgbox "WARN: You use a HBA/Raid Controller and selected a DT Model.\nThis is still an experimental." 6 70
|
||||
DEVICENIC="$(readConfigKey "device.nic" "${USER_CONFIG_FILE}")"
|
||||
MODELNIC="$(readConfigKey "${MODEL}.ports" "${S_FILE}" 2>/dev/null)"
|
||||
[ ${DEVICENIC} -gt 8 ] && dialog --backtitle "$(backtitle)" --title "Arc Warning" --msgbox "WARN: You have more NIC (${DEVICENIC}) than 8 NIC.\nOnly 8 supported by DSM." 6 60
|
||||
[ ${DEVICENIC} -gt ${MODELNIC} ] && [ "${ARCPATCH}" = "true" ] && dialog --backtitle "$(backtitle)" --title "Arc Warning" --msgbox "WARN: You have more NIC (${DEVICENIC}) than supported by Model (${MODELNIC}).\nOnly the first ${MODELNIC} are used by Arc Patch." 6 80
|
||||
[ "${AESSYS}" = "false" ] && dialog --backtitle "$(backtitle)" --title "Arc Warning" --msgbox "WARN: Your System doesn't support Hardware encryption in DSM. (AES)" 5 70
|
||||
[[ "${CPUFREQ}" = "false" || "${ACPISYS}" = "false" ]] && readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling" && dialog --backtitle "$(backtitle)" --title "Arc Warning" --msgbox "WARN: It is possible that CPU Frequency Scaling is not working properly with your System." 6 80
|
||||
fi
|
||||
|
||||
# eMMC Boot Support
|
||||
EMMCBOOT="$(readConfigKey "emmcboot" "${USER_CONFIG_FILE}")"
|
||||
if [ "${EMMCBOOT}" = "true" ]; then
|
||||
writeConfigKey "modules.mmc_block" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "modules.mmc_core" "" "${USER_CONFIG_FILE}"
|
||||
else
|
||||
deleteConfigKey "modules.mmc_block" "${USER_CONFIG_FILE}"
|
||||
deleteConfigKey "modules.mmc_core" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
|
||||
# Final Config Check
|
||||
if [ -n "${PLATFORM}" ] && [ -n "${MODEL}" ] && [ -n "${KVER}" ] && [ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ]; then
|
||||
writeConfigKey "arc.confdone" "true" "${USER_CONFIG_FILE}"
|
||||
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
|
||||
if [ "${ARCMODE}" = "config" ]; then
|
||||
dialog --clear --backtitle "$(backtitle)" --title "Config done" \
|
||||
--no-cancel --menu "Build now?" 7 40 0 \
|
||||
1 "Yes - Build Arc Loader now" \
|
||||
2 "No - I want to make changes" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
resp=$(cat ${TMP_PATH}/resp)
|
||||
[ -z "${resp}" ] && return
|
||||
[ ${resp} -eq 1 ] && arcSummary || dialog --clear --no-items --backtitle "$(backtitle)"
|
||||
else
|
||||
make
|
||||
fi
|
||||
else
|
||||
dialog --backtitle "$(backtitle)" --title "Config failed" --msgbox "ERROR: Config failed!\nExit." 6 40
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Show Summary of Config
|
||||
function arcSummary() {
|
||||
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
|
||||
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
|
||||
DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")"
|
||||
KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
|
||||
PAT_URL="$(readConfigKey "paturl" "${USER_CONFIG_FILE}")"
|
||||
PAT_HASH="$(readConfigKey "pathash" "${USER_CONFIG_FILE}")"
|
||||
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
|
||||
ADDONSINFO="$(readConfigEntriesArray "addons" "${USER_CONFIG_FILE}")"
|
||||
REMAP="$(readConfigKey "arc.remap" "${USER_CONFIG_FILE}")"
|
||||
|
||||
# Read remap configurations
|
||||
PORTMAP="$(readConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}")"
|
||||
DISKMAP="$(readConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}")"
|
||||
PORTREMAP="$(readConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}")"
|
||||
AHCIPORTREMAP="$(readConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}")"
|
||||
|
||||
DIRECTBOOT="$(readConfigKey "directboot" "${USER_CONFIG_FILE}")"
|
||||
KERNELLOAD="$(readConfigKey "kernelload" "${USER_CONFIG_FILE}")"
|
||||
HDDSORT="$(readConfigKey "hddsort" "${USER_CONFIG_FILE}")"
|
||||
NIC="$(readConfigKey "device.nic" "${USER_CONFIG_FILE}")"
|
||||
EXTERNALCONTROLLER="$(readConfigKey "device.externalcontroller" "${USER_CONFIG_FILE}")"
|
||||
HARDDRIVES="$(readConfigKey "device.harddrives" "${USER_CONFIG_FILE}")"
|
||||
DRIVES="$(readConfigKey "device.drives" "${USER_CONFIG_FILE}")"
|
||||
EMMCBOOT="$(readConfigKey "emmcboot" "${USER_CONFIG_FILE}")"
|
||||
KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
|
||||
|
||||
# Check for user-defined remap values
|
||||
if [ "${DT}" = "false" ] && [ "${REMAP}" = "user" ] && [ -z "${PORTMAP}${DISKMAP}${PORTREMAP}${AHCIPORTREMAP}" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Arc Error" \
|
||||
--msgbox "ERROR: You selected Portmap: User and not set any values. -> Can't build Loader!\nGo need to go Cmdline Options and add your Values." 6 80
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Print Summary
|
||||
SUMMARY="\Z4> DSM Information\Zn"
|
||||
SUMMARY+="\n>> Model: \Zb${MODEL}\Zn"
|
||||
SUMMARY+="\n>> Version: \Zb${PRODUCTVER}\Zn"
|
||||
SUMMARY+="\n>> Platform: \Zb${PLATFORM}\Zn"
|
||||
SUMMARY+="\n>> DT: \Zb${DT}\Zn"
|
||||
SUMMARY+="\n>> PAT URL: \Zb${PAT_URL}\Zn"
|
||||
SUMMARY+="\n>> PAT Hash: \Zb${PAT_HASH}\Zn"
|
||||
[ "${MODEL}" = "SA6400" ] && SUMMARY+="\n>> Kernel: \Zb${KERNEL}\Zn"
|
||||
SUMMARY+="\n>> Kernel Version: \Zb${KVER}\Zn"
|
||||
SUMMARY+="\n"
|
||||
SUMMARY+="\n\Z4> Arc Information\Zn"
|
||||
SUMMARY+="\n>> Arc Patch: \Zb${ARCPATCH}\Zn"
|
||||
[ -n "${PORTMAP}" ] && SUMMARY+="\n>> SataPortmap: \Zb${PORTMAP}\Zn"
|
||||
[ -n "${DISKMAP}" ] && SUMMARY+="\n>> DiskIdxMap: \Zb${DISKMAP}\Zn"
|
||||
[ -n "${PORTREMAP}" ] && SUMMARY+="\n>> SataRemap: \Zb${PORTREMAP}\Zn"
|
||||
[ -n "${AHCIPORTREMAP}" ] && SUMMARY+="\n>> AhciRemap: \Zb${AHCIPORTREMAP}\Zn"
|
||||
[ "${DT}" = "true" ] && SUMMARY+="\n>> Sort Drives: \Zb${HDDSORT}\Zn"
|
||||
SUMMARY+="\n>> Directboot: \Zb${DIRECTBOOT}\Zn"
|
||||
SUMMARY+="\n>> eMMC Boot: \Zb${EMMCBOOT}\Zn"
|
||||
SUMMARY+="\n>> Kernelload: \Zb${KERNELLOAD}\Zn"
|
||||
SUMMARY+="\n>> Addons: \Zb${ADDONSINFO}\Zn"
|
||||
SUMMARY+="\n"
|
||||
SUMMARY+="\n\Z4> Device Information\Zn"
|
||||
SUMMARY+="\n>> NIC: \Zb${NIC}\Zn"
|
||||
SUMMARY+="\n>> Total Disks: \Zb${DRIVES}\Zn"
|
||||
SUMMARY+="\n>> Internal Disks: \Zb${HARDDRIVES}\Zn"
|
||||
SUMMARY+="\n>> Additional Controller: \Zb${EXTERNALCONTROLLER}\Zn"
|
||||
SUMMARY+="\n"
|
||||
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Config Summary" \
|
||||
--extra-button --extra-label "Cancel" --msgbox "${SUMMARY}" 0 0
|
||||
|
||||
RET=$?
|
||||
case ${RET} in
|
||||
0)
|
||||
make
|
||||
;;
|
||||
3|255)
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Building Loader
|
||||
function make() {
|
||||
# Read Model Config
|
||||
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
|
||||
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
|
||||
DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")"
|
||||
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
|
||||
PAT_URL="$(readConfigKey "paturl" "${USER_CONFIG_FILE}")"
|
||||
PAT_HASH="$(readConfigKey "pathash" "${USER_CONFIG_FILE}")"
|
||||
# Check for Arc Patch
|
||||
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")"
|
||||
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
|
||||
if [ -z "${ARCCONF}" ] || [ "${ARCPATCH}" = "false" ]; then
|
||||
deleteConfigKey "addons.amepatch" "${USER_CONFIG_FILE}"
|
||||
deleteConfigKey "addons.arcdns" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
# Max Memory for DSM
|
||||
RAMCONFIG="$((${RAMTOTAL} * 1024 * 2))"
|
||||
writeConfigKey "synoinfo.mem_max_mb" "${RAMCONFIG}" "${USER_CONFIG_FILE}"
|
||||
if [ -n "${IPCON}" ]; then
|
||||
getpatfiles
|
||||
else
|
||||
dialog --backtitle "$(backtitle)" --title "Build Loader" --aspect 18 \
|
||||
--infobox "Could not build Loader!\nNetwork Connection needed." 4 40
|
||||
# Set Build to false
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
sleep 2
|
||||
return
|
||||
fi
|
||||
if [ -f "${ORI_ZIMAGE_FILE}" ] && [ -f "${ORI_RDGZ_FILE}" ] && [ "${CONFDONE}" = "true" ] && [ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ]; then
|
||||
(
|
||||
livepatch
|
||||
sleep 3
|
||||
) 2>&1 | dialog --backtitle "$(backtitle)" --colors --title "Build Loader" \
|
||||
--progressbox "Patching DSM Files..." 20 70
|
||||
else
|
||||
dialog --backtitle "$(backtitle)" --title "Build Loader" --aspect 18 \
|
||||
--infobox "Configuration issue found.\nCould not build Loader!\nExit." 5 40
|
||||
# Set Build to false
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
sleep 2
|
||||
return
|
||||
fi
|
||||
if [ -f "${ORI_ZIMAGE_FILE}" ] && [ -f "${ORI_RDGZ_FILE}" ] && [ -f "${MOD_ZIMAGE_FILE}" ] && [ -f "${MOD_RDGZ_FILE}" ]; then
|
||||
MODELID="$(echo ${MODEL} | sed 's/d$/D/; s/rp$/RP/; s/rp+/RP+/')"
|
||||
writeConfigKey "modelid" "${MODELID}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "arc.version" "${ARC_VERSION}" "${USER_CONFIG_FILE}"
|
||||
arcFinish
|
||||
else
|
||||
dialog --backtitle "$(backtitle)" --title "Build Loader" --aspect 18 \
|
||||
--infobox "Could not build Loader!\nExit." 4 40
|
||||
# Set Build to false
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
sleep 2
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Finish Building Loader
|
||||
function arcFinish() {
|
||||
rm -f "${LOG_FILE}" >/dev/null 2>&1 || true
|
||||
MODELID="$(readConfigKey "modelid" "${USER_CONFIG_FILE}")"
|
||||
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
|
||||
if [ -n "${MODELID}" ]; then
|
||||
writeConfigKey "arc.builddone" "true" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
|
||||
if [ "${ARCMODE}" = "automated" ] || [ "${UPDATEMODE}" = "true" ]; then
|
||||
boot
|
||||
else
|
||||
# Ask for Boot
|
||||
dialog --clear --backtitle "$(backtitle)" --title "Build done" \
|
||||
--no-cancel --menu "Boot now?" 7 40 0 \
|
||||
1 "Yes - Boot DSM now" \
|
||||
2 "No - I want to make changes" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
resp=$(cat "${TMP_PATH}/resp")
|
||||
[ "${resp}" -eq 1 ] && boot || return
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Calls boot.sh to boot into DSM Reinstall Mode
|
||||
function juniorboot() {
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
MODELID="$(readConfigKey "modelid" "${USER_CONFIG_FILE}")"
|
||||
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
if [[ "${BUILDDONE}" = "false" && "${ARCMODE}" != "automated" ]] || [ "${MODEL}" != "${MODELID}" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Alert" \
|
||||
--yesno "Config changed, you need to rebuild the Loader?" 0 0
|
||||
if [ $? -eq 0 ]; then
|
||||
arcSummary
|
||||
fi
|
||||
else
|
||||
dialog --backtitle "$(backtitle)" --title "Arc Boot" \
|
||||
--infobox "Booting DSM Reinstall Mode...\nPlease stay patient!" 4 30
|
||||
sleep 3
|
||||
rebootTo junior
|
||||
fi
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Calls boot.sh to boot into DSM kernel/ramdisk
|
||||
function boot() {
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
MODELID="$(readConfigKey "modelid" "${USER_CONFIG_FILE}")"
|
||||
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
if [[ "${BUILDDONE}" = "false" && "${ARCMODE}" != "automated" ]] || [ "${MODEL}" != "${MODELID}" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Alert" \
|
||||
--yesno "Config changed, you need to rebuild the Loader?" 0 0
|
||||
if [ $? -eq 0 ]; then
|
||||
arcSummary
|
||||
fi
|
||||
else
|
||||
dialog --backtitle "$(backtitle)" --title "Arc Boot" \
|
||||
--infobox "Booting DSM...\nPlease stay patient!" 4 25
|
||||
sleep 2
|
||||
exec reboot
|
||||
fi
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
# Main loop
|
||||
@@ -783,12 +84,6 @@ elif [ "${ARCMODE}" = "config" ]; then
|
||||
if [ "${CONFDONE}" = "true" ]; then
|
||||
if [ "${ARCOPTS}" = "true" ]; then
|
||||
write_menu "4" "\Z1Hide Arc DSM Options\Zn"
|
||||
else
|
||||
write_menu "4" "\Z1Show Arc DSM Options\Zn"
|
||||
fi
|
||||
|
||||
if [ "${ARCOPTS}" = "true" ]; then
|
||||
write_menu "=" "\Z4==== Arc DSM ====\Zn"
|
||||
write_menu "b" "Addons"
|
||||
write_menu "d" "Modules"
|
||||
write_menu "e" "Version"
|
||||
@@ -813,40 +108,32 @@ 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_value "m" "Boot Kernelload" "${KERNELLOAD}"
|
||||
write_menu_value "E" "eMMC Boot Support" "${EMMCBOOT}"
|
||||
if [ "${DIRECTBOOT}" = "false" ]; then
|
||||
write_menu_value "i" "Boot IP Waittime" "${BOOTIPWAIT}"
|
||||
fi
|
||||
write_menu_value "q" "Directboot" "${DIRECTBOOT}"
|
||||
else
|
||||
write_menu "6" "\Z1Show Boot Options\Zn"
|
||||
fi
|
||||
|
||||
if [ "${BOOTOPTS}" = "true" ]; then
|
||||
write_menu "=" "\Z4===== Boot =====\Zn"
|
||||
write_menu_with_color "m" "Boot Kernelload" "${KERNELLOAD}"
|
||||
write_menu_with_color "E" "eMMC Boot Support" "${EMMCBOOT}"
|
||||
if [ "${DIRECTBOOT}" = "false" ]; then
|
||||
write_menu_with_color "i" "Boot IP Waittime" "${BOOTIPWAIT}"
|
||||
fi
|
||||
write_menu_with_color "q" "Directboot" "${DIRECTBOOT}"
|
||||
fi
|
||||
|
||||
if [ "${DSMOPTS}" = "true" ]; then
|
||||
write_menu "7" "\Z1Hide DSM Options\Zn"
|
||||
else
|
||||
write_menu "7" "\Z1Show DSM Options\Zn"
|
||||
fi
|
||||
|
||||
if [ "${DSMOPTS}" = "true" ]; then
|
||||
write_menu "=" "\Z4===== DSM =====\Zn"
|
||||
write_menu "j" "Cmdline"
|
||||
write_menu "k" "Synoinfo"
|
||||
write_menu "N" "Add new User"
|
||||
@@ -856,19 +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"
|
||||
else
|
||||
write_menu "8" "\Z1Show Loader Options\Zn"
|
||||
fi
|
||||
|
||||
if [ "${LOADEROPTS}" = "true" ]; then
|
||||
write_menu "=" "\Z4===== Loader =====\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"
|
||||
@@ -877,25 +160,23 @@ 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"
|
||||
write_menu "F" "\Z1Formate Disks\Zn"
|
||||
else
|
||||
write_menu "8" "\Z1Show Loader Options\Zn"
|
||||
fi
|
||||
|
||||
write_menu_with_color "=" "\Z4===== Misc =====\Zn"
|
||||
write_menu "=" "\Z4===== Misc =====\Zn"
|
||||
write_menu "x" "Backup/Restore/Recovery"
|
||||
[ "${ARCOFFLINE}" = "false" ] && write_menu "z" "Update Menu"
|
||||
write_menu "I" "Power/Service Menu"
|
||||
write_menu "V" "Credits"
|
||||
if [ "$TERM" != "xterm-256color" ]; then
|
||||
WEBCONFIG="Webconfig: http://${IPCON}${HTTPPORT:+:$HTTPPORT}"
|
||||
else
|
||||
WEBCONFIG=""
|
||||
fi
|
||||
[ "$TERM" != "xterm-256color" ] && WEBCONFIG="Webconfig: http://${IPCON}${HTTPPORT:+:$HTTPPORT}" || WEBCONFIG=""
|
||||
dialog --clear --default-item ${NEXT} --backtitle "$(backtitle)" --title "Classic UI" --colors \
|
||||
--cancel-label "Evo" --help-button --help-label "Exit" \
|
||||
--menu "${WEBCONFIG}" 0 0 0 --file "${TMP_PATH}/menu" \
|
||||
@@ -1065,7 +346,7 @@ elif [ "${ARCMODE}" = "config" ]; then
|
||||
done
|
||||
clear
|
||||
else
|
||||
exec reboot
|
||||
echo "Unknown Mode: ${ARCMODE} - Exiting..."
|
||||
fi
|
||||
|
||||
# Inform user
|
||||
|
||||
@@ -5,16 +5,14 @@ set -e
|
||||
|
||||
. "${ARC_PATH}/include/functions.sh"
|
||||
|
||||
arc_mode || die "No bootmode found!"
|
||||
|
||||
# Clear logs for dbgutils addons
|
||||
rm -rf "${PART1_PATH}/logs" >/dev/null 2>&1 || true
|
||||
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
ARC_BRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
|
||||
|
||||
# Get Loader Disk Bus
|
||||
[ -z "${LOADER_DISK}" ] && die "Loader Disk not found!"
|
||||
BUS=$(getBus "${LOADER_DISK}")
|
||||
FBI=$(cat /sys/class/graphics/fb*/name 2>/dev/null | head -1)
|
||||
EFI=$([ -d /sys/firmware/efi ] && echo 1 || echo 0)
|
||||
|
||||
# Print Title centralized
|
||||
@@ -22,15 +20,14 @@ clear
|
||||
COLUMNS=${COLUMNS:-50}
|
||||
BANNER="$(figlet -c -w "$(((${COLUMNS})))" "Arc Loader")"
|
||||
TITLE="Version:"
|
||||
TITLE+=" ${ARC_VERSION} (${ARC_BUILD})"
|
||||
[ -n "${ARC_BRANCH}" ] && TITLE+=" | Branch: ${ARC_BRANCH}"
|
||||
TITLE+=" ${ARC_VERSION} (${ARC_BUILD}) | Branch: ${ARC_BRANCH}"
|
||||
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}"
|
||||
printf "\033[1;34m%*s\033[0m\n" $(((${#TITLE} + ${COLUMNS}) / 2)) "${TITLE}"
|
||||
TITLE="Boot:"
|
||||
[ ${EFI} -eq 1 ] && TITLE+=" [UEFI]" || TITLE+=" [BIOS]"
|
||||
TITLE+=" [${BUS}]"
|
||||
TITLE+=" | Device: [${BUS}] | Mode: [${ARCMODE}]"
|
||||
printf "\033[1;34m%*s\033[0m\n" $(((${#TITLE} + ${COLUMNS}) / 2)) "${TITLE}"
|
||||
# Check if DSM zImage/Ramdisk is changed, patch it if necessary, update Files if necessary
|
||||
ZIMAGE_HASH="$(readConfigKey "zimage-hash" "${USER_CONFIG_FILE}")"
|
||||
@@ -51,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')"
|
||||
@@ -60,6 +59,7 @@ DISKINFO="$(readConfigKey "bootscreen.diskinfo" "${USER_CONFIG_FILE}")"
|
||||
HWIDINFO="$(readConfigKey "bootscreen.hwidinfo" "${USER_CONFIG_FILE}")"
|
||||
GOVERNOR="$(readConfigKey "governor" "${USER_CONFIG_FILE}")"
|
||||
USBMOUNT="$(readConfigKey "usbmount" "${USER_CONFIG_FILE}")"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
|
||||
# Build Sanity Check
|
||||
[ "${BUILDDONE}" = "false" ] && die "Loader build not completed!"
|
||||
@@ -71,7 +71,7 @@ if [ "${ARCPATCH}" = "true" ]; then
|
||||
HARDWAREID="$(readConfigKey "arc.hardwareid" "${USER_CONFIG_FILE}")"
|
||||
HWID="$(genHWID)"
|
||||
if [ "${HARDWAREID}" != "${HWID}" ]; then
|
||||
echo "\033[1;31m*** HardwareID does not match! - Loader can't boot to DSM! You need to reconfigure your Loader - Rebooting to Config Mode! ***\033[0m"
|
||||
echo -e "\033[1;31m*** HardwareID does not match! - Loader can't boot to DSM! You need to reconfigure your Loader - Rebooting to Config Mode! ***\033[0m"
|
||||
writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "arc.hardwareid" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}"
|
||||
@@ -85,6 +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} (${KERNEL}\033[0m"
|
||||
echo -e "LKM: \033[1;37m${LKM}\033[0m"
|
||||
echo
|
||||
fi
|
||||
@@ -150,10 +151,9 @@ ETHN=$(echo "${ETHX}" | wc -w)
|
||||
ETHM=${ETHM:-${ETHN}}
|
||||
NIC=0
|
||||
for N in ${ETHX}; do
|
||||
MAC=$(readConfigKey "${N}" "${USER_CONFIG_FILE}")
|
||||
MAC=$(readConfigKey "${N}" "${USER_CONFIG_FILE}" 2>/dev/null)
|
||||
MAC=${MAC:-$(cat /sys/class/net/${N}/address 2>/dev/null | tr '[:upper:]' '[:lower:]')}
|
||||
NIC=$((NIC + 1))
|
||||
CMDLINE["mac${NIC}"]="${MAC}"
|
||||
CMDLINE["mac$((++NIC))"]="${MAC}"
|
||||
[ ${NIC} -ge ${ETHM} ] && break
|
||||
done
|
||||
CMDLINE["netif_num"]="${NIC}"
|
||||
@@ -293,6 +293,7 @@ elif [ "${DIRECTBOOT}" = "false" ]; then
|
||||
BOOTIPWAIT="$(readConfigKey "bootipwait" "${USER_CONFIG_FILE}")"
|
||||
[ -z "${BOOTIPWAIT}" ] && BOOTIPWAIT=30
|
||||
IPCON=""
|
||||
echo
|
||||
if [ "${ARCPATCH}" = "true" ]; then
|
||||
echo -e "\033[1;37mDetected ${ETHN} NIC\033[0m | \033[1;34mUsing ${NIC} NIC for Arc Patch:\033[0m"
|
||||
else
|
||||
@@ -300,41 +301,9 @@ elif [ "${DIRECTBOOT}" = "false" ]; then
|
||||
fi
|
||||
echo
|
||||
|
||||
[ ! -f /var/run/dhcpcd/pid ] && /etc/init.d/S41dhcpcd restart >/dev/null 2>&1 || true
|
||||
sleep 2
|
||||
|
||||
for N in ${ETHX}; do
|
||||
COUNT=0
|
||||
DRIVER=$(ls -ld /sys/class/net/${N}/device/driver 2>/dev/null | awk -F '/' '{print $NF}')
|
||||
MAC="$(cat /sys/class/net/${N}/address 2>/dev/null | sed 's/://g' | tr '[:upper:]' '[:lower:]')"
|
||||
while true; do
|
||||
if [ "0" = "$(cat /sys/class/net/${N}/carrier 2>/dev/null)" ]; then
|
||||
echo -e "\r${DRIVER}: \033[1;37mNOT CONNECTED @ Mac: ${MAC}\033[0m"
|
||||
break
|
||||
fi
|
||||
COUNT=$((COUNT + 1))
|
||||
IP="$(getIP "${N}")"
|
||||
if [ -n "${IP}" ]; then
|
||||
SPEED=$(ethtool ${N} 2>/dev/null | grep "Speed:" | awk '{print $2}')
|
||||
if [[ "${IP}" =~ ^169\.254\..* ]]; then
|
||||
echo -e "\r${DRIVER} (${SPEED} | ${MAC}): \033[1;37mLINK LOCAL (No DHCP server found.)\033[0m"
|
||||
else
|
||||
echo -e "\r${DRIVER} (${SPEED} | ${MAC}): \033[1;37m${IP}\033[0m"
|
||||
[ -z "${IPCON}" ] && IPCON="${IP}"
|
||||
fi
|
||||
break
|
||||
fi
|
||||
if [ -z "$(cat /sys/class/net/${N}/carrier 2>/dev/null)" ]; then
|
||||
echo -e "\r${DRIVER} (${MAC}): \033[1;37mDOWN\033[0m"
|
||||
break
|
||||
fi
|
||||
if [ ${COUNT} -ge ${BOOTIPWAIT} ]; then
|
||||
echo -e "\r${DRIVER} (${MAC}): \033[1;37mTIMEOUT\033[0m"
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
done
|
||||
[ ! -f /var/run/dhcpcd/pid ] && /etc/init.d/S09dhcpcd restart >/dev/null 2>&1 || true
|
||||
sleep 3
|
||||
checkNIC
|
||||
echo
|
||||
|
||||
DSMLOGO="$(readConfigKey "bootscreen.dsmlogo" "${USER_CONFIG_FILE}")"
|
||||
@@ -346,7 +315,7 @@ elif [ "${DIRECTBOOT}" = "false" ]; then
|
||||
fi
|
||||
|
||||
# Wait for boot interrupt
|
||||
_bootwait
|
||||
# _bootwait || true
|
||||
|
||||
for T in $(busybox w 2>/dev/null | grep -v 'TTY' | awk '{print $2}'); do
|
||||
if [ -w "/dev/${T}" ]; then
|
||||
|
||||
@@ -9,15 +9,12 @@
|
||||
. "${ARC_PATH}/include/addons.sh"
|
||||
. "${ARC_PATH}/include/modules.sh"
|
||||
. "${ARC_PATH}/include/update.sh"
|
||||
. "${ARC_PATH}/include/storage.sh"
|
||||
. "${ARC_PATH}/include/network.sh"
|
||||
|
||||
# Get Keymap and Timezone and check System
|
||||
onlineCheck
|
||||
KEYMAP="$(readConfigKey "keymap" "${USER_CONFIG_FILE}")"
|
||||
ARCOFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")"
|
||||
systemCheck
|
||||
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
readData
|
||||
|
||||
###############################################################################
|
||||
@@ -26,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} | "
|
||||
@@ -37,699 +34,156 @@ function backtitle() {
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Model Selection
|
||||
function arcModel() {
|
||||
[ "${ARCOFFLINE}" != "true" ] && checkHardwareID || true
|
||||
dialog --backtitle "$(backtitle)" --title "Model" \
|
||||
--infobox "Reading Models..." 3 25
|
||||
ARCCONF="$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")"
|
||||
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
# Loop menu
|
||||
RESTRICT=1
|
||||
PS="$(readConfigEntriesArray "platforms" "${P_FILE}" | sort)"
|
||||
echo -n "" >"${TMP_PATH}/modellist"
|
||||
while read -r P; do
|
||||
PM="$(readConfigEntriesArray "${P}" "${D_FILE}" | sort)"
|
||||
while read -r M; do
|
||||
echo "${M} ${P}" >>"${TMP_PATH}/modellist"
|
||||
done < <(echo "${PM}")
|
||||
done < <(echo "${PS}")
|
||||
if [ "${ARCMODE}" = "config" ]; then
|
||||
while true; do
|
||||
echo -n "" >"${TMP_PATH}/menu"
|
||||
while read -r M A; do
|
||||
COMPATIBLE=1
|
||||
DT="$(readConfigKey "platforms.${A}.dt" "${P_FILE}")"
|
||||
FLAGS="$(readConfigArray "platforms.${A}.flags" "${P_FILE}")"
|
||||
ARCCONFM="$(readConfigKey "${M}.serial" "${S_FILE}")"
|
||||
ARC=""
|
||||
BETA=""
|
||||
[ -n "${ARCCONFM}" ] && ARC="x" || ARC=""
|
||||
[ "${DT}" = "true" ] && DTS="x" || DTS=""
|
||||
IGPU=""
|
||||
IGPUS=""
|
||||
IGPUID="$(lspci -nd ::300 2>/dev/null | grep "8086" | cut -d' ' -f3 | sed 's/://g')"
|
||||
if [ -n "${IGPUID}" ]; then grep -iq "${IGPUID}" ${ARC_PATH}/include/i915ids && IGPU="all" || IGPU="epyc7002"; else IGPU=""; fi
|
||||
if [[ "${A}" = "apollolake" || "${A}" = "geminilake" ]] && [ "${IGPU}" = "all" ]; then
|
||||
IGPUS="+"
|
||||
elif [ "${A}" = "epyc7002" ] && [[ "${IGPU}" = "epyc7002" || "${IGPU}" = "all" ]]; then
|
||||
IGPUS="x"
|
||||
else
|
||||
IGPUS=""
|
||||
fi
|
||||
[ "${DT}" = "true" ] && HBAS="" || HBAS="x"
|
||||
[ "${M}" = "SA6400" ] && HBAS="x"
|
||||
[ "${DT}" = "false" ] && USBS="int/ext" || USBS="ext"
|
||||
M_2_CACHE="x"
|
||||
[[ "${M}" = "DS220+" || "${M}" = "DS224+" ]] && M_2_CACHE=""
|
||||
[[ "${M}" = "DS220+" || "${M}" = "DS224+" || "${DT}" = "false" ]] && M_2_STORAGE="" || M_2_STORAGE="+"
|
||||
# Check id model is compatible with CPU
|
||||
if [ ${RESTRICT} -eq 1 ]; then
|
||||
for F in ${FLAGS}; do
|
||||
if ! grep -q "^flags.*${F}.*" /proc/cpuinfo; then
|
||||
COMPATIBLE=0
|
||||
fi
|
||||
done
|
||||
if [ "${A}" != "epyc7002" ] && [ "${DT}" = "true" ] && [ "${EXTERNALCONTROLLER}" = "true" ]; then
|
||||
COMPATIBLE=0
|
||||
fi
|
||||
if [ "${A}" != "epyc7002" ] && [ ${SATACONTROLLER} -eq 0 ] && [ "${EXTERNALCONTROLLER}" = "false" ]; then
|
||||
COMPATIBLE=0
|
||||
fi
|
||||
if [ "${A}" = "epyc7002" ] && [[ ${SCSICONTROLLER} -ne 0 || ${RAIDCONTROLLER} -ne 0 ]]; then
|
||||
COMPATIBLE=0
|
||||
fi
|
||||
if [ "${A}" != "epyc7002" ] && [ ${NVMEDRIVES} -gt 0 ] && [ "${BUS}" = "usb" ] && [ ${SATADRIVES} -eq 0 ] && [ "${EXTERNALCONTROLLER}" = "false" ]; then
|
||||
COMPATIBLE=0
|
||||
elif [ "${A}" != "epyc7002" ] && [ ${NVMEDRIVES} -gt 0 ] && [ "${BUS}" = "sata" ] && [ ${SATADRIVES} -eq 1 ] && [ "${EXTERNALCONTROLLER}" = "false" ]; then
|
||||
COMPATIBLE=0
|
||||
fi
|
||||
[ -z "$(grep -w "${M}" "${S_FILE}")" ] && COMPATIBLE=0
|
||||
fi
|
||||
[ -n "$(grep -w "${M}" "${S_FILE}")" ] && BETA="Arc" || BETA="Syno"
|
||||
[ -z "$(grep -w "${A}" "${P_FILE}")" ] && COMPATIBLE=0
|
||||
if [ -n "${ARCCONF}" ]; then
|
||||
[ ${COMPATIBLE} -eq 1 ] && echo -e "${M} \"\t$(printf "\Zb%-15s\Zn \Zb%-5s\Zn \Zb%-5s\Zn \Zb%-5s\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
|
||||
[ ${COMPATIBLE} -eq 1 ] && echo -e "${M} \"\t$(printf "\Zb%-15s\Zn \Zb%-5s\Zn \Zb%-5s\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
|
||||
done < <(cat "${TMP_PATH}/modellist")
|
||||
ARCCONF="$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")"
|
||||
[ -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%-5s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "Model" "Platform" "DT" "Arc" "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%-5s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "Model" "Platform" "DT" "iGPU" "HBA" "M.2 Cache" "M.2 Volume" "USB Mount" "Source")"
|
||||
[ -n "${ARCCONF}" ] && TITLEMSG="Arc Model" || TITLEMSG="Model"
|
||||
dialog --backtitle "$(backtitle)" --title "${TITLEMSG}" --colors \
|
||||
--cancel-label "Show all" --help-button --help-label "Exit" \
|
||||
--extra-button --extra-label "Info" \
|
||||
--menu "${MSG}" 0 115 0 \
|
||||
--file "${TMP_PATH}/menu" 2>"${TMP_PATH}/resp"
|
||||
RET=$?
|
||||
case ${RET} in
|
||||
0)
|
||||
resp=$(cat ${TMP_PATH}/resp)
|
||||
[ -z "${resp}" ] && return
|
||||
break
|
||||
;;
|
||||
1)
|
||||
[ ${RESTRICT} -eq 1 ] && RESTRICT=0 || RESTRICT=1
|
||||
;;
|
||||
3)
|
||||
resp=$(cat ${TMP_PATH}/resp)
|
||||
PLATFORM="$(grep -w "${resp}" "${TMP_PATH}/modellist" | awk '{print $2}' | head -n 1)"
|
||||
dialog --backtitle "$(backtitle)" --colors \
|
||||
--title "Platform Info" --textbox "./informations/${PLATFORM}.yml" 70 80
|
||||
;;
|
||||
*)
|
||||
return
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
# Reset Model Config if changed
|
||||
if [ "${ARCMODE}" = "config" ] && [ "${MODEL}" != "${resp}" ]; then
|
||||
MODEL="${resp}"
|
||||
writeConfigKey "addons" "{}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "arc.remap" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "buildnum" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "cmdline" "{}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "emmcboot" "false" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "hddsort" "false" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "kernel" "official" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "odp" "false" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "model" "${MODEL}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "paturl" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "pathash" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "platform" "${PLATFORM}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "productver" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "ramdisk-hash" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "smallnum" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "sn" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "zimage-hash" "" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
PLATFORM="$(grep -w "${MODEL}" "${TMP_PATH}/modellist" | awk '{print $2}' | head -1)"
|
||||
writeConfigKey "platform" "${PLATFORM}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "arc.confdone" "false" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
|
||||
# Read Platform Data
|
||||
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
|
||||
EMMCBOOT="$(readConfigKey "emmcboot" "${USER_CONFIG_FILE}")"
|
||||
HDDSORT="$(readConfigKey "hddsort" "${USER_CONFIG_FILE}")"
|
||||
KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
|
||||
ODP="$(readConfigKey "odp" "${USER_CONFIG_FILE}")"
|
||||
arcVersion
|
||||
}
|
||||
# Advanced Menu
|
||||
function advancedMenu() {
|
||||
NEXT="a"
|
||||
while true; do
|
||||
rm -f "${TMP_PATH}/menu" "${TMP_PATH}/resp" >/dev/null 2>&1 || true
|
||||
write_menu "=" "\Z4===== System ====\Zn"
|
||||
|
||||
###############################################################################
|
||||
# Arc Version Section
|
||||
function arcVersion() {
|
||||
# Read Model Config
|
||||
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
|
||||
DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")"
|
||||
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
|
||||
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
# Get PAT Data from Config
|
||||
PAT_URL_CONF="$(readConfigKey "paturl" "${USER_CONFIG_FILE}")"
|
||||
PAT_HASH_CONF="$(readConfigKey "pathash" "${USER_CONFIG_FILE}")"
|
||||
# Check for Custom Build
|
||||
if [ "${ARCMODE}" = "config" ] && [ "${ARCRESTORE}" != "true" ]; then
|
||||
# Select Build for DSM
|
||||
ITEMS="$(readConfigEntriesArray "platforms.${PLATFORM}.productvers" "${P_FILE}" | sort -r)"
|
||||
dialog --clear --no-items --nocancel --title "DSM Version" --backtitle "$(backtitle)" \
|
||||
--no-items --menu "Select DSM Version" 7 30 0 ${ITEMS} \
|
||||
2>"${TMP_PATH}/resp"
|
||||
[ $? -ne 0 ] && return
|
||||
resp=$(cat ${TMP_PATH}/resp)
|
||||
[ -z "${resp}" ] && return
|
||||
if [ "${PRODUCTVER}" != "${resp}" ]; then
|
||||
PRODUCTVER="${resp}"
|
||||
writeConfigKey "productver" "${PRODUCTVER}" "${USER_CONFIG_FILE}"
|
||||
# Reset Config if changed
|
||||
writeConfigKey "buildnum" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "paturl" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "pathash" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "ramdisk-hash" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "smallnum" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "zimage-hash" "" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
dialog --backtitle "$(backtitle)" --title "Version" \
|
||||
--infobox "Reading DSM Build..." 3 25
|
||||
PAT_URL=""
|
||||
PAT_HASH=""
|
||||
URLVER=""
|
||||
while true; do
|
||||
PVS="$(readConfigEntriesArray "${PLATFORM}.\"${MODEL}\"" "${D_FILE}" | sort -r)"
|
||||
echo -n "" >"${TMP_PATH}/versions"
|
||||
while read -r V; do
|
||||
if [ "${V:0:3}" != "${PRODUCTVER}" ] || [ "${V}" = "${PREV}" ]; then
|
||||
continue
|
||||
else
|
||||
echo "${V}" >>"${TMP_PATH}/versions"
|
||||
if [ "${CONFDONE}" = "true" ]; then
|
||||
if [ "${BOOTOPTS}" = "true" ]; then
|
||||
write_menu "6" "\Z1Hide Boot Options\Zn"
|
||||
write_menu_value "m" "Kernelload" "${KERNELLOAD}"
|
||||
write_menu_value "E" "eMMC Boot Support" "${EMMCBOOT}"
|
||||
if [ "${DIRECTBOOT}" = "false" ]; then
|
||||
write_menu_value "i" "Boot IP Waittime" "${BOOTIPWAIT}"
|
||||
fi
|
||||
PREV="${V}"
|
||||
done < <(echo "${PVS}")
|
||||
DSMPVS="$(cat ${TMP_PATH}/versions)"
|
||||
dialog --backtitle "$(backtitle)" --colors --title "DSM Build" \
|
||||
--no-items --menu "Select DSM Build" 0 0 0 ${DSMPVS} \
|
||||
2>${TMP_PATH}/resp
|
||||
RET=$?
|
||||
[ ${RET} -ne 0 ] && return
|
||||
PV=$(cat ${TMP_PATH}/resp)
|
||||
PAT_URL="$(readConfigKey "${PLATFORM}.\"${MODEL}\".\"${PV}\".url" "${D_FILE}")"
|
||||
PAT_HASH="$(readConfigKey "${PLATFORM}.\"${MODEL}\".\"${PV}\".hash" "${D_FILE}")"
|
||||
writeConfigKey "productver" "${PV:0:3}" "${USER_CONFIG_FILE}"
|
||||
if [ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ]; then
|
||||
VALID="true"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ -z "${PAT_URL}" ] || [ -z "${PAT_HASH}" ]; then
|
||||
while true; do
|
||||
MSG="Failed to get PAT Data.\n"
|
||||
MSG+="Please manually fill in the URL and Hash of PAT.\n"
|
||||
MSG+="You will find these Data at: https://github.com/AuxXxilium/arc-dsm/blob/main/webdata.txt"
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Arc Build" --default-button "OK" \
|
||||
--form "${MSG}" 11 120 2 "Url" 1 1 "${PAT_URL}" 1 8 110 0 "Hash" 2 1 "${PAT_HASH}" 2 8 110 0 \
|
||||
2>"${TMP_PATH}/resp"
|
||||
RET=$?
|
||||
[ ${RET} -ne 0 ] && return
|
||||
PAT_URL="$(cat "${TMP_PATH}/resp" | sed -n '1p')"
|
||||
PAT_HASH="$(cat "${TMP_PATH}/resp" | sed -n '2p')"
|
||||
[ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ] && VALID="true" && break
|
||||
done
|
||||
fi
|
||||
if [ "${PAT_URL}" != "${PAT_URL_CONF}" ] || [ "${PAT_HASH}" != "${PAT_HASH_CONF}" ]; then
|
||||
writeConfigKey "paturl" "${PAT_URL}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "pathash" "${PAT_HASH}" "${USER_CONFIG_FILE}"
|
||||
rm -f "${ORI_ZIMAGE_FILE}" "${ORI_RDGZ_FILE}" "${MOD_ZIMAGE_FILE}" "${MOD_RDGZ_FILE}" >/dev/null 2>&1 || true
|
||||
rm -f "${PART1_PATH}/grub_cksum.syno" "${PART1_PATH}/GRUB_VER" >/dev/null 2>&1 || true
|
||||
rm -f "${USER_UP_PATH}/"*.tar >/dev/null 2>&1 || true
|
||||
fi
|
||||
if [ "${ONLYVERSION}" != "true" ]; then
|
||||
MSG="Do you want to try Automated Mode?\nIf yes, Loader will configure, build and boot DSM."
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Automated Mode" \
|
||||
--yesno "${MSG}" 6 55
|
||||
if [ $? -eq 0 ]; then
|
||||
writeConfigKey "arc.mode" "automated" "${USER_CONFIG_FILE}"
|
||||
write_menu_value "q" "Directboot" "${DIRECTBOOT}"
|
||||
write_menu_value "W" "RD Compression" "${RD_COMPRESSED}"
|
||||
write_menu_value "X" "Sata DOM" "${SATADOM}"
|
||||
write_menu_value "u" "LKM Version" "${LKM}"
|
||||
else
|
||||
writeConfigKey "arc.mode" "config" "${USER_CONFIG_FILE}"
|
||||
write_menu "6" "\Z1Show Boot Options\Zn"
|
||||
fi
|
||||
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
fi
|
||||
elif [ "${ARCMODE}" = "automated" ] || [ "${ARCRESTORE}" = "true" ]; then
|
||||
VALID="true"
|
||||
fi
|
||||
# Change Config if Files are valid
|
||||
if [ "${VALID}" = "true" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Arc Config" \
|
||||
--infobox "Reconfiguring Cmdline, Modules and Synoinfo" 3 60
|
||||
# Reset Synoinfo
|
||||
writeConfigKey "synoinfo" "{}" "${USER_CONFIG_FILE}"
|
||||
while IFS=': ' read -r KEY VALUE; do
|
||||
writeConfigKey "synoinfo.\"${KEY}\"" "${VALUE}" "${USER_CONFIG_FILE}"
|
||||
done < <(readConfigMap "platforms.${PLATFORM}.synoinfo" "${P_FILE}")
|
||||
# Reset Modules
|
||||
KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
|
||||
[ "${PLATFORM}" = "epyc7002" ] && KVERP="${PRODUCTVER}-${KVER}" || KVERP="${KVER}"
|
||||
if [ -n "${PLATFORM}" ] && [ -n "${KVERP}" ]; then
|
||||
writeConfigKey "modules" "{}" "${USER_CONFIG_FILE}"
|
||||
mergeConfigModules "$(getAllModules "${PLATFORM}" "${KVERP}" | awk '{print $1}')" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
# Check Addons for Platform
|
||||
ADDONS="$(readConfigKey "addons" "${USER_CONFIG_FILE}")"
|
||||
DEVICENIC="$(readConfigKey "device.nic" "${USER_CONFIG_FILE}")"
|
||||
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")"
|
||||
if [ "${ADDONS}" = "{}" ]; then
|
||||
initConfigKey "addons.acpid" "" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "addons.cpuinfo" "" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "addons.storagepanel" "" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "addons.updatenotify" "" "${USER_CONFIG_FILE}"
|
||||
if [ ${NVMEDRIVES} -gt 0 ]; then
|
||||
if [ "${PLATFORM}" = "epyc7002" ] && [ ${SATADRIVES} -eq 0 ] && [ ${SASDRIVES} -eq 0 ]; then
|
||||
initConfigKey "addons.nvmesystem" "" "${USER_CONFIG_FILE}"
|
||||
elif [ "${MODEL}" = "DS918+" ] || [ "${MODEL}" = "DS1019+" ] || [ "${MODEL}" = "DS1621xs+" ] || [ "${MODEL}" = "RS1619xs+" ]; then
|
||||
initConfigKey "addons.nvmecache" "" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "addons.nvmevolume" "" "${USER_CONFIG_FILE}"
|
||||
else
|
||||
initConfigKey "addons.nvmevolume" "" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
fi
|
||||
if [ "${MACHINE}" = "Native" ]; then
|
||||
initConfigKey "addons.cpufreqscaling" "" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "addons.powersched" "" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "addons.sensors" "" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
if [ "${PLATFORM}" = "apollolake" ] || [ "${PLATFORM}" = "geminilake" ]; then
|
||||
if [ -n "${IGPUID}" ]; then grep -iq "${IGPUID}" ${ARC_PATH}/include/i915ids && IGPU="all" || IGPU="epyc7002"; else IGPU=""; fi
|
||||
[ "${IGPU}"="all" ] && initConfigKey "addons.i915" "" "${USER_CONFIG_FILE}" || true
|
||||
fi
|
||||
if echo "${PAT_URL}" 2>/dev/null | grep -q "7.2.2"; then
|
||||
initConfigKey "addons.allowdowngrade" "" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
if [ -n "${ARCCONF}" ]; then
|
||||
initConfigKey "addons.arcdns" "" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
if [ ${SASDRIVES} -gt 0 ] && [ "${DT}" = "false" ]; then
|
||||
initConfigKey "addons.smartctl" "" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
fi
|
||||
while IFS=': ' read -r ADDON PARAM; do
|
||||
[ -z "${ADDON}" ] && continue
|
||||
if ! checkAddonExist "${ADDON}" "${PLATFORM}"; then
|
||||
deleteConfigKey "addons.\"${ADDON}\"" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
done < <(readConfigMap "addons" "${USER_CONFIG_FILE}")
|
||||
# Check for Only Version
|
||||
if [ "${ONLYVERSION}" = "true" ]; then
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
ONLYVERSION="false"
|
||||
return
|
||||
else
|
||||
arcPatch
|
||||
fi
|
||||
else
|
||||
dialog --backtitle "$(backtitle)" --title "Arc Config" --aspect 18 \
|
||||
--infobox "Arc Config failed!\nExit." 4 40
|
||||
writeConfigKey "arc.confdone" "false" "${USER_CONFIG_FILE}"
|
||||
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
|
||||
sleep 5
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Arc Patch Section
|
||||
function arcPatch() {
|
||||
# Read Model Values
|
||||
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
|
||||
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")"
|
||||
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
if [ "${ARCMODE}" = "automated" ] && [ "${ARCPATCH}" != "user" ]; then
|
||||
if [ -n "${ARCCONF}" ]; then
|
||||
generate_and_write_serial "true"
|
||||
else
|
||||
generate_and_write_serial "false"
|
||||
if [ "${DSMOPTS}" = "true" ]; then
|
||||
write_menu "7" "\Z1Hide DSM Options\Zn"
|
||||
write_menu "j" "Cmdline"
|
||||
write_menu "k" "Synoinfo"
|
||||
write_menu "N" "Add new User"
|
||||
write_menu "t" "Change User Password"
|
||||
write_menu "J" "Reset Network Config"
|
||||
write_menu "T" "Disable all scheduled Tasks"
|
||||
write_menu "M" "Mount DSM Storage Pool"
|
||||
write_menu "l" "Edit User Config"
|
||||
write_menu "s" "Allow Downgrade Version"
|
||||
else
|
||||
write_menu "7" "\Z1Show DSM Options\Zn"
|
||||
fi
|
||||
fi
|
||||
elif [ "${ARCMODE}" = "config" ]; then
|
||||
if [ -n "${ARCCONF}" ]; then
|
||||
dialog --clear --backtitle "$(backtitle)" \
|
||||
--nocancel --title "SN/Mac Options" \
|
||||
--menu "Choose an Option" 7 60 0 \
|
||||
1 "Use Arc Patch (AME, QC, Push Notify and more)" \
|
||||
2 "Use random SN/Mac (Reduced DSM Features)" \
|
||||
3 "Use my own SN/Mac (Be sure your Data is valid)" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
|
||||
if [ "${LOADEROPTS}" = "true" ]; then
|
||||
write_menu "8" "\Z1Hide Loader Options\Zn"
|
||||
write_menu "D" "StaticIP for Loader/DSM"
|
||||
write_menu "f" "Bootscreen Options"
|
||||
write_menu "U" "Change Loader Password"
|
||||
write_menu "Z" "Change Loader Ports"
|
||||
write_menu "w" "Reset Loader to Defaults"
|
||||
write_menu "L" "Grep Logs from dbgutils"
|
||||
write_menu "B" "Grep DSM Config from Backup"
|
||||
write_menu "=" "\Z1== Edit with caution! ==\Zn"
|
||||
write_menu "C" "Clone Loader to another Disk"
|
||||
write_menu "n" "Grub Bootloader Config"
|
||||
write_menu "y" "Choose a Keymap for Loader"
|
||||
write_menu "F" "\Z1Formate Disks\Zn"
|
||||
else
|
||||
dialog --clear --backtitle "$(backtitle)" \
|
||||
--nocancel --title "SN/Mac Options" \
|
||||
--menu "Choose an Option" 7 60 0 \
|
||||
2 "Use random SN/Mac (Reduced DSM Features)" \
|
||||
3 "Use my own SN/Mac (Be sure your Data is valid)" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
write_menu "8" "\Z1Show Loader Options\Zn"
|
||||
fi
|
||||
|
||||
resp=$(cat "${TMP_PATH}/resp")
|
||||
[ -z "${resp}" ] && return 1
|
||||
|
||||
case ${resp} in
|
||||
1)
|
||||
generate_and_write_serial "true"
|
||||
|
||||
dialog --clear --default-item ${NEXT} --backtitle "$(backtitle)" --title "Evo UI Advanced" --colors \
|
||||
--cancel-label "Back" \
|
||||
--menu "" 0 0 0 --file "${TMP_PATH}/menu" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
RET=$?
|
||||
case ${RET} in
|
||||
0)
|
||||
resp=$(cat ${TMP_PATH}/resp)
|
||||
[ -z "${resp}" ] && return
|
||||
case ${resp} in
|
||||
# DSM Section
|
||||
7) [ "${DSMOPTS}" = "true" ] && DSMOPTS='false' || DSMOPTS='true'
|
||||
DSMOPTS="${DSMOPTS}"
|
||||
NEXT="7"
|
||||
;;
|
||||
j) cmdlineMenu; NEXT="j" ;;
|
||||
k) synoinfoMenu; NEXT="k" ;;
|
||||
l) editUserConfig; NEXT="l" ;;
|
||||
s) downgradeMenu; NEXT="s" ;;
|
||||
t) resetPassword; NEXT="t" ;;
|
||||
N) addNewDSMUser; NEXT="N" ;;
|
||||
J) resetDSMNetwork; NEXT="J" ;;
|
||||
M) mountDSM; NEXT="M" ;;
|
||||
T) disablescheduledTasks; NEXT="T" ;;
|
||||
B) getbackup; NEXT="B" ;;
|
||||
# Loader Section
|
||||
8) [ "${LOADEROPTS}" = "true" ] && LOADEROPTS='false' || LOADEROPTS='true'
|
||||
LOADEROPTS="${LOADEROPTS}"
|
||||
NEXT="8"
|
||||
;;
|
||||
D) staticIPMenu; NEXT="D" ;;
|
||||
f) bootScreen; NEXT="f" ;;
|
||||
Z) loaderPorts; NEXT="Z" ;;
|
||||
U) loaderPassword; NEXT="U" ;;
|
||||
L) greplogs; NEXT="L" ;;
|
||||
w) resetLoader; NEXT="w" ;;
|
||||
C) cloneLoader; NEXT="C" ;;
|
||||
n) editGrubCfg; NEXT="n" ;;
|
||||
y) keymapMenu; NEXT="y" ;;
|
||||
F) formatDisks; NEXT="F" ;;
|
||||
6) [ "${BOOTOPTS}" = "true" ] && BOOTOPTS='false' || BOOTOPTS='true'
|
||||
BOOTOPTS="${BOOTOPTS}"
|
||||
NEXT="6"
|
||||
;;
|
||||
m) [ "${KERNELLOAD}" = "kexec" ] && KERNELLOAD='power' || KERNELLOAD='kexec'
|
||||
writeConfigKey "kernelload" "${KERNELLOAD}" "${USER_CONFIG_FILE}"
|
||||
NEXT="m"
|
||||
;;
|
||||
E) [ "${EMMCBOOT}" = "true" ] && EMMCBOOT='false' || EMMCBOOT='true'
|
||||
if [ "${EMMCBOOT}" = "false" ]; then
|
||||
writeConfigKey "emmcboot" "false" "${USER_CONFIG_FILE}"
|
||||
deleteConfigKey "synoinfo.disk_swap" "${USER_CONFIG_FILE}"
|
||||
deleteConfigKey "synoinfo.supportraid" "${USER_CONFIG_FILE}"
|
||||
deleteConfigKey "synoinfo.support_emmc_boot" "${USER_CONFIG_FILE}"
|
||||
deleteConfigKey "synoinfo.support_install_only_dev" "${USER_CONFIG_FILE}"
|
||||
elif [ "${EMMCBOOT}" = "true" ]; then
|
||||
writeConfigKey "emmcboot" "true" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "synoinfo.disk_swap" "no" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "synoinfo.supportraid" "no" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "synoinfo.support_emmc_boot" "yes" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "synoinfo.support_install_only_dev" "yes" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
NEXT="E"
|
||||
;;
|
||||
W) RD_COMPRESSED=$([ "${RD_COMPRESSED}" = "true" ] && echo 'false' || echo 'true')
|
||||
writeConfigKey "rd-compressed" "${RD_COMPRESSED}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
NEXT="W"
|
||||
;;
|
||||
X) satadomMenu; NEXT="X" ;;
|
||||
u) [ "${LKM}" = "prod" ] && LKM='dev' || LKM='prod'
|
||||
writeConfigKey "lkm" "${LKM}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
NEXT="u"
|
||||
;;
|
||||
i) bootipwaittime; NEXT="i" ;;
|
||||
q) [ "${DIRECTBOOT}" = "false" ] && DIRECTBOOT='true' || DIRECTBOOT='false'
|
||||
grub-editenv ${USER_GRUBENVFILE} create
|
||||
writeConfigKey "directboot" "${DIRECTBOOT}" "${USER_CONFIG_FILE}"
|
||||
NEXT="q"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
2)
|
||||
generate_and_write_serial "false"
|
||||
;;
|
||||
3)
|
||||
while true; do
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Serial" \
|
||||
--inputbox "Please enter a valid SN!" 7 50 "" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
[ $? -ne 0 ] && break 2
|
||||
SN="$(cat "${TMP_PATH}/resp" | tr '[:lower:]' '[:upper:]')"
|
||||
[ -z "${SN}" ] && return
|
||||
break
|
||||
done
|
||||
writeConfigKey "arc.patch" "user" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "sn" "${SN}" "${USER_CONFIG_FILE}"
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
|
||||
arcSettings
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Arc Settings Section
|
||||
function arcSettings() {
|
||||
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
|
||||
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
|
||||
KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
|
||||
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
PAT_URL="$(readConfigKey "paturl" "${USER_CONFIG_FILE}")"
|
||||
PAT_HASH="$(readConfigKey "pathash" "${USER_CONFIG_FILE}")"
|
||||
DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")"
|
||||
|
||||
# Network Config for Loader
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Network Config" \
|
||||
--infobox "Generating Network Config..." 3 40
|
||||
sleep 2
|
||||
getnet || return
|
||||
|
||||
if [ "${ONLYPATCH}" = "true" ]; then
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
ONLYPATCH="false"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Select Portmap for Loader
|
||||
if [ "${DT}" = "false" ] && [ ${SATADRIVES} -gt 0 ]; then
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Storage Map" \
|
||||
--infobox "Generating Storage Map..." 3 40
|
||||
sleep 2
|
||||
getmapSelection || return
|
||||
fi
|
||||
|
||||
# Select Addons
|
||||
if [ "${ARCMODE}" = "config" ]; then
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Addons" \
|
||||
--infobox "Loading Addons Table..." 3 40
|
||||
addonSelection || return
|
||||
fi
|
||||
|
||||
# CPU Frequency Scaling & Governor
|
||||
if readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling"; then
|
||||
if [ "${ARCMODE}" = "config" ] && [ "${MACHINE}" = "Native" ]; then
|
||||
dialog --backtitle "$(backtitle)" --colors --title "CPU Frequency Scaling" \
|
||||
--infobox "Generating Governor Table..." 3 40
|
||||
governorSelection || return
|
||||
elif [ "${ARCMODE}" = "automated" ] && [ "${MACHINE}" = "Native" ]; then
|
||||
if [ "${PLATFORM}" = "epyc7002" ]; then
|
||||
writeConfigKey "governor" "schedutil" "${USER_CONFIG_FILE}"
|
||||
else
|
||||
writeConfigKey "governor" "conservative" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Warnings and Checks
|
||||
if [ "${ARCMODE}" = "config" ]; then
|
||||
[ "${DT}" = "true" ] && [ "${EXTERNALCONTROLLER}" = "true" ] && dialog --backtitle "$(backtitle)" --title "Arc Warning" --msgbox "WARN: You use a HBA/Raid Controller and selected a DT Model.\nThis is still an experimental." 6 70
|
||||
DEVICENIC="$(readConfigKey "device.nic" "${USER_CONFIG_FILE}")"
|
||||
MODELNIC="$(readConfigKey "${MODEL}.ports" "${S_FILE}" 2>/dev/null)"
|
||||
[ ${DEVICENIC} -gt 8 ] && dialog --backtitle "$(backtitle)" --title "Arc Warning" --msgbox "WARN: You have more NIC (${DEVICENIC}) than 8 NIC.\nOnly 8 supported by DSM." 6 60
|
||||
[ ${DEVICENIC} -gt ${MODELNIC} ] && [ "${ARCPATCH}" = "true" ] && dialog --backtitle "$(backtitle)" --title "Arc Warning" --msgbox "WARN: You have more NIC (${DEVICENIC}) than supported by Model (${MODELNIC}).\nOnly the first ${MODELNIC} are used by Arc Patch." 6 80
|
||||
[ "${AESSYS}" = "false" ] && dialog --backtitle "$(backtitle)" --title "Arc Warning" --msgbox "WARN: Your System doesn't support Hardware encryption in DSM. (AES)" 5 70
|
||||
[[ "${CPUFREQ}" = "false" || "${ACPISYS}" = "false" ]] && readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling" && dialog --backtitle "$(backtitle)" --title "Arc Warning" --msgbox "WARN: It is possible that CPU Frequency Scaling is not working properly with your System." 6 80
|
||||
fi
|
||||
|
||||
# eMMC Boot Support
|
||||
EMMCBOOT="$(readConfigKey "emmcboot" "${USER_CONFIG_FILE}")"
|
||||
if [ "${EMMCBOOT}" = "true" ]; then
|
||||
writeConfigKey "modules.mmc_block" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "modules.mmc_core" "" "${USER_CONFIG_FILE}"
|
||||
else
|
||||
deleteConfigKey "modules.mmc_block" "${USER_CONFIG_FILE}"
|
||||
deleteConfigKey "modules.mmc_core" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
|
||||
# Final Config Check
|
||||
if [ -n "${PLATFORM}" ] && [ -n "${MODEL}" ] && [ -n "${KVER}" ] && [ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ]; then
|
||||
writeConfigKey "arc.confdone" "true" "${USER_CONFIG_FILE}"
|
||||
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
|
||||
if [ "${ARCMODE}" = "config" ]; then
|
||||
dialog --clear --backtitle "$(backtitle)" --title "Config done" \
|
||||
--no-cancel --menu "Build now?" 7 40 0 \
|
||||
1 "Yes - Build Arc Loader now" \
|
||||
2 "No - I want to make changes" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
resp=$(cat ${TMP_PATH}/resp)
|
||||
[ -z "${resp}" ] && return
|
||||
[ ${resp} -eq 1 ] && arcSummary || dialog --clear --no-items --backtitle "$(backtitle)"
|
||||
else
|
||||
make
|
||||
fi
|
||||
else
|
||||
dialog --backtitle "$(backtitle)" --title "Config failed" --msgbox "ERROR: Config failed!\nExit." 6 40
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Show Summary of Config
|
||||
function arcSummary() {
|
||||
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
|
||||
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
|
||||
DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")"
|
||||
KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
|
||||
PAT_URL="$(readConfigKey "paturl" "${USER_CONFIG_FILE}")"
|
||||
PAT_HASH="$(readConfigKey "pathash" "${USER_CONFIG_FILE}")"
|
||||
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
|
||||
ADDONSINFO="$(readConfigEntriesArray "addons" "${USER_CONFIG_FILE}")"
|
||||
REMAP="$(readConfigKey "arc.remap" "${USER_CONFIG_FILE}")"
|
||||
|
||||
# Read remap configurations
|
||||
PORTMAP="$(readConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}")"
|
||||
DISKMAP="$(readConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}")"
|
||||
PORTREMAP="$(readConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}")"
|
||||
AHCIPORTREMAP="$(readConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}")"
|
||||
|
||||
DIRECTBOOT="$(readConfigKey "directboot" "${USER_CONFIG_FILE}")"
|
||||
KERNELLOAD="$(readConfigKey "kernelload" "${USER_CONFIG_FILE}")"
|
||||
HDDSORT="$(readConfigKey "hddsort" "${USER_CONFIG_FILE}")"
|
||||
NIC="$(readConfigKey "device.nic" "${USER_CONFIG_FILE}")"
|
||||
EXTERNALCONTROLLER="$(readConfigKey "device.externalcontroller" "${USER_CONFIG_FILE}")"
|
||||
HARDDRIVES="$(readConfigKey "device.harddrives" "${USER_CONFIG_FILE}")"
|
||||
DRIVES="$(readConfigKey "device.drives" "${USER_CONFIG_FILE}")"
|
||||
EMMCBOOT="$(readConfigKey "emmcboot" "${USER_CONFIG_FILE}")"
|
||||
KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
|
||||
|
||||
# Check for user-defined remap values
|
||||
if [ "${DT}" = "false" ] && [ "${REMAP}" = "user" ] && [ -z "${PORTMAP}${DISKMAP}${PORTREMAP}${AHCIPORTREMAP}" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Arc Error" \
|
||||
--msgbox "ERROR: You selected Portmap: User and not set any values. -> Can't build Loader!\nGo need to go Cmdline Options and add your Values." 6 80
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Print Summary
|
||||
SUMMARY="\Z4> DSM Information\Zn"
|
||||
SUMMARY+="\n>> Model: \Zb${MODEL}\Zn"
|
||||
SUMMARY+="\n>> Version: \Zb${PRODUCTVER}\Zn"
|
||||
SUMMARY+="\n>> Platform: \Zb${PLATFORM}\Zn"
|
||||
SUMMARY+="\n>> DT: \Zb${DT}\Zn"
|
||||
SUMMARY+="\n>> PAT URL: \Zb${PAT_URL}\Zn"
|
||||
SUMMARY+="\n>> PAT Hash: \Zb${PAT_HASH}\Zn"
|
||||
[ "${MODEL}" = "SA6400" ] && SUMMARY+="\n>> Kernel: \Zb${KERNEL}\Zn"
|
||||
SUMMARY+="\n>> Kernel Version: \Zb${KVER}\Zn"
|
||||
SUMMARY+="\n"
|
||||
SUMMARY+="\n\Z4> Arc Information\Zn"
|
||||
SUMMARY+="\n>> Arc Patch: \Zb${ARCPATCH}\Zn"
|
||||
[ -n "${PORTMAP}" ] && SUMMARY+="\n>> SataPortmap: \Zb${PORTMAP}\Zn"
|
||||
[ -n "${DISKMAP}" ] && SUMMARY+="\n>> DiskIdxMap: \Zb${DISKMAP}\Zn"
|
||||
[ -n "${PORTREMAP}" ] && SUMMARY+="\n>> SataRemap: \Zb${PORTREMAP}\Zn"
|
||||
[ -n "${AHCIPORTREMAP}" ] && SUMMARY+="\n>> AhciRemap: \Zb${AHCIPORTREMAP}\Zn"
|
||||
[ "${DT}" = "true" ] && SUMMARY+="\n>> Sort Drives: \Zb${HDDSORT}\Zn"
|
||||
SUMMARY+="\n>> Directboot: \Zb${DIRECTBOOT}\Zn"
|
||||
SUMMARY+="\n>> eMMC Boot: \Zb${EMMCBOOT}\Zn"
|
||||
SUMMARY+="\n>> Kernelload: \Zb${KERNELLOAD}\Zn"
|
||||
SUMMARY+="\n>> Addons: \Zb${ADDONSINFO}\Zn"
|
||||
SUMMARY+="\n"
|
||||
SUMMARY+="\n\Z4> Device Information\Zn"
|
||||
SUMMARY+="\n>> NIC: \Zb${NIC}\Zn"
|
||||
SUMMARY+="\n>> Total Disks: \Zb${DRIVES}\Zn"
|
||||
SUMMARY+="\n>> Internal Disks: \Zb${HARDDRIVES}\Zn"
|
||||
SUMMARY+="\n>> Additional Controller: \Zb${EXTERNALCONTROLLER}\Zn"
|
||||
SUMMARY+="\n"
|
||||
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Config Summary" \
|
||||
--extra-button --extra-label "Cancel" --msgbox "${SUMMARY}" 0 0
|
||||
|
||||
RET=$?
|
||||
case ${RET} in
|
||||
0)
|
||||
make
|
||||
;;
|
||||
3|255)
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Building Loader
|
||||
function make() {
|
||||
# Read Model Config
|
||||
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
|
||||
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
|
||||
DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")"
|
||||
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
|
||||
PAT_URL="$(readConfigKey "paturl" "${USER_CONFIG_FILE}")"
|
||||
PAT_HASH="$(readConfigKey "pathash" "${USER_CONFIG_FILE}")"
|
||||
# Check for Arc Patch
|
||||
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")"
|
||||
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
|
||||
if [ -z "${ARCCONF}" ] || [ "${ARCPATCH}" = "false" ]; then
|
||||
deleteConfigKey "addons.amepatch" "${USER_CONFIG_FILE}"
|
||||
deleteConfigKey "addons.arcdns" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
# Max Memory for DSM
|
||||
RAMCONFIG="$((${RAMTOTAL} * 1024 * 2))"
|
||||
writeConfigKey "synoinfo.mem_max_mb" "${RAMCONFIG}" "${USER_CONFIG_FILE}"
|
||||
if [ -n "${IPCON}" ]; then
|
||||
getpatfiles
|
||||
else
|
||||
dialog --backtitle "$(backtitle)" --title "Build Loader" --aspect 18 \
|
||||
--infobox "Could not build Loader!\nNetwork Connection needed." 4 40
|
||||
# Set Build to false
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
sleep 2
|
||||
return
|
||||
fi
|
||||
if [ -f "${ORI_ZIMAGE_FILE}" ] && [ -f "${ORI_RDGZ_FILE}" ] && [ "${CONFDONE}" = "true" ] && [ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ]; then
|
||||
(
|
||||
livepatch
|
||||
sleep 3
|
||||
) 2>&1 | dialog --backtitle "$(backtitle)" --colors --title "Build Loader" \
|
||||
--progressbox "Patching DSM Files..." 20 70
|
||||
else
|
||||
dialog --backtitle "$(backtitle)" --title "Build Loader" --aspect 18 \
|
||||
--infobox "Configuration issue found.\nCould not build Loader!\nExit." 5 40
|
||||
# Set Build to false
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
sleep 2
|
||||
return
|
||||
fi
|
||||
if [ -f "${ORI_ZIMAGE_FILE}" ] && [ -f "${ORI_RDGZ_FILE}" ] && [ -f "${MOD_ZIMAGE_FILE}" ] && [ -f "${MOD_RDGZ_FILE}" ]; then
|
||||
MODELID="$(echo ${MODEL} | sed 's/d$/D/; s/rp$/RP/; s/rp+/RP+/')"
|
||||
writeConfigKey "modelid" "${MODELID}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "arc.version" "${ARC_VERSION}" "${USER_CONFIG_FILE}"
|
||||
arcFinish
|
||||
else
|
||||
dialog --backtitle "$(backtitle)" --title "Build Loader" --aspect 18 \
|
||||
--infobox "Could not build Loader!\nExit." 4 40
|
||||
# Set Build to false
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
sleep 2
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Finish Building Loader
|
||||
function arcFinish() {
|
||||
rm -f "${LOG_FILE}" >/dev/null 2>&1 || true
|
||||
MODELID="$(readConfigKey "modelid" "${USER_CONFIG_FILE}")"
|
||||
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
|
||||
if [ -n "${MODELID}" ]; then
|
||||
writeConfigKey "arc.builddone" "true" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
|
||||
if [ "${ARCMODE}" = "automated" ] || [ "${UPDATEMODE}" = "true" ]; then
|
||||
boot
|
||||
else
|
||||
# Ask for Boot
|
||||
dialog --clear --backtitle "$(backtitle)" --title "Build done" \
|
||||
--no-cancel --menu "Boot now?" 7 40 0 \
|
||||
1 "Yes - Boot DSM now" \
|
||||
2 "No - I want to make changes" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
resp=$(cat "${TMP_PATH}/resp")
|
||||
[ "${resp}" -eq 1 ] && boot || return
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Calls boot.sh to boot into DSM Reinstall Mode
|
||||
function juniorboot() {
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
MODELID="$(readConfigKey "modelid" "${USER_CONFIG_FILE}")"
|
||||
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
if [[ "${BUILDDONE}" = "false" && "${ARCMODE}" != "automated" ]] || [ "${MODEL}" != "${MODELID}" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Alert" \
|
||||
--yesno "Config changed, you need to rebuild the Loader?" 0 0
|
||||
if [ $? -eq 0 ]; then
|
||||
arcSummary
|
||||
fi
|
||||
else
|
||||
dialog --backtitle "$(backtitle)" --title "Arc Boot" \
|
||||
--infobox "Booting DSM Reinstall Mode...\nPlease stay patient!" 4 30
|
||||
sleep 3
|
||||
rebootTo junior
|
||||
fi
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Calls boot.sh to boot into DSM kernel/ramdisk
|
||||
function boot() {
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
MODELID="$(readConfigKey "modelid" "${USER_CONFIG_FILE}")"
|
||||
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
if [[ "${BUILDDONE}" = "false" && "${ARCMODE}" != "automated" ]] || [ "${MODEL}" != "${MODELID}" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Alert" \
|
||||
--yesno "Config changed, you need to rebuild the Loader?" 0 0
|
||||
if [ $? -eq 0 ]; then
|
||||
arcSummary
|
||||
fi
|
||||
else
|
||||
dialog --backtitle "$(backtitle)" --title "Arc Boot" \
|
||||
--infobox "Booting DSM...\nPlease stay patient!" 4 25
|
||||
sleep 2
|
||||
exec reboot
|
||||
fi
|
||||
done
|
||||
return
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
@@ -756,18 +210,18 @@ elif [ "${ARCMODE}" = "config" ]; then
|
||||
rm -f "${TMP_PATH}/menu" "${TMP_PATH}/resp" >/dev/null 2>&1 || true
|
||||
write_menu "=" "\Z4===== Main =====\Zn"
|
||||
if [ -z "${USERID}" ] && [ "${ARCOFFLINE}" = "false" ]; then
|
||||
write_menu_with_color "0" "HardwareID" "${HARDWAREID}"
|
||||
write_menu_value "0" "HardwareID" "${HARDWAREID}"
|
||||
fi
|
||||
|
||||
write_menu_with_color "1" "Model" "${MODEL}"
|
||||
write_menu_value "1" "Model" "${MODEL}"
|
||||
|
||||
if [ "${CONFDONE}" = "true" ]; then
|
||||
write_menu_with_color "e" "Version" "${PRODUCTVER}"
|
||||
write_menu_with_color "=" "DT" "${DT}"
|
||||
write_menu_with_color "=" "Platform" "${PLATFORM}"
|
||||
write_menu_value "e" "Version" "${PRODUCTVER}"
|
||||
write_menu_value "=" "DT" "${DT}"
|
||||
write_menu_value "=" "Platform" "${PLATFORM}"
|
||||
|
||||
if [ -n "${USERID}" ] && [ "${ARCOFFLINE}" = "false" ]; then
|
||||
write_menu_with_color "p" "Arc Patch" "${ARCPATCH}"
|
||||
write_menu_value "p" "Arc Patch" "${ARCPATCH}"
|
||||
elif [ "${ARCOFFLINE}" = "false" ]; then
|
||||
write_menu "p" "Arc Patch: \Z4Register HardwareID first\Zn"
|
||||
else
|
||||
@@ -779,7 +233,7 @@ elif [ "${ARCMODE}" = "config" ]; then
|
||||
if [ ${CPUINFO} -gt 24 ]; then
|
||||
write_menu "=" "Custom Kernel should be used for this CPU"
|
||||
fi
|
||||
write_menu_with_color "K" "Kernel" "${KERNEL}"
|
||||
write_menu_value "K" "Kernel" "${KERNEL}"
|
||||
fi
|
||||
|
||||
write_menu "b" "Addons"
|
||||
@@ -787,29 +241,29 @@ elif [ "${ARCMODE}" = "config" ]; then
|
||||
for addon in "cpufreqscaling" "storagepanel" "sequentialio"; do
|
||||
if readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "${addon}"; then
|
||||
case "${addon}" in
|
||||
"cpufreqscaling") write_menu_with_color "g" "Scaling Governor" "${GOVERNOR}" ;;
|
||||
"storagepanel") write_menu_with_color "P" "StoragePanel" "${STORAGEPANEL:-auto}" ;;
|
||||
"sequentialio") write_menu_with_color "Q" "SequentialIO" "${SEQUENTIALIO}" ;;
|
||||
"cpufreqscaling") write_menu_value "g" "Scaling Governor" "${GOVERNOR}" ;;
|
||||
"storagepanel") write_menu_value "P" "StoragePanel" "${STORAGEPANEL:-auto}" ;;
|
||||
"sequentialio") write_menu_value "Q" "SequentialIO" "${SEQUENTIALIO}" ;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
|
||||
write_menu "d" "Modules"
|
||||
write_menu_with_color "O" "Official Driver Priority" "${ODP}"
|
||||
write_menu_value "O" "Official Driver Priority" "${ODP}"
|
||||
|
||||
if [ "${DT}" = "false" ] && [ ${SATACONTROLLER} -gt 0 ]; then
|
||||
write_menu_with_color "S" "PortMap" "${REMAP}"
|
||||
write_menu_with_color "=" "Mapping" "${PORTMAP}"
|
||||
write_menu_value "S" "PortMap" "${REMAP}"
|
||||
write_menu_value "=" "Mapping" "${PORTMAP}"
|
||||
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
|
||||
fi
|
||||
|
||||
write_menu_with_color "c" "Offline Mode" "${ARCOFFLINE}"
|
||||
write_menu_value "c" "Offline Mode" "${ARCOFFLINE}"
|
||||
write_menu "9" "Advanced Options"
|
||||
write_menu "=" "\Z4===== Diag =====\Zn"
|
||||
write_menu "a" "Sysinfo"
|
||||
@@ -925,7 +379,7 @@ elif [ "${ARCMODE}" = "config" ]; then
|
||||
esac
|
||||
done
|
||||
else
|
||||
exec reboot
|
||||
echo "Unknown Mode: ${ARCMODE} - Exiting..."
|
||||
fi
|
||||
|
||||
# Inform user
|
||||
|
||||
Binary file not shown.
@@ -4,9 +4,10 @@ PART2_PATH="/mnt/p2"
|
||||
PART3_PATH="/mnt/p3"
|
||||
TMP_PATH="/tmp"
|
||||
|
||||
[ -f "${PART1_PATH}/ARC-BRANCH" ] && ARC_BRANCH=$(cat "${PART1_PATH}/ARC-BRANCH") || ARC_BRANCH="null"
|
||||
[ -f "${PART1_PATH}/ARC-VERSION" ] && ARC_VERSION=$(cat "${PART1_PATH}/ARC-VERSION") || ARC_VERSION="null"
|
||||
[ -f "${PART1_PATH}/ARC-BUILD" ] && ARC_BUILD=$(cat "${PART1_PATH}/ARC-BUILD") || ARC_BUILD="null"
|
||||
[ -f "${PART3_PATH}/automated" ] && rm -f "${PART3_PATH}/automated" >/dev/null 2>&1 || true
|
||||
[ -f "${PART1_PATH}/ARC-BRANCH" ] && ARC_BRANCH="$(cat "${PART1_PATH}/ARC-BRANCH")" || ARC_BRANCH="null"
|
||||
[ -f "${PART1_PATH}/ARC-VERSION" ] && ARC_VERSION="$(cat "${PART1_PATH}/ARC-VERSION")" || ARC_VERSION="null"
|
||||
[ -f "${PART1_PATH}/ARC-BUILD" ] && ARC_BUILD="$(cat "${PART1_PATH}/ARC-BUILD")" || ARC_BUILD="null"
|
||||
ARC_TITLE="Arc ${ARC_VERSION}"
|
||||
|
||||
RAMDISK_PATH="${TMP_PATH}/ramdisk"
|
||||
@@ -44,7 +45,7 @@ EXTRACTOR_PATH="${PART3_PATH}/extractor"
|
||||
EXTRACTOR_BIN="syno_extract_system_patch"
|
||||
|
||||
HTTPPORT=$(grep -i '^HTTP_PORT=' /etc/arc.conf 2>/dev/null | cut -d'=' -f2)
|
||||
[ -z "${HTTPPORT}" ] && HTTPPORT=5000 || true
|
||||
[ -z "${HTTPPORT}" ] && HTTPPORT="" || true
|
||||
DUFSPORT=$(grep -i '^DUFS_PORT=' /etc/arc.conf 2>/dev/null | cut -d'=' -f2)
|
||||
[ -z "${DUFSPORT}" ] && DUFSPORT=7304 || true
|
||||
TTYDPORT=$(grep -i '^TTYD_PORT=' /etc/arc.conf 2>/dev/null | cut -d'=' -f2)
|
||||
|
||||
@@ -11,7 +11,7 @@ function checkBootLoader() {
|
||||
[ -z "${KNAME}" ] && continue
|
||||
[ "${RO}" = "0" ] && continue
|
||||
hdparm -r0 "${KNAME}" >/dev/null 2>&1 || true
|
||||
done <<<$(lsblk -pno KNAME,RO 2>/dev/null)
|
||||
done < <(lsblk -pno KNAME,RO 2>/dev/null)
|
||||
[ ! -w "${PART1_PATH}" ] && return 1
|
||||
[ ! -w "${PART2_PATH}" ] && return 1
|
||||
[ ! -w "${PART3_PATH}" ] && return 1
|
||||
@@ -22,6 +22,61 @@ function checkBootLoader() {
|
||||
return 0
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Check boot mode
|
||||
function arc_mode() {
|
||||
if grep -q 'automated_arc' /proc/cmdline; then
|
||||
ARCMODE="automated"
|
||||
elif grep -q 'update_arc' /proc/cmdline; then
|
||||
ARCMODE="update"
|
||||
elif grep -q 'force_arc' /proc/cmdline; then
|
||||
ARCMODE="config"
|
||||
else
|
||||
ARCMODE="dsm"
|
||||
fi
|
||||
[ "$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")" ] && ARCCONF="true" || true
|
||||
}
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Check for NIC and IP
|
||||
function checkNIC() {
|
||||
# Get Amount of NIC
|
||||
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth)
|
||||
for N in ${ETHX}; do
|
||||
COUNT=0
|
||||
DRIVER=$(basename "$(readlink -f /sys/class/net/${N}/device/driver 2>/dev/null)")
|
||||
while true; do
|
||||
CARRIER=$(cat /sys/class/net/${N}/carrier 2>/dev/null)
|
||||
if [ "${CARRIER}" = "0" ]; then
|
||||
echo -e "\r${DRIVER}: \033[1;37mNOT CONNECTED\033[0m"
|
||||
break
|
||||
fi
|
||||
COUNT=$((COUNT + 1))
|
||||
IP=$(getIP "${N}")
|
||||
if [ -n "${IP}" ]; then
|
||||
SPEED=$(ethtool ${N} 2>/dev/null | awk '/Speed:/ {print $2}')
|
||||
if [[ "${IP}" =~ ^169\.254\..* ]]; then
|
||||
echo -e "\r${DRIVER} (${SPEED}): \033[1;37mLINK LOCAL (No DHCP server found.)\033[0m"
|
||||
else
|
||||
echo -e "\r${DRIVER} (${SPEED}): \033[1;37m${IP}\033[0m"
|
||||
[ -z "${IPCON}" ] && IPCON="${IP}"
|
||||
fi
|
||||
break
|
||||
fi
|
||||
if [ -z "${CARRIER}" ]; then
|
||||
echo -e "\r${DRIVER}: \033[1;37mDOWN\033[0m"
|
||||
break
|
||||
fi
|
||||
if [ ${COUNT} -ge ${BOOTIPWAIT} ]; then
|
||||
echo -e "\r${DRIVER}: \033[1;37mTIMEOUT\033[0m"
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Just show error message and dies
|
||||
function die() {
|
||||
@@ -256,8 +311,8 @@ function _sort_netif() {
|
||||
|
||||
# sort
|
||||
if [ ! "${ETHSEQ}" = "$(seq 0 $((${ETHNUM:0} - 1)))" ]; then
|
||||
/etc/init.d/S41dhcpcd stop >/dev/null 2>&1
|
||||
/etc/init.d/S40network stop >/dev/null 2>&1
|
||||
/etc/init.d/S09dhcpcd stop >/dev/null 2>&1
|
||||
/etc/init.d/S07network stop >/dev/null 2>&1
|
||||
for i in $(seq 0 $((${ETHNUM:0} - 1))); do
|
||||
ip link set dev eth${i} name tmp${i}
|
||||
done
|
||||
@@ -266,8 +321,8 @@ function _sort_netif() {
|
||||
ip link set dev tmp${i} name eth${I}
|
||||
I=$((${I} + 1))
|
||||
done
|
||||
/etc/init.d/S40network start >/dev/null 2>&1
|
||||
/etc/init.d/S41dhcpcd start >/dev/null 2>&1
|
||||
/etc/init.d/S07network start >/dev/null 2>&1
|
||||
/etc/init.d/S09dhcpcd start >/dev/null 2>&1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
@@ -419,7 +474,7 @@ function checkBIOS_VT_d() {
|
||||
###############################################################################
|
||||
# Rebooting
|
||||
function rebootTo() {
|
||||
local MODES="config recovery junior automated update bios memtest"
|
||||
local MODES="config recovery junior automated update uefi memtest"
|
||||
[ -z "${1}" ] && exit 1
|
||||
if ! echo "${MODES}" | grep -wq "${1}"; then exit 1; fi
|
||||
[ "${1}" = "automated" ] && echo "arc-${MODEL}-${PRODUCTVER}-${ARC_VERSION}" >"${PART3_PATH}/automated"
|
||||
@@ -563,6 +618,7 @@ function onlineCheck() {
|
||||
if [ -n "${NEWTAG}" ]; then
|
||||
writeConfigKey "arc.offline" "false" "${USER_CONFIG_FILE}"
|
||||
updateOffline
|
||||
checkHardwareID
|
||||
else
|
||||
writeConfigKey "arc.offline" "true" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
@@ -603,9 +659,10 @@ function systemCheck () {
|
||||
CPUFREQ="false"
|
||||
fi
|
||||
# Check for Arc Patch
|
||||
ARCCONF="$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")"
|
||||
arc_mode
|
||||
[ -z "${ARCCONF}" ] && writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
|
||||
# Check for Disks
|
||||
getnetinfo
|
||||
getdiskinfo
|
||||
getmap
|
||||
}
|
||||
|
||||
@@ -678,12 +735,80 @@ function fixDSMRootPart() {
|
||||
fi
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Read Data
|
||||
function readData() {
|
||||
# Get DSM Data from Config
|
||||
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
MODELID="$(readConfigKey "modelid" "${USER_CONFIG_FILE}")"
|
||||
LKM="$(readConfigKey "lkm" "${USER_CONFIG_FILE}")"
|
||||
if [ -n "${MODEL}" ]; then
|
||||
DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")"
|
||||
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
|
||||
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
|
||||
fi
|
||||
|
||||
# Get Arc Data from Config
|
||||
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
|
||||
HARDWAREID="$(genHWID)"
|
||||
USERID="$(readConfigKey "arc.userid" "${USER_CONFIG_FILE}")"
|
||||
EXTERNALCONTROLLER="$(readConfigKey "device.externalcontroller" "${USER_CONFIG_FILE}")"
|
||||
SATACONTROLLER="$(readConfigKey "device.satacontroller" "${USER_CONFIG_FILE}")"
|
||||
SCSICONTROLLER="$(readConfigKey "device.scsicontroller" "${USER_CONFIG_FILE}")"
|
||||
RAIDCONTROLLER="$(readConfigKey "device.raidcontroller" "${USER_CONFIG_FILE}")"
|
||||
SASCONTROLLER="$(readConfigKey "device.sascontroller" "${USER_CONFIG_FILE}")"
|
||||
|
||||
# Advanced Config
|
||||
BOOTIPWAIT="$(readConfigKey "bootipwait" "${USER_CONFIG_FILE}")"
|
||||
DIRECTBOOT="$(readConfigKey "directboot" "${USER_CONFIG_FILE}")"
|
||||
EMMCBOOT="$(readConfigKey "emmcboot" "${USER_CONFIG_FILE}")"
|
||||
HDDSORT="$(readConfigKey "hddsort" "${USER_CONFIG_FILE}")"
|
||||
USBMOUNT="$(readConfigKey "usbmount" "${USER_CONFIG_FILE}")"
|
||||
KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
|
||||
KERNELLOAD="$(readConfigKey "kernelload" "${USER_CONFIG_FILE}")"
|
||||
KERNELPANIC="$(readConfigKey "kernelpanic" "${USER_CONFIG_FILE}")"
|
||||
GOVERNOR="$(readConfigKey "governor" "${USER_CONFIG_FILE}")"
|
||||
STORAGEPANEL="$(readConfigKey "addons.storagepanel" "${USER_CONFIG_FILE}")"
|
||||
SEQUENTIALIO="$(readConfigKey "addons.sequentialio" "${USER_CONFIG_FILE}")"
|
||||
ODP="$(readConfigKey "odp" "${USER_CONFIG_FILE}")"
|
||||
RD_COMPRESSED="$(readConfigKey "rd-compressed" "${USER_CONFIG_FILE}")"
|
||||
SATADOM="$(readConfigKey "satadom" "${USER_CONFIG_FILE}")"
|
||||
REMAP="$(readConfigKey "arc.remap" "${USER_CONFIG_FILE}")"
|
||||
if [ "${REMAP}" = "acports" ] || [ "${REMAP}" = "maxports" ]; then
|
||||
PORTMAP="$(readConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}")"
|
||||
DISKMAP="$(readConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}")"
|
||||
elif [ "${REMAP}" = "remap" ]; then
|
||||
PORTMAP="$(readConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}")"
|
||||
elif [ "${REMAP}" = "ahci" ]; then
|
||||
PORTMAP="$(readConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}")"
|
||||
elif [ "${REMAP}" = "user" ]; then
|
||||
PORTMAP="user"
|
||||
fi
|
||||
if [[ "${REMAP}" = "acports" || "${REMAP}" = "maxports" ]]; then
|
||||
SPORTMAP="SataPortMap: ${PORTMAP} | ${DISKMAP}"
|
||||
elif [ "${REMAP}" = "remap" ]; then
|
||||
SPORTMAP="SataRemap: ${PORTMAP}"
|
||||
elif [ "${REMAP}" = "ahci" ]; then
|
||||
SPORTMAP="AHCIRemap: ${PORTMAP}"
|
||||
elif [ "${REMAP}" = "user" ]; then
|
||||
SPORTMAP=""
|
||||
[ -n "${PORTMAP}" ] && SPORTMAP+="SataPortMap: ${PORTMAP}"
|
||||
[ -n "${DISKMAP}" ] && SPORTMAP+="DiskIdxMap: ${DISKMAP}"
|
||||
[ -n "${PORTREMAP}" ] && SPORTMAP+="SataRemap: ${PORTREMAP}"
|
||||
[ -n "${AHCIPORTREMAP}" ] && SPORTMAP+="AHCIRemap: ${AHCIPORTREMAP}"
|
||||
fi
|
||||
|
||||
# Get Config/Build Status
|
||||
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Menu functions
|
||||
function write_menu() {
|
||||
echo "$1 \"$2\" " >>"${TMP_PATH}/menu"
|
||||
}
|
||||
|
||||
function write_menu_with_color() {
|
||||
function write_menu_value() {
|
||||
echo "$1 \"$2: \Z4${3:-none}\Zn\" " >>"${TMP_PATH}/menu"
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
# Get Network Config for Loader
|
||||
function getnet() {
|
||||
generate_and_write_macs() {
|
||||
local patch=$1
|
||||
local macs=($(generateMacAddress "${MODEL}" "${ETHN}" "${patch}"))
|
||||
|
||||
for i in $(seq 1 "${ETHN}"); do
|
||||
local mac="${macs[$((i - 1))]}"
|
||||
writeConfigKey "eth$((i - 1))" "${mac}" "${USER_CONFIG_FILE}"
|
||||
done
|
||||
}
|
||||
|
||||
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth)
|
||||
MODEL=$(readConfigKey "model" "${USER_CONFIG_FILE}")
|
||||
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
|
||||
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")"
|
||||
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
ETHN=$(echo "${ETHX}" | wc -w)
|
||||
|
||||
if [ "${ARCPATCH}" = "user" ]; then
|
||||
for N in ${ETHX}; do
|
||||
while true; do
|
||||
dialog --backtitle "$(backtitle)" --title "Mac Setting" \
|
||||
--inputbox "Type a custom Mac for ${N} (Eq. 001132a1b2c3).\nA custom Mac will not be applied to NIC!" 8 50 \
|
||||
2>"${TMP_PATH}/resp"
|
||||
[ $? -ne 0 ] && break
|
||||
MAC=$(cat "${TMP_PATH}/resp")
|
||||
[ -z "${MAC}" ] && MAC=$(readConfigKey "${N}" "${USER_CONFIG_FILE}")
|
||||
[ -z "${MAC}" ] && MAC=$(cat /sys/class/net/${N}/address 2>/dev/null | sed 's/://g')
|
||||
MAC=$(echo "${MAC}" | tr '[:upper:]' '[:lower:]')
|
||||
if [ ${#MAC} -eq 12 ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Mac Setting" --msgbox "Set Mac for ${N} to ${MAC}!" 5 50
|
||||
writeConfigKey "${N}" "${MAC}" "${USER_CONFIG_FILE}"
|
||||
break
|
||||
else
|
||||
dialog --backtitle "$(backtitle)" --title "Mac Setting" --msgbox "Invalid MAC - Try again!" 5 50
|
||||
fi
|
||||
done
|
||||
done
|
||||
elif [ "${ARCPATCH}" != "user" ] && [ -n "${ARCCONF}" ]; then
|
||||
generate_and_write_macs "${ARCPATCH}"
|
||||
else
|
||||
generate_and_write_macs "false"
|
||||
fi
|
||||
}
|
||||
|
||||
# Get Amount of NIC
|
||||
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth)
|
||||
# Get actual IP
|
||||
for N in ${ETHX}; do
|
||||
IPCON="$(getIP "${N}")"
|
||||
[ -n "${IPCON}" ] && break || IPCON="noip"
|
||||
done
|
||||
@@ -1,233 +0,0 @@
|
||||
# Get PortMap for Loader
|
||||
function getmap() {
|
||||
function show_and_set_remap() {
|
||||
dialog --backtitle "$(backtitle)" --title "Sata Portmap" \
|
||||
--menu "Choose a Portmap for Sata!?\n* Recommended Option" 8 60 0 \
|
||||
1 "DiskIdxMap: Active Ports ${REMAP1}" \
|
||||
2 "DiskIdxMap: Max Ports ${REMAP2}" \
|
||||
3 "SataRemap: Remove empty Ports ${REMAP3}" \
|
||||
4 "AhciRemap: Remove empty Ports (new) ${REMAP4}" \
|
||||
5 "Set my own Portmap in Config" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
[ $? -ne 0 ] && return 1
|
||||
resp=$(cat "${TMP_PATH}/resp")
|
||||
[ -z "${resp}" ] && return 1
|
||||
|
||||
case ${resp} in
|
||||
1) writeConfigKey "arc.remap" "acports" "${USER_CONFIG_FILE}" ;;
|
||||
2) writeConfigKey "arc.remap" "maxports" "${USER_CONFIG_FILE}" ;;
|
||||
3) writeConfigKey "arc.remap" "remap" "${USER_CONFIG_FILE}" ;;
|
||||
4) writeConfigKey "arc.remap" "ahci" "${USER_CONFIG_FILE}" ;;
|
||||
5) writeConfigKey "arc.remap" "user" "${USER_CONFIG_FILE}" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Sata Disks
|
||||
SATADRIVES=0
|
||||
if [ $(lspci -d ::106 2>/dev/null | wc -l) -gt 0 ]; then
|
||||
# Clean old files
|
||||
for file in drivesmax drivescon ports remap; do
|
||||
> "${TMP_PATH}/${file}"
|
||||
done
|
||||
|
||||
DISKIDXMAPIDX=0
|
||||
DISKIDXMAP=""
|
||||
DISKIDXMAPIDXMAX=0
|
||||
DISKIDXMAPMAX=""
|
||||
|
||||
for PCI in $(lspci -d ::106 2>/dev/null | awk '{print $1}'); do
|
||||
NUMPORTS=0
|
||||
CONPORTS=0
|
||||
declare -A HOSTPORTS
|
||||
|
||||
while read -r LINE; do
|
||||
PORT=$(echo ${LINE} | grep -o 'ata[0-9]*' | sed 's/ata//')
|
||||
HOSTPORTS[${PORT}]=$(echo ${LINE} | grep -o 'host[0-9]*$')
|
||||
done < <(ls -l /sys/class/scsi_host | grep -F "${PCI}")
|
||||
|
||||
for PORT in $(echo ${!HOSTPORTS[@]} | tr ' ' '\n' | sort -n); do
|
||||
ATTACH=$(ls -l /sys/block | grep -F -q "${PCI}/ata${PORT}" && echo 1 || echo 0)
|
||||
PCMD=$(cat /sys/class/scsi_host/${HOSTPORTS[${PORT}]}/ahci_port_cmd)
|
||||
DUMMY=$([ ${PCMD} = 0 ] && echo 1 || echo 0)
|
||||
|
||||
[ ${ATTACH} = 1 ] && CONPORTS=$((CONPORTS + 1)) && echo $((PORT - 1)) >>"${TMP_PATH}/ports"
|
||||
NUMPORTS=$((NUMPORTS + 1))
|
||||
done
|
||||
|
||||
NUMPORTS=$((NUMPORTS > 8 ? 8 : NUMPORTS))
|
||||
CONPORTS=$((CONPORTS > 8 ? 8 : CONPORTS))
|
||||
|
||||
echo -n "${NUMPORTS}" >>"${TMP_PATH}/drivesmax"
|
||||
echo -n "${CONPORTS}" >>"${TMP_PATH}/drivescon"
|
||||
DISKIDXMAP+=$(printf "%02x" $DISKIDXMAPIDX)
|
||||
DISKIDXMAPIDX=$((DISKIDXMAPIDX + CONPORTS))
|
||||
DISKIDXMAPMAX+=$(printf "%02x" $DISKIDXMAPIDXMAX)
|
||||
DISKIDXMAPIDXMAX=$((DISKIDXMAPIDXMAX + NUMPORTS))
|
||||
SATADRIVES=$((SATADRIVES + CONPORTS))
|
||||
done
|
||||
fi
|
||||
|
||||
# SAS Disks
|
||||
SASDRIVES=0
|
||||
if [ $(lspci -d ::107 2>/dev/null | wc -l) -gt 0 ]; then
|
||||
for PCI in $(lspci -d ::107 2>/dev/null | awk '{print $1}'); do
|
||||
PORT=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n 2>/dev/null)
|
||||
PORTNUM=$(lsscsi -b | grep -v - | grep "\[${PORT}:" | wc -l)
|
||||
SASDRIVES=$((SASDRIVES + PORTNUM))
|
||||
done
|
||||
fi
|
||||
|
||||
# SCSI Disks
|
||||
SCSIDRIVES=0
|
||||
if [ $(lspci -d ::100 2>/dev/null | wc -l) -gt 0 ]; then
|
||||
for PCI in $(lspci -d ::100 2>/dev/null | awk '{print $1}'); do
|
||||
PORT=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n 2>/dev/null)
|
||||
PORTNUM=$(lsscsi -b | grep -v - | grep "\[${PORT}:" | wc -l)
|
||||
SCSIDRIVES=$((SCSIDRIVES + PORTNUM))
|
||||
done
|
||||
fi
|
||||
|
||||
# Raid Disks
|
||||
RAIDDRIVES=0
|
||||
if [ $(lspci -d ::104 2>/dev/null | wc -l) -gt 0 ]; then
|
||||
for PCI in $(lspci -d ::104 2>/dev/null | awk '{print $1}'); do
|
||||
PORT=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n 2>/dev/null)
|
||||
PORTNUM=$(lsscsi -b | grep -v - | grep "\[${PORT}:" | wc -l)
|
||||
RAIDDRIVES=$((RAIDDRIVES + PORTNUM))
|
||||
done
|
||||
fi
|
||||
|
||||
# NVMe Disks
|
||||
NVMEDRIVES=0
|
||||
if [ $(ls -l /sys/class/nvme 2>/dev/null | wc -l) -gt 0 ]; then
|
||||
for PCI in $(lspci -d ::108 2>/dev/null | awk '{print $1}'); do
|
||||
PORTNUM=$(ls -l /sys/class/nvme | grep "${PCI}" | wc -l 2>/dev/null)
|
||||
[ ${PORTNUM} -eq 0 ] && continue
|
||||
NVMEDRIVES=$((NVMEDRIVES + PORTNUM))
|
||||
done
|
||||
fi
|
||||
|
||||
# USB Disks
|
||||
USBDRIVES=0
|
||||
if [ $(ls -l /sys/class/scsi_host 2>/dev/null | grep usb | wc -l) -gt 0 ]; then
|
||||
for PCI in $(lspci -d ::c03 2>/dev/null | awk '{print $1}'); do
|
||||
PORT=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n 2>/dev/null)
|
||||
PORTNUM=$(lsscsi -b | grep -v - | grep "\[${PORT}:" | wc -l)
|
||||
[ ${PORTNUM} -eq 0 ] && continue
|
||||
USBDRIVES=$((USBDRIVES + PORTNUM))
|
||||
done
|
||||
fi
|
||||
|
||||
# MMC Disks
|
||||
MMCDRIVES=0
|
||||
if [ $(ls -l /sys/block/mmc* 2>/dev/null | wc -l) -gt 0 ]; then
|
||||
for PCI in $(lspci -d ::805 | awk '{print $1}'); do
|
||||
PORTNUM=$(ls -l /sys/block/mmc* | grep "${PCI}" | wc -l 2>/dev/null)
|
||||
[ ${PORTNUM} -eq 0 ] && continue
|
||||
MMCDRIVES=$((MMCDRIVES + PORTNUM))
|
||||
done
|
||||
fi
|
||||
|
||||
# Disk Count for MaxDisks
|
||||
DRIVES=$((${SATADRIVES} + ${SASDRIVES} + ${SCSIDRIVES} + ${RAIDDRIVES} + ${USBDRIVES} + ${MMCDRIVES} + ${NVMEDRIVES}))
|
||||
HARDDRIVES=$((${SATADRIVES} + ${SASDRIVES} + ${SCSIDRIVES} + ${RAIDDRIVES} + ${NVMEDRIVES}))
|
||||
writeConfigKey "device.satadrives" "${SATADRIVES}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "device.sasdrives" "${SASDRIVES}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "device.scsidrives" "${SCSIDRIVES}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "device.raiddrives" "${RAIDDRIVES}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "device.usbdrives" "${USBDRIVES}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "device.mmcdrives" "${MMCDRIVES}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "device.nvmedrives" "${NVMEDRIVES}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "device.drives" "${DRIVES}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "device.harddrives" "${HARDDRIVES}" "${USER_CONFIG_FILE}"
|
||||
|
||||
# Check for Sata Boot
|
||||
if [ $(lspci -d ::106 2>/dev/null | wc -l) -gt 0 ]; then
|
||||
LASTDRIVE=0
|
||||
while read -r D; do
|
||||
if [ "${BUS}" = "sata" ] && [ "${MACHINE}" != "Native" ] && [ ${D} -eq 0 ]; then
|
||||
MAXDISKS=${DRIVES}
|
||||
echo -n "${D}>${MAXDISKS}:" >>"${TMP_PATH}/remap"
|
||||
elif [ ${D} -ne ${LASTDRIVE} ]; then
|
||||
echo -n "${D}>${LASTDRIVE}:" >>"${TMP_PATH}/remap"
|
||||
LASTDRIVE=$((LASTDRIVE + 1))
|
||||
else
|
||||
LASTDRIVE=$((D + 1))
|
||||
fi
|
||||
done < "${TMP_PATH}/ports"
|
||||
fi
|
||||
}
|
||||
|
||||
function getmapSelection() {
|
||||
# Compute PortMap Options
|
||||
SATAPORTMAPMAX=$(awk '{print $1}' "${TMP_PATH}/drivesmax")
|
||||
SATAPORTMAP=$(awk '{print $1}' "${TMP_PATH}/drivescon")
|
||||
SATAREMAP=$(awk '{print $1}' "${TMP_PATH}/remap" | sed 's/.$//')
|
||||
EXTERNALCONTROLLER=$(readConfigKey "device.externalcontroller" "${USER_CONFIG_FILE}")
|
||||
ARCMODE=$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")
|
||||
|
||||
if [ "${ARCMODE}" = "config" ]; then
|
||||
# Show recommended Option to user
|
||||
if [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" = "true" ] && [ "${MACHINE}" = "Native" ]; then
|
||||
REMAP2="*"
|
||||
elif [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" = "false" ]; then
|
||||
REMAP3="*"
|
||||
else
|
||||
REMAP1="*"
|
||||
fi
|
||||
show_and_set_remap
|
||||
else
|
||||
# Show recommended Option to user
|
||||
if [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" = "true" ] && [ "${MACHINE}" = "Native" ]; then
|
||||
writeConfigKey "arc.remap" "maxports" "${USER_CONFIG_FILE}"
|
||||
elif [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" = "false" ]; then
|
||||
writeConfigKey "arc.remap" "remap" "${USER_CONFIG_FILE}"
|
||||
else
|
||||
writeConfigKey "arc.remap" "acports" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
fi
|
||||
# Check Remap for correct config
|
||||
REMAP="$(readConfigKey "arc.remap" "${USER_CONFIG_FILE}")"
|
||||
deleteConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}"
|
||||
deleteConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}"
|
||||
deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}"
|
||||
deleteConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}"
|
||||
|
||||
case "${REMAP}" in
|
||||
"acports")
|
||||
writeConfigKey "cmdline.SataPortMap" "${SATAPORTMAP}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "cmdline.DiskIdxMap" "${DISKIDXMAP}" "${USER_CONFIG_FILE}"
|
||||
;;
|
||||
"maxports")
|
||||
writeConfigKey "cmdline.SataPortMap" "${SATAPORTMAPMAX}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "cmdline.DiskIdxMap" "${DISKIDXMAPMAX}" "${USER_CONFIG_FILE}"
|
||||
;;
|
||||
"remap")
|
||||
writeConfigKey "cmdline.sata_remap" "${SATAREMAP}" "${USER_CONFIG_FILE}"
|
||||
;;
|
||||
"ahci")
|
||||
writeConfigKey "cmdline.ahci_remap" "${SATAREMAP}" "${USER_CONFIG_FILE}"
|
||||
;;
|
||||
esac
|
||||
return
|
||||
}
|
||||
|
||||
# Check for Controller // 104=RAID // 106=SATA // 107=SAS // 100=SCSI // c03=USB
|
||||
declare -A controllers=(
|
||||
[satacontroller]=106
|
||||
[sascontroller]=107
|
||||
[scsicontroller]=100
|
||||
[raidcontroller]=104
|
||||
)
|
||||
|
||||
external_controller=false
|
||||
|
||||
for controller in "${!controllers[@]}"; do
|
||||
count=$(lspci -d ::${controllers[$controller]} 2>/dev/null | wc -l)
|
||||
writeConfigKey "device.${controller}" "${count}" "${USER_CONFIG_FILE}"
|
||||
if [ "${controller}" != "satacontroller" ] && [ ${count} -gt 0 ]; then
|
||||
external_controller=true
|
||||
fi
|
||||
done
|
||||
|
||||
writeConfigKey "device.externalcontroller" "${external_controller}" "${USER_CONFIG_FILE}"
|
||||
@@ -2,66 +2,66 @@
|
||||
# Update Loader
|
||||
function updateLoader() {
|
||||
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
|
||||
local ARC_BRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
|
||||
local ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
local ARCCONF="$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")"
|
||||
local TAG="${1}"
|
||||
[ -n "${ARCCONF}" ] && cp -f "${S_FILE}" "${TMP_PATH}/bak.yml"
|
||||
if [ -z "${TAG}" ]; then
|
||||
idx=0
|
||||
while [ ${idx} -le 5 ]; do # Loop 5 times, if successful, break
|
||||
if [ "${ARC_BRANCH}" = "dev" ]; then
|
||||
local TAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | grep "dev" | sort -rV | head -1)"
|
||||
else
|
||||
local TAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | grep -v "dev" | sort -rV | head -1)"
|
||||
fi
|
||||
if [ -n "${TAG}" ]; then
|
||||
break
|
||||
fi
|
||||
sleep 3
|
||||
idx=$((${idx} + 1))
|
||||
done
|
||||
fi
|
||||
if [ -n "${TAG}" ]; then
|
||||
export URL="https://github.com/AuxXxilium/arc/releases/download/${TAG}/update-${TAG}-${ARC_BRANCH}.zip"
|
||||
export TAG="${TAG}"
|
||||
{
|
||||
{
|
||||
curl -kL "${URL}" -o ${TMP_PATH}/update.zip 2>&3 3>&-
|
||||
} 3>&1 >&4 4>&- |
|
||||
perl -C -lane '
|
||||
BEGIN {$header = "Downloading $ENV{URL}...\n\n"; $| = 1}
|
||||
$pcent = $F[0];
|
||||
$_ = join "", unpack("x3 a7 x4 a9 x8 a9 x7 a*") if length > 20;
|
||||
s/ /\xa0/g; # replacing space with nbsp as dialog squashes spaces
|
||||
if ($. <= 3) {
|
||||
$header .= "$_\n";
|
||||
$/ = "\r" if $. == 2
|
||||
} else {
|
||||
print "XXX\n$pcent\n$header$_\nXXX"
|
||||
}' 4>&- |
|
||||
dialog --gauge "Download Update: ${TAG}..." 14 72 4>&-
|
||||
} 4>&1
|
||||
if [ -f "${TMP_PATH}/update.zip" ] && [ $(ls -s "${TMP_PATH}/update.zip" | cut -d' ' -f1) -gt 300000 ]; then
|
||||
HASHURL="https://github.com/AuxXxilium/arc/releases/download/${TAG}/update-${TAG}-${ARC_BRANCH}.hash"
|
||||
HASH="$(curl -skL "${HASHURL}" | awk '{print $1}')"
|
||||
if [ "${HASH}" != "$(sha256sum "${TMP_PATH}/update.zip" | awk '{print $1}')" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Update Loader" --aspect 18 \
|
||||
--infobox "Update failed - Hash mismatch!\nTry again later." 0 0
|
||||
if [ "${TAG}" != "zip" ]; then
|
||||
if [ -z "${TAG}" ]; then
|
||||
idx=0
|
||||
while [ ${idx} -le 5 ]; do # Loop 5 times, if successful, break
|
||||
if [ "${ARC_BRANCH}" = "dev" ]; then
|
||||
TAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | grep "dev" | sort -rV | head -1)"
|
||||
else
|
||||
TAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | grep -v "dev" | sort -rV | head -1)"
|
||||
fi
|
||||
if [ -n "${TAG}" ]; then
|
||||
break
|
||||
fi
|
||||
sleep 3
|
||||
exec reboot
|
||||
else
|
||||
rm -rf "/mnt/update"
|
||||
mkdir -p "${TMP_PATH}/update"
|
||||
dialog --backtitle "$(backtitle)" --title "Update Loader" \
|
||||
--infobox "Updating Loader..." 3 50
|
||||
if unzip -oq "${TMP_PATH}/update.zip" -d "${TMP_PATH}/update"; then
|
||||
cp -rf "${TMP_PATH}/update"/* "/mnt"
|
||||
rm -rf "${TMP_PATH}/update"
|
||||
rm -f "${TMP_PATH}/update.zip"
|
||||
idx=$((${idx} + 1))
|
||||
done
|
||||
fi
|
||||
if [ -n "${TAG}" ]; then
|
||||
export URL="https://github.com/AuxXxilium/arc/releases/download/${TAG}/update-${TAG}-${ARC_BRANCH}.zip"
|
||||
export TAG="${TAG}"
|
||||
{
|
||||
{
|
||||
curl -kL "${URL}" -o ${TMP_PATH}/update.zip 2>&3 3>&-
|
||||
} 3>&1 >&4 4>&- |
|
||||
perl -C -lane '
|
||||
BEGIN {$header = "Downloading $ENV{URL}...\n\n"; $| = 1}
|
||||
$pcent = $F[0];
|
||||
$_ = join "", unpack("x3 a7 x4 a9 x8 a9 x7 a*") if length > 20;
|
||||
s/ /\xa0/g; # replacing space with nbsp as dialog squashes spaces
|
||||
if ($. <= 3) {
|
||||
$header .= "$_\n";
|
||||
$/ = "\r" if $. == 2
|
||||
} else {
|
||||
print "XXX\n$pcent\n$header$_\nXXX"
|
||||
}' 4>&- |
|
||||
dialog --gauge "Download Update: ${TAG}..." 14 72 4>&-
|
||||
} 4>&1
|
||||
fi
|
||||
if [ -f "${TMP_PATH}/update.zip" ] && [ $(ls -s "${TMP_PATH}/update.zip" | cut -d' ' -f1) -gt 300000 ]; then
|
||||
if [ "${TAG}" != "zip" ]; then
|
||||
HASHURL="https://github.com/AuxXxilium/arc/releases/download/${TAG}/update-${TAG}-${ARC_BRANCH}.hash"
|
||||
HASH="$(curl -skL "${HASHURL}" | awk '{print $1}')"
|
||||
if [ "${HASH}" != "$(sha256sum "${TMP_PATH}/update.zip" | awk '{print $1}')" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Update Loader" --aspect 18 \
|
||||
--infobox "Update failed - Hash mismatch!\nTry again later." 0 0
|
||||
sleep 3
|
||||
exec reboot
|
||||
fi
|
||||
fi
|
||||
if [ "$(cat "${PART1_PATH}/ARC-VERSION")" = "${TAG}" ]; then
|
||||
rm -rf "/mnt/update"
|
||||
mkdir -p "${TMP_PATH}/update"
|
||||
dialog --backtitle "$(backtitle)" --title "Update Loader" \
|
||||
--infobox "Updating Loader..." 3 50
|
||||
if unzip -oq "${TMP_PATH}/update.zip" -d "${TMP_PATH}/update"; then
|
||||
cp -rf "${TMP_PATH}/update"/* "/mnt"
|
||||
rm -rf "${TMP_PATH}/update"
|
||||
rm -f "${TMP_PATH}/update.zip"
|
||||
fi
|
||||
if [ "$(cat "${PART1_PATH}/ARC-VERSION")" = "${TAG}" ] || [ "${TAG}" = "zip" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Update Loader" \
|
||||
--infobox "Update Loader successful!" 3 50
|
||||
sleep 2
|
||||
|
||||
@@ -8,6 +8,7 @@ set -e
|
||||
# Get Loader Disk Bus
|
||||
[ -z "${LOADER_DISK}" ] && die "Loader Disk not found!"
|
||||
checkBootLoader || die "The loader is corrupted, please rewrite it!"
|
||||
arc_mode || die "No bootmode found!"
|
||||
|
||||
[ -f "${HOME}/.initialized" ] && exec arc.sh || true
|
||||
[ -f "${USER_CONFIG_FILE}" ] && sed -i "s/'/\"/g" "${USER_CONFIG_FILE}" >/dev/null 2>&1 || true
|
||||
@@ -20,15 +21,14 @@ clear
|
||||
COLUMNS=${COLUMNS:-50}
|
||||
BANNER="$(figlet -c -w "$(((${COLUMNS})))" "Arc Loader")"
|
||||
TITLE="Version:"
|
||||
TITLE+=" ${ARC_VERSION} (${ARC_BUILD})"
|
||||
[ -n "${ARC_BRANCH}" ] && TITLE+=" | Branch: ${ARC_BRANCH}"
|
||||
TITLE+=" ${ARC_VERSION} (${ARC_BUILD}) | Branch: ${ARC_BRANCH}"
|
||||
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}"
|
||||
printf "\033[1;34m%*s\033[0m\n" $(((${#TITLE} + ${COLUMNS}) / 2)) "${TITLE}"
|
||||
TITLE="Boot:"
|
||||
[ ${EFI} -eq 1 ] && TITLE+=" [UEFI]" || TITLE+=" [BIOS]"
|
||||
TITLE+=" [${BUS}]"
|
||||
TITLE+=" | Device: [${BUS}] | Mode: [${ARCMODE}]"
|
||||
printf "\033[1;34m%*s\033[0m\n" $(((${#TITLE} + ${COLUMNS}) / 2)) "${TITLE}"
|
||||
|
||||
# Check for Config File
|
||||
@@ -84,45 +84,35 @@ initConfigKey "synoinfo" "{}" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "time" "{}" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "usbmount" "false" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "zimage-hash" "" "${USER_CONFIG_FILE}"
|
||||
if grep -q "automated_arc" /proc/cmdline; then
|
||||
writeConfigKey "arc.mode" "automated" "${USER_CONFIG_FILE}"
|
||||
elif grep -q "update_arc" /proc/cmdline; then
|
||||
writeConfigKey "arc.mode" "update" "${USER_CONFIG_FILE}"
|
||||
elif grep -q "force_arc" /proc/cmdline; then
|
||||
writeConfigKey "arc.mode" "config" "${USER_CONFIG_FILE}"
|
||||
else
|
||||
writeConfigKey "arc.mode" "dsm" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
[ -f "${PART3_PATH}/automated" ] && rm -f "${PART3_PATH}/automated" >/dev/null 2>&1 || true
|
||||
if [ -n "${ARC_BRANCH}" ]; then
|
||||
writeConfigKey "arc.branch" "${ARC_BRANCH}" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
|
||||
# Sort network interfaces
|
||||
if arrayExistItem "sortnetif:" $(readConfigMap "addons" "${USER_CONFIG_FILE}"); then
|
||||
echo -e "Sorting NIC: \033[1;34mactive\033[0m"
|
||||
_sort_netif "$(readConfigKey "addons.sortnetif" "${USER_CONFIG_FILE}")"
|
||||
echo
|
||||
fi
|
||||
# Read/Write IP/Mac to config
|
||||
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true
|
||||
for N in ${ETHX}; do
|
||||
MACR="$(cat /sys/class/net/${N}/address 2>/dev/null | sed 's/://g' | tr '[:upper:]' '[:lower:]')"
|
||||
IPR="$(readConfigKey "network.${MACR}" "${USER_CONFIG_FILE}")"
|
||||
if [ -n "${IPR}" ] && [ "1" = "$(cat /sys/class/net/${N}/carrier 2>/dev/null)" ]; then
|
||||
IFS='/' read -r -a IPRA <<<"${IPR}"
|
||||
ip addr flush dev "${N}"
|
||||
ip addr add "${IPRA[0]}/${IPRA[1]:-"255.255.255.0"}" dev "${N}"
|
||||
if [ -n "${IPRA[2]}" ]; then
|
||||
ip route add default via "${IPRA[2]}" dev "${N}"
|
||||
fi
|
||||
if [ -n "${IPRA[3]:-${IPRA[2]}}" ]; then
|
||||
sed -i "/nameserver ${IPRA[3]:-${IPRA[2]}}/d" /etc/resolv.conf
|
||||
echo "nameserver ${IPRA[3]:-${IPRA[2]}}" >>/etc/resolv.conf
|
||||
fi
|
||||
sleep 1
|
||||
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth)
|
||||
for N in ${ETHX}; do
|
||||
MACR="$(cat /sys/class/net/${N}/address 2>/dev/null | sed 's/://g' | tr '[:upper:]' '[:lower:]')"
|
||||
IPR="$(readConfigKey "network.${MACR}" "${USER_CONFIG_FILE}")"
|
||||
if [ -n "${IPR}" ] && [ "1" = "$(cat /sys/class/net/${N}/carrier 2>/dev/null)" ]; then
|
||||
IFS='/' read -r -a IPRA <<<"${IPR}"
|
||||
ip addr flush dev "${N}"
|
||||
ip addr add "${IPRA[0]}/${IPRA[1]:-"255.255.255.0"}" dev "${N}"
|
||||
if [ -n "${IPRA[2]}" ]; then
|
||||
ip route add default via "${IPRA[2]}" dev "${N}"
|
||||
fi
|
||||
[ "${N::3}" = "eth" ] && ethtool -s "${N}" wol g 2>/dev/null || true
|
||||
# [ "${N::3}" = "eth" ] && ethtool -K ${N} rxhash off 2>/dev/null || true
|
||||
initConfigKey "${N}" "${MACR}" "${USER_CONFIG_FILE}"
|
||||
done
|
||||
if [ -n "${IPRA[3]:-${IPRA[2]}}" ]; then
|
||||
sed -i "/nameserver ${IPRA[3]:-${IPRA[2]}}/d" /etc/resolv.conf
|
||||
echo "nameserver ${IPRA[3]:-${IPRA[2]}}" >>/etc/resolv.conf
|
||||
fi
|
||||
sleep 1
|
||||
fi
|
||||
[ "${N::3}" = "eth" ] && ethtool -s "${N}" wol g 2>/dev/null || true
|
||||
# [ "${N::3}" = "eth" ] && ethtool -K ${N} rxhash off 2>/dev/null || true
|
||||
initConfigKey "${N}" "${MACR}" "${USER_CONFIG_FILE}"
|
||||
done
|
||||
ETHN=$(echo ${ETHX} | wc -w)
|
||||
writeConfigKey "device.nic" "${ETHN}" "${USER_CONFIG_FILE}"
|
||||
# No network devices
|
||||
@@ -152,7 +142,6 @@ writeConfigKey "pid" "${PID}" "${USER_CONFIG_FILE}"
|
||||
|
||||
# Decide if boot automatically
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
if [ "${ARCMODE}" = "config" ]; then
|
||||
echo -e "\033[1;34mStarting Config Mode...\033[0m"
|
||||
elif [ "${ARCMODE}" = "automated" ]; then
|
||||
@@ -169,42 +158,13 @@ echo
|
||||
|
||||
BOOTIPWAIT="$(readConfigKey "bootipwait" "${USER_CONFIG_FILE}")"
|
||||
[ -z "${BOOTIPWAIT}" ] && BOOTIPWAIT=30
|
||||
echo
|
||||
echo -e "\033[1;37mDetected ${ETHN} NIC:\033[0m"
|
||||
IPCON=""
|
||||
echo
|
||||
[ ! -f /var/run/dhcpcd/pid ] && /etc/init.d/S41dhcpcd restart >/dev/null 2>&1 || true
|
||||
[ ! -f /var/run/dhcpcd/pid ] && /etc/init.d/S09dhcpcd restart >/dev/null 2>&1 || true
|
||||
sleep 3
|
||||
for N in ${ETHX}; do
|
||||
COUNT=0
|
||||
DRIVER=$(ls -ld /sys/class/net/${N}/device/driver 2>/dev/null | awk -F '/' '{print $NF}')
|
||||
while true; do
|
||||
if [ "0" = "$(cat /sys/class/net/${N}/carrier 2>/dev/null)" ]; then
|
||||
echo -e "\r${DRIVER}: \033[1;37mNOT CONNECTED\033[0m"
|
||||
break
|
||||
fi
|
||||
COUNT=$((COUNT + 1))
|
||||
IP="$(getIP "${N}")"
|
||||
if [ -n "${IP}" ]; then
|
||||
SPEED=$(ethtool ${N} 2>/dev/null | grep "Speed:" | awk '{print $2}')
|
||||
if [[ "${IP}" =~ ^169\.254\..* ]]; then
|
||||
echo -e "\r${DRIVER} (${SPEED}): \033[1;37mLINK LOCAL (No DHCP server found.)\033[0m"
|
||||
else
|
||||
echo -e "\r${DRIVER} (${SPEED}): \033[1;37m${IP}\033[0m"
|
||||
[ -z "${IPCON}" ] && IPCON="${IP}"
|
||||
fi
|
||||
break
|
||||
fi
|
||||
if [ -z "$(cat /sys/class/net/${N}}/carrier 2>/dev/null)" ]; then
|
||||
echo -e "\r${DRIVER}: \033[1;37mDOWN\033[0m"
|
||||
break
|
||||
fi
|
||||
if [ ${COUNT} -ge ${BOOTIPWAIT} ]; then
|
||||
echo -e "\r${DRIVER}: \033[1;37mTIMEOUT\033[0m"
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
done
|
||||
checkNIC
|
||||
echo
|
||||
|
||||
mkdir -p "${ADDONS_PATH}"
|
||||
|
||||
@@ -66,7 +66,7 @@ fi
|
||||
echo "Copying files"
|
||||
sudo cp -rf "files/p1/"* "/tmp/p1"
|
||||
sudo cp -rf "files/p3/"* "/tmp/p3"
|
||||
sync
|
||||
sudo sync
|
||||
|
||||
echo "Unmount image file"
|
||||
sudo umount "/tmp/p1"
|
||||
|
||||
@@ -29,7 +29,7 @@ done
|
||||
popd
|
||||
|
||||
rm -f grub.img
|
||||
dd if=/dev/zero of=grub.img bs=1M seek=2048 count=0
|
||||
dd if=/dev/zero of=grub.img bs=1M seek=1000 count=0
|
||||
echo -e "n\np\n1\n\n+50M\nn\np\n2\n\n+50M\nn\np\n3\n\n\na\n1\nw\nq\n" | fdisk grub.img
|
||||
fdisk -l grub.img
|
||||
|
||||
|
||||
Reference in New Issue
Block a user