Compare commits
46 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3234b12c2d | ||
|
|
8e3536d378 | ||
|
|
86b251720a | ||
|
|
ab1b0eea48 | ||
|
|
a9df9c5ae1 | ||
|
|
1a1f4d60ff | ||
|
|
5572fe4c20 | ||
|
|
35807229f6 | ||
|
|
1ad608e796 | ||
|
|
22a085139d | ||
|
|
0a3a20fd25 | ||
|
|
03146d086f | ||
|
|
f5edc7fc20 | ||
|
|
c0284549e3 | ||
|
|
22f135f767 | ||
|
|
e8f602208d | ||
|
|
8783f47728 | ||
|
|
2efba63485 | ||
|
|
c917852ea8 | ||
|
|
87b1e66d36 | ||
|
|
8c0af13399 | ||
|
|
41f249c238 | ||
|
|
5984b417fe | ||
|
|
4ae032421b | ||
|
|
db9dc3ded6 | ||
|
|
62735b0e3e | ||
|
|
c442175cfb | ||
|
|
6f8bd7034c | ||
|
|
28df568d8c | ||
|
|
e7688433ef | ||
|
|
6e97b59bf1 | ||
|
|
0dabe40200 | ||
|
|
b61222c0d5 | ||
|
|
b1737e1a0e | ||
|
|
b4874b6e77 | ||
|
|
1ea4215393 | ||
|
|
95c7032602 | ||
|
|
2877465fb4 | ||
|
|
bd156aff6e | ||
|
|
7746eb3ca7 | ||
|
|
c4a6d4ccd3 | ||
|
|
5310500b1a | ||
|
|
b89c67f115 | ||
|
|
5b7e4e68cc | ||
|
|
ac5d39ec71 | ||
|
|
23142cefb5 |
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@@ -75,7 +75,7 @@ jobs:
|
||||
# Get extractor, LKM, Addons, Modules, Theme and Configs
|
||||
- name: Get Dependencies for all Image
|
||||
run: |
|
||||
. scripts/func.sh "${{ secrets.BUILD_TOKEN }}"
|
||||
. scripts/functions.sh "${{ secrets.BUILD_TOKEN }}"
|
||||
|
||||
echo "Get Dependencies"
|
||||
getAddons "files/p3/addons"
|
||||
@@ -104,7 +104,7 @@ jobs:
|
||||
# Build incremental
|
||||
- name: Build Image
|
||||
run: |
|
||||
. scripts/func.sh
|
||||
. scripts/functions.sh
|
||||
|
||||
# Modify Source File
|
||||
ARC_BUILD="$(date +'%y%m%d')"
|
||||
|
||||
3
.github/workflows/custom.yml
vendored
3
.github/workflows/custom.yml
vendored
@@ -93,7 +93,7 @@ jobs:
|
||||
# Build incremental
|
||||
- name: Build image
|
||||
run: |
|
||||
. scripts/func.sh
|
||||
. scripts/functions.sh
|
||||
|
||||
function writeConfigKey() {
|
||||
[ "${2}" = "{}" ] && sudo yq eval '.'${1}' = {}' --inplace "${3}" 2>/dev/null || sudo yq eval '.'${1}' = "'"${2}"'"' --inplace "${3}" 2>/dev/null
|
||||
@@ -138,7 +138,6 @@ jobs:
|
||||
writeConfigKey "addons.\"${A}\"" "${VALUE}" "${PRESET_CONFIG_FILE}"
|
||||
done
|
||||
fi
|
||||
writeConfigKey "automated" "true" "${PRESET_CONFIG_FILE}"
|
||||
echo "$(cat "${PRESET_CONFIG_FILE}")"
|
||||
sudo echo "arc-${MODEL}-${PRODUCTVER:0:3}-${TAG}" >"/tmp/automated"
|
||||
sudo mv -f "/tmp/automated" "/tmp/p3/automated"
|
||||
|
||||
51
.github/workflows/data.yml
vendored
51
.github/workflows/data.yml
vendored
@@ -34,43 +34,66 @@ jobs:
|
||||
sudo timedatectl set-timezone "Europe/Berlin"
|
||||
|
||||
sudo apt update
|
||||
sudo apt install -y build-essential libtool pkgconf libzstd-dev liblzma-dev libssl-dev # kmodule dependencies
|
||||
sudo apt install -y build-essential libtool pkgconf libzstd-dev liblzma-dev libssl-dev busybox dialog curl xz-utils cpio sed qemu-utils
|
||||
|
||||
- name: Get Release Data for Arc
|
||||
YQ=$(command -v yq)
|
||||
if [ -z "${YQ}" ] || ! ${YQ} --version 2>/dev/null | grep -q "v4."; then
|
||||
wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O "${YQ:-"/usr/bin/yq"}" && chmod +x "${YQ:-"/usr/bin/yq"}"
|
||||
fi
|
||||
|
||||
- name: Get Addon Data for Arc
|
||||
run: |
|
||||
REPO="${{ github.server_url }}/${{ github.repository }}"
|
||||
REPO="https://github.com/AuxXxilium/arc-addons"
|
||||
PRERELEASE="true"
|
||||
|
||||
TAG=""
|
||||
if [ "${PRERELEASE}" = "true" ]; then
|
||||
TAG="$(curl -skL --connect-timeout 10 "${REPO}/tags" | grep /refs/tags/.*\.zip | sed -E 's/.*\/refs\/tags\/(.*)\.zip.*$/\1/' | sort -rV | head -1)"
|
||||
TAG="$(curl -skL --connect-timeout 10 "${REPO}/tags" | grep /refs/tags/.*\.zip | sed -r 's/.*\/refs\/tags\/(.*)\.zip.*$/\1/' | sort -rV | head -1)"
|
||||
else
|
||||
LATESTURL="$(curl -skL --connect-timeout 10 -w %{url_effective} -o /dev/null "${REPO}/releases/latest")"
|
||||
TAG="${LATESTURL##*/}"
|
||||
fi
|
||||
[ "${TAG:0:1}" = "v" ] && TAG="${TAG:1}"
|
||||
rm -f arc-${TAG}.img.zip
|
||||
STATUS=$(curl -kL --connect-timeout 10 -w "%{http_code}" "${REPO}/releases/download/${TAG}/arc-${TAG}.img.zip" -o "arc-${TAG}.img.zip")
|
||||
rm -f addons.zip
|
||||
STATUS=$(curl -kL --connect-timeout 10 -w "%{http_code}" "${REPO}/releases/download/${TAG}/addons-${TAG}.zip" -o "addons.zip")
|
||||
if [ $? -ne 0 -o ${STATUS:-0} -ne 200 ]; then
|
||||
echo "Download failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
unzip arc-${TAG}.img.zip -d "arc"
|
||||
mkdir -p "mnt/p3/addons"
|
||||
unzip addons.zip -d "mnt/p3/addons"
|
||||
for i in $(find "mnt/p3/addons" -type f -name "*.addon"); do
|
||||
if [ -f "${i}" ]; then
|
||||
mkdir -p "mnt/p3/addons/$(basename "${i}" .addon)"
|
||||
tar -xaf "${i}" -C "mnt/p3/addons/$(basename "${i}" .addon)"
|
||||
fi
|
||||
done
|
||||
rm -f addons.zip
|
||||
|
||||
sudo ./localbuild.sh create arc/ws arc/arc.img
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "create failed"
|
||||
- name: Get Config Data for Arc
|
||||
run: |
|
||||
REPO="https://github.com/AuxXxilium/arc-configs"
|
||||
LATESTURL="$(curl -skL --connect-timeout 10 -w %{url_effective} -o /dev/null "${REPO}/releases/latest")"
|
||||
TAG="${LATESTURL##*/}"
|
||||
[ "${TAG:0:1}" = "v" ] && TAG="${TAG:1}"
|
||||
rm -f configs.zip
|
||||
STATUS=$(curl -kL --connect-timeout 10 -w "%{http_code}" "${REPO}/releases/download/${TAG}/configs-${TAG}.zip" -o "configs.zip")
|
||||
if [ $? -ne 0 -o ${STATUS:-0} -ne 200 ]; then
|
||||
echo "Download failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "mnt/p3/configs"
|
||||
unzip configs.zip -d "mnt/p3/configs"
|
||||
rm -f configs.zip
|
||||
|
||||
- name: Get data
|
||||
run: |
|
||||
pip install -r scripts/requirements.txt
|
||||
python scripts/func.py getmodels -w "arc/ws" -j "docs/models.json"
|
||||
python scripts/func.py getaddons -w "arc/ws" -j "docs/addons.json"
|
||||
python scripts/func.py getmodules -w "arc/ws" -j "docs/modules.json"
|
||||
python scripts/func.py getpats -w "arc/ws" -j "docs/pats.json"
|
||||
python scripts/functions.py getmodels -w "." -j "docs/models.json"
|
||||
python scripts/functions.py getaddons -w "." -j "docs/addons.json"
|
||||
python scripts/functions.py getpats -w "." -j "docs/pats.json"
|
||||
|
||||
- name: Upload to Artifacts
|
||||
if: success()
|
||||
|
||||
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
|
||||
|
||||
@@ -124,6 +124,7 @@ function arcModel() {
|
||||
writeConfigKey "smallnum" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "sn" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "zimage-hash" "" "${USER_CONFIG_FILE}"
|
||||
rm -f "${ORI_ZIMAGE_FILE}" "${ORI_RDGZ_FILE}" "${MOD_ZIMAGE_FILE}" "${MOD_RDGZ_FILE}" >/dev/null 2>&1 || true
|
||||
fi
|
||||
PLATFORM="$(grep -w "${MODEL}" "${TMP_PATH}/modellist" | awk '{print $2}' | head -1)"
|
||||
writeConfigKey "platform" "${PLATFORM}" "${USER_CONFIG_FILE}"
|
||||
@@ -172,6 +173,7 @@ function arcVersion() {
|
||||
writeConfigKey "ramdisk-hash" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "smallnum" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "zimage-hash" "" "${USER_CONFIG_FILE}"
|
||||
rm -f "${ORI_ZIMAGE_FILE}" "${ORI_RDGZ_FILE}" "${MOD_ZIMAGE_FILE}" "${MOD_RDGZ_FILE}" >/dev/null 2>&1 || true
|
||||
fi
|
||||
dialog --backtitle "$(backtitle)" --title "Version" \
|
||||
--infobox "Reading DSM Build..." 3 25
|
||||
@@ -267,7 +269,7 @@ function arcVersion() {
|
||||
if [ ${NVMEDRIVES} -gt 0 ]; then
|
||||
if [ "${PLATFORM}" = "epyc7002" ] && [ ${SATADRIVES} -eq 0 ] && [ ${SASDRIVES} -eq 0 ]; then
|
||||
initConfigKey "addons.nvmesystem" "" "${USER_CONFIG_FILE}"
|
||||
elif [ "${DT}" = "true"]; then
|
||||
elif [ "${DT}" = "true" ]; then
|
||||
initConfigKey "addons.nvmevolume" "" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
fi
|
||||
@@ -680,231 +682,6 @@ function boot() {
|
||||
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
|
||||
if [ "${CONFDONE}" = "true" ]; then
|
||||
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
|
||||
fi
|
||||
|
||||
# Get Config/Build Status
|
||||
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# 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"
|
||||
|
||||
if [ "${CONFDONE}" = "true" ]; then
|
||||
if [ "${BOOTOPTS}" = "true" ]; then
|
||||
write_menu "6" "\Z1Hide Boot Options\Zn"
|
||||
write_menu_with_color "m" "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}"
|
||||
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}"
|
||||
else
|
||||
write_menu "6" "\Z1Show Boot Options\Zn"
|
||||
fi
|
||||
|
||||
if [ "${DSMOPTS}" = "true" ]; then
|
||||
write_menu "7" "\Z1Hide DSM Options\Zn"
|
||||
write_menu "=" "\Z4===== DSM =====\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
|
||||
|
||||
if [ "${LOADEROPTS}" = "true" ]; then
|
||||
write_menu "8" "\Z1Hide Loader Options\Zn"
|
||||
write_menu "=" "\Z4===== Loader =====\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
|
||||
write_menu "8" "\Z1Show Loader Options\Zn"
|
||||
fi
|
||||
|
||||
dialog --clear --default-item ${NEXT} --backtitle "$(backtitle)" --title "Arc Config" --colors \
|
||||
--cancel-label "Exit" \
|
||||
--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
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
return
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Permits user edit the user config
|
||||
function editUserConfig() {
|
||||
@@ -1228,7 +1005,7 @@ function cmdlineMenu() {
|
||||
2>"${TMP_PATH}/resp"
|
||||
RET=$?
|
||||
case ${RET} in
|
||||
0) # ok-button
|
||||
0)
|
||||
NAME="$(sed -n '1p' "${TMP_PATH}/resp" 2>/dev/null)"
|
||||
VALUE="$(sed -n '2p' "${TMP_PATH}/resp" 2>/dev/null)"
|
||||
[[ "${NAME}" = *= ]] && NAME="${NAME%?}"
|
||||
@@ -1241,11 +1018,11 @@ function cmdlineMenu() {
|
||||
writeConfigKey "cmdline.\"${NAME//\"/}\"" "${VALUE}" "${USER_CONFIG_FILE}"
|
||||
break
|
||||
;;
|
||||
1) # cancel-button
|
||||
1)
|
||||
break
|
||||
;;
|
||||
255) # ESC
|
||||
# break
|
||||
255)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
@@ -1261,7 +1038,7 @@ function cmdlineMenu() {
|
||||
done < <(readConfigMap "cmdline" "${USER_CONFIG_FILE}")
|
||||
if [ ${#CMDLINE[@]} -eq 0 ]; then
|
||||
dialog --backtitle "$(backtitle)" --msgbox "No user cmdline to remove" 0 0
|
||||
continue
|
||||
break
|
||||
fi
|
||||
ITEMS=""
|
||||
for I in "${!CMDLINE[@]}"; do
|
||||
@@ -1602,21 +1379,24 @@ function backupMenu() {
|
||||
while true; do
|
||||
if [ -n "${USERID}" ] && [ "${ARCOFFLINE}" != "true" ] && [ "${CONFDONE}" = "true" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Backup" --cancel-label "Exit" --menu "Choose an Option" 0 0 0 \
|
||||
1 "Restore Arc Config from DSM" \
|
||||
2 "Restore Hardware Key from DSM" \
|
||||
3 "Restore Arc Config from Online" \
|
||||
4 "Backup Arc Config to Online" \
|
||||
1 "Restore Arc Config (from DSM)" \
|
||||
2 "Restore Hardware Key (local)" \
|
||||
3 "Backup Hardware Key (local)" \
|
||||
4 "Restore Arc Config (from Online)" \
|
||||
5 "Backup Arc Config (to Online)" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
elif [ -n "${USERID}" ] && [ "${ARCOFFLINE}" != "true" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Backup" --cancel-label "Exit" --menu "Choose an Option" 0 0 0 \
|
||||
1 "Restore Arc Config from DSM" \
|
||||
2 "Restore Hardware Key from DSM" \
|
||||
3 "Restore Arc Config from Online" \
|
||||
1 "Restore Arc Config (from DSM)" \
|
||||
2 "Restore Hardware Key (local)" \
|
||||
3 "Backup Hardware Key (local)" \
|
||||
4 "Restore Arc Config (from Online)" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
else
|
||||
dialog --backtitle "$(backtitle)" --title "Backup" --cancel-label "Exit" --menu "Choose an Option" 0 0 0 \
|
||||
1 "Restore Arc Config from DSM" \
|
||||
2 "Restore Hardware Key from DSM" \
|
||||
1 "Restore Arc Config (from DSM)" \
|
||||
2 "Restore Hardware Key (local)" \
|
||||
3 "Backup Hardware Key (local)" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
fi
|
||||
[ $? -ne 0 ] && break
|
||||
@@ -1676,33 +1456,40 @@ function backupMenu() {
|
||||
rm -f "${HOME}/.initialized" && exec init.sh
|
||||
;;
|
||||
2)
|
||||
DSMROOTS="$(findDSMRoot)"
|
||||
if [ -z "${DSMROOTS}" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Restore Encryption Key" \
|
||||
--msgbox "No DSM system partition(md0) found!\nPlease insert all disks before continuing." 0 0
|
||||
return
|
||||
fi
|
||||
mkdir -p "${TMP_PATH}/mdX"
|
||||
for I in ${DSMROOTS}; do
|
||||
# fixDSMRootPart "${I}"
|
||||
mount -t ext4 "${I}" "${TMP_PATH}/mdX"
|
||||
if [ -f "${TMP_PATH}/mdX/usr/arc/backup/p2/machine.key" ]; then
|
||||
cp -f "${TMP_PATH}/mdX/usr/arc/backup/p2/machine.key" "${PART2_PATH}/machine.key"
|
||||
dialog --backtitle "$(backtitle)" --title "Restore Encryption Key" --aspect 18 \
|
||||
--msgbox "Encryption Key restore successful!" 0 0
|
||||
break
|
||||
fi
|
||||
done
|
||||
umount "${TMP_PATH}/mdX"
|
||||
if [ -f "${PART2_PATH}/machine.key" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Restore Encryption Key" \
|
||||
--msgbox "Upload the machine.key file to ${PART3_PATH}/users\nand press OK after the upload is done." 0 0
|
||||
[ $? -ne 0 ] && return 1
|
||||
if [ -f "${PART3_PATH}/users/machine.key" ]; then
|
||||
mv -f "${PART3_PATH}/users/machine.key" "${PART2_PATH}/machine.key"
|
||||
dialog --backtitle "$(backtitle)" --title "Restore Encryption Key" --aspect 18 \
|
||||
--msgbox "Encryption Key restore successful!" 0 0
|
||||
else
|
||||
dialog --backtitle "$(backtitle)" --title "Restore Encryption Key" --aspect 18 \
|
||||
--msgbox "No Encryption Key found!" 0 0
|
||||
dialog --backtitle "$(backtitle)" --title "Restore Encryption Key" \
|
||||
--msgbox "File not found!" 0 0
|
||||
return 1
|
||||
fi
|
||||
return
|
||||
;;
|
||||
3)
|
||||
dialog --backtitle "$(backtitle)" --title "Backup Encryption Key" \
|
||||
--msgbox "To backup the Encryption Key press OK." 0 0
|
||||
[ $? -ne 0 ] && return 1
|
||||
|
||||
if [ -f "${PART2_PATH}/machine.key" ]; then
|
||||
cp -f "${PART2_PATH}/machine.key" "/var/www/data/machine.key"
|
||||
URL="http://${IPCON}${HTTPPORT:+:$HTTPPORT}/machine.key"
|
||||
MSG="Please use ${URL} to download the machine.key file."
|
||||
else
|
||||
MSG="File not found!"
|
||||
fi
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Backup Encryption Key" \
|
||||
--msgbox "${MSG}" 0 0
|
||||
if [ "${MSG}" = "File not found!" ]; then
|
||||
return 1
|
||||
fi
|
||||
return
|
||||
;;
|
||||
4)
|
||||
[ -f "${USER_CONFIG_FILE}" ] && mv -f "${USER_CONFIG_FILE}" "${USER_CONFIG_FILE}.bak"
|
||||
HWID="$(genHWID)"
|
||||
if curl -skL "https://arc.auxxxilium.tech?cdown=${HWID}" -o "${USER_CONFIG_FILE}" 2>/dev/null; then
|
||||
@@ -1734,14 +1521,16 @@ function backupMenu() {
|
||||
sleep 2
|
||||
rm -f "${HOME}/.initialized" && exec init.sh
|
||||
;;
|
||||
4)
|
||||
5)
|
||||
HWID="$(genHWID)"
|
||||
curl -sk -X POST -F "file=@${USER_CONFIG_FILE}" "https://arc.auxxxilium.tech?cup=${HWID}&userid=${USERID}" 2>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Online Backup" --msgbox "Online Backup successful!" 5 40
|
||||
else
|
||||
dialog --backtitle "$(backtitle)" --title "Online Backup" --msgbox "Online Backup failed!" 5 40
|
||||
return 1
|
||||
fi
|
||||
return
|
||||
;;
|
||||
*)
|
||||
break
|
||||
@@ -1767,11 +1556,12 @@ function updateMenu() {
|
||||
1)
|
||||
# Ask for Tag
|
||||
TAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | grep -v "dev" | sort -rV | head -1)"
|
||||
OLD="$(cat ${PART1_PATH}/ARC-VERSION)"
|
||||
OLD="${ARC_VERSION}"
|
||||
dialog --clear --backtitle "$(backtitle)" --title "Update Loader" \
|
||||
--menu "Current: ${OLD} -> Which Version?" 7 50 0 \
|
||||
1 "Latest ${TAG}" \
|
||||
2 "Select Version" \
|
||||
3 "Upload .zip File" \
|
||||
2>"${TMP_PATH}/opts"
|
||||
[ $? -ne 0 ] && break
|
||||
opts=$(cat ${TMP_PATH}/opts)
|
||||
@@ -1783,6 +1573,25 @@ function updateMenu() {
|
||||
2>"${TMP_PATH}/input"
|
||||
TAG=$(cat "${TMP_PATH}/input")
|
||||
[ -z "${TAG}" ] && return 1
|
||||
elif [ ${opts} -eq 3 ]; then
|
||||
mkdir -p "${PART3_PATH}/users"
|
||||
dialog --backtitle "$(backtitle)" --title "Update Loader" \
|
||||
--msgbox "Upload the update-*.zip File to ${PART3_PATH}/users\nand press OK after upload is done." 0 0
|
||||
[ $? -ne 0 ] && return 1
|
||||
UPDATEFOUND="false"
|
||||
for UPDATEFILE in "${PART3_PATH}/users/update-*.zip"; do
|
||||
if [ -e "${UPDATEFILE}" ]; then
|
||||
mv -f "${UPDATEFILE}" "${TMP_PATH}/update.zip"
|
||||
TAG="zip"
|
||||
UPDATEFOUND="true"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ "${UPDATEFOUND}" = "false" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Update Loader" \
|
||||
--msgbox "File not found!" 0 0
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
updateLoader "${TAG}"
|
||||
;;
|
||||
@@ -1796,7 +1605,7 @@ function updateMenu() {
|
||||
4)
|
||||
dialog --backtitle "$(backtitle)" --title "Switch Arc Branch" \
|
||||
--menu "Choose a Branch" 0 0 0 \
|
||||
1 "evolution - New Evolution System" \
|
||||
1 "evo - New Evolution System" \
|
||||
3 "dev - Development System" \
|
||||
2>"${TMP_PATH}/opts"
|
||||
[ $? -ne 0 ] && break
|
||||
@@ -2244,17 +2053,20 @@ function credits() {
|
||||
###############################################################################
|
||||
# Setting Static IP for Loader
|
||||
function staticIPMenu() {
|
||||
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth)
|
||||
ETHX="$(ls /sys/class/net/ 2>/dev/null | grep eth)"
|
||||
IPCON=""
|
||||
for N in ${ETHX}; do
|
||||
MACR="$(cat /sys/class/net/${N}/address 2>/dev/null | sed 's/://g')"
|
||||
IPR="$(readConfigKey "network.${MACR}" "${USER_CONFIG_FILE}")"
|
||||
IFS='/' read -r -a IPRA <<<"${IPR}"
|
||||
|
||||
MSG="Set ${N}(${MACR}) IP to: (Delete if empty)"
|
||||
while true; do
|
||||
IPR="$(readConfigKey "network.${MACR}" "${USER_CONFIG_FILE}")"
|
||||
IFS='/' read -r -a IPRA <<<"${IPR}"
|
||||
dialog --backtitle "$(backtitle)" --title "StaticIP" \
|
||||
--form "${MSG}" 10 60 4 "address" 1 1 "${IPRA[0]}" 1 9 36 16 "netmask" 2 1 "${IPRA[1]}" 2 9 36 16 "gateway" 3 1 "${IPRA[2]}" 3 9 36 16 "dns" 4 1 "${IPRA[3]}" 4 9 36 16 \
|
||||
--form "${MSG}" 10 60 4 \
|
||||
"address" 1 1 "${IPRA[0]}" 1 9 36 16 \
|
||||
"netmask" 2 1 "${IPRA[1]}" 2 9 36 16 \
|
||||
"gateway" 3 1 "${IPRA[2]}" 3 9 36 16 \
|
||||
"dns" 4 1 "${IPRA[3]}" 4 9 36 16 \
|
||||
2>"${TMP_PATH}/resp"
|
||||
RET=$?
|
||||
case ${RET} in
|
||||
@@ -2265,9 +2077,10 @@ function staticIPMenu() {
|
||||
dnsname="$(sed -n '4p' "${TMP_PATH}/resp" 2>/dev/null)"
|
||||
(
|
||||
if [ -z "${address}" ]; then
|
||||
echo "Deleting IP for ${N}(${MACR})"
|
||||
if [ -n "$(readConfigKey "network.${MACR}" "${USER_CONFIG_FILE}")" ]; then
|
||||
if [ "1" = "$(cat /sys/class/net/${N}/carrier 2>/dev/null)" ]; then
|
||||
ip addr flush dev "${N}"
|
||||
ip addr flush dev ${N}
|
||||
fi
|
||||
deleteConfigKey "network.${MACR}" "${USER_CONFIG_FILE}"
|
||||
IP="$(getIP)"
|
||||
@@ -2275,37 +2088,38 @@ function staticIPMenu() {
|
||||
sleep 1
|
||||
fi
|
||||
else
|
||||
echo "Setting IP for ${N}(${MACR}) to ${address}/${netmask}/${gateway}/${dnsname}"
|
||||
if [ "1" = "$(cat /sys/class/net/${N}/carrier 2>/dev/null)" ]; then
|
||||
ip addr flush dev "${N}"
|
||||
ip addr add "${address}/${netmask:-"255.255.255.0"}" dev "${N}"
|
||||
ip addr flush dev ${N}
|
||||
ip addr add ${address}/${netmask:-"255.255.255.0"} dev ${N} || exit 1
|
||||
if [ -n "${gateway}" ]; then
|
||||
ip route add default via "${gateway}" dev "${N}"
|
||||
ip route add default via ${gateway} dev ${N} || exit 1
|
||||
fi
|
||||
if [ -n "${dnsname:-${gateway}}" ]; then
|
||||
sed -i "/nameserver ${dnsname:-${gateway}}/d" /etc/resolv.conf
|
||||
echo "nameserver ${dnsname:-${gateway}}" >>/etc/resolv.conf
|
||||
echo "nameserver ${dnsname:-${gateway}}" >>/etc/resolv.conf || exit 1
|
||||
fi
|
||||
fi
|
||||
writeConfigKey "network.${MACR}" "${address}/${netmask}/${gateway}/${dnsname}" "${USER_CONFIG_FILE}"
|
||||
IP="$(getIP)"
|
||||
[ -z "${IPCON}" ] && IPCON="${IP}"
|
||||
sleep 1
|
||||
sleep 3
|
||||
fi
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
) 2>&1 | dialog --backtitle "$(backtitle)" --title "StaticIP" \
|
||||
--progressbox "Setting IP ..." 20 100
|
||||
--progressbox "Setting IP for ${N}" 20 100
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
getnetinfo
|
||||
break
|
||||
;;
|
||||
1)
|
||||
break
|
||||
;;
|
||||
*)
|
||||
break 2
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
done
|
||||
return
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
@@ -2847,10 +2661,11 @@ function resetLoader() {
|
||||
[ -d "${UNTAR_PAT_PATH}" ] && rm -rf "${UNTAR_PAT_PATH}" >/dev/null
|
||||
[ -f "${USER_CONFIG_FILE}" ] && rm -f "${USER_CONFIG_FILE}" >/dev/null
|
||||
[ -f "${ARC_RAMDISK_USER_FILE}" ] && rm -f "${ARC_RAMDISK_USER_FILE}" >/dev/null
|
||||
[ -f "${HOME}/.initialized" ] && rm -f "${HOME}/.initialized" >/dev/null
|
||||
dialog --backtitle "$(backtitle)" --title "Reset Loader" --aspect 18 \
|
||||
--yesno "Reset successful.\nReboot required!" 0 0
|
||||
[ $? -ne 0 ] && return
|
||||
rebootTo config
|
||||
exec init.sh
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
@@ -2911,14 +2726,9 @@ function greplogs() {
|
||||
|
||||
if [ -n "$(ls -A ${TMP_PATH}/logs 2>/dev/null)" ]; then
|
||||
tar -czf "${TMP_PATH}/logs.tar.gz" -C "${TMP_PATH}" logs
|
||||
if [ -z "${SSH_TTY}" ]; then # web
|
||||
mv -f "${TMP_PATH}/logs.tar.gz" "/var/www/data/logs.tar.gz"
|
||||
URL="http://${IPCON}${HTTPPORT:+:$HTTPPORT}/logs.tar.gz"
|
||||
MSG+="Please via ${URL} to download the logs,\nAnd go to Github or Discord to create an issue and upload the logs."
|
||||
else
|
||||
sz -be -B 536870912 "${TMP_PATH}/logs.tar.gz"
|
||||
MSG+="Please go to Github or Discord to create an issue and upload the logs."
|
||||
fi
|
||||
mv -f "${TMP_PATH}/logs.tar.gz" "/var/www/data/logs.tar.gz"
|
||||
URL="http://${IPCON}${HTTPPORT:+:$HTTPPORT}/logs.tar.gz"
|
||||
MSG+="Please via ${URL} to download the logs,\nAnd go to Github or Discord to create an issue and upload the logs."
|
||||
fi
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Grep Logs" \
|
||||
--msgbox "${MSG}" 0 0
|
||||
@@ -2931,17 +2741,11 @@ function getbackup() {
|
||||
if [ -d "${PART1_PATH}/dsmbackup" ]; then
|
||||
rm -f "${TMP_PATH}/dsmconfig.tar.gz" >/dev/null
|
||||
tar -czf "${TMP_PATH}/dsmconfig.tar.gz" -C "${PART1_PATH}" dsmbackup
|
||||
if [ -z "${SSH_TTY}" ]; then # web
|
||||
cp -f "${TMP_PATH}/dsmconfig.tar.gz" "/var/www/data/dsmconfig.tar.gz"
|
||||
chmod 644 "/var/www/data/dsmconfig.tar.gz"
|
||||
URL="http://${IPCON}${HTTPPORT:+:$HTTPPORT}/dsmconfig.tar.gz"
|
||||
dialog --backtitle "$(backtitle)" --colors --title "DSM Config" \
|
||||
--msgbox "Please via ${URL}\nto download the dsmconfig and unzip it and back it up in order by file name." 0 0
|
||||
else
|
||||
sz -be -B 536870912 "${TMP_PATH}/dsmconfig.tar.gz"
|
||||
dialog --backtitle "$(backtitle)" --colors --title "DSM Config" \
|
||||
--msgbox "Please unzip it and back it up in order by file name." 0 0
|
||||
fi
|
||||
cp -f "${TMP_PATH}/dsmconfig.tar.gz" "/var/www/data/dsmconfig.tar.gz"
|
||||
chmod 644 "/var/www/data/dsmconfig.tar.gz"
|
||||
URL="http://${IPCON}${HTTPPORT:+:$HTTPPORT}/dsmconfig.tar.gz"
|
||||
dialog --backtitle "$(backtitle)" --colors --title "DSM Config" \
|
||||
--msgbox "Please via ${URL}\nto download the dsmconfig and unzip it and back it up in order by file name." 0 0
|
||||
else
|
||||
MSG=""
|
||||
MSG+="\Z1No dsmbackup found!\Zn\n\n"
|
||||
@@ -3654,5 +3458,5 @@ function getnetinfo() {
|
||||
[ -n "${IPCON}" ] && break
|
||||
done
|
||||
|
||||
export IPCON="${IPCON:-noip}"
|
||||
IPCON="${IPCON:-noip}"
|
||||
}
|
||||
@@ -23,7 +23,7 @@ function backtitle() {
|
||||
BACKTITLE="${ARC_TITLE}$([ -n "${NEWTAG}" ] && [ -n "${ARC_VERSION}" ] && [ ${ARC_VERSION//[!0-9]/} -lt ${NEWTAG//[!0-9]/} ] && echo " > ${NEWTAG}") | "
|
||||
BACKTITLE+="${MODEL:-(Model)} | "
|
||||
BACKTITLE+="${PRODUCTVER:-(Version)} | "
|
||||
BACKTITLE+="${IPCON:-(IP)} | "
|
||||
BACKTITLE+="${IPCON:-(no IP)} | "
|
||||
BACKTITLE+="Patch: ${ARCPATCH} | "
|
||||
BACKTITLE+="Config: ${CONFDONE} | "
|
||||
BACKTITLE+="Build: ${BUILDDONE} | "
|
||||
@@ -53,7 +53,7 @@ elif [ "${ARCMODE}" = "automated" ]; then
|
||||
fi
|
||||
elif [ "${ARCMODE}" = "config" ]; then
|
||||
[ "${CONFDONE}" = "true" ] && NEXT="2" || NEXT="1"
|
||||
[ "${BUILDDONE}" = "true" ] && NEXT="3" || NEXT="1"
|
||||
[ "${BUILDDONE}" = "true" ] && NEXT="4" || NEXT="1"
|
||||
while true; do
|
||||
rm -f "${TMP_PATH}/menu" "${TMP_PATH}/resp" >/dev/null 2>&1 || true
|
||||
|
||||
@@ -71,10 +71,13 @@ elif [ "${ARCMODE}" = "config" ]; then
|
||||
else
|
||||
write_menu "2" "Build Loader"
|
||||
fi
|
||||
if [ -f "${MOD_ZIMAGE_FILE}" ] && [ -f "${MOD_RDGZ_FILE}" ]; then
|
||||
write_menu "3" "Rebuild Loader with clean Image"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${BUILDDONE}" = "true" ]; then
|
||||
write_menu "3" "Boot Loader"
|
||||
write_menu "4" "Boot Loader"
|
||||
fi
|
||||
|
||||
write_menu "=" "\Z4===== Info =====\Zn"
|
||||
@@ -83,13 +86,7 @@ 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 "5" "\Z1Hide Arc DSM Options\Zn"
|
||||
write_menu "b" "Addons"
|
||||
write_menu "d" "Modules"
|
||||
write_menu "e" "Version"
|
||||
@@ -114,40 +111,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 "5" "\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"
|
||||
@@ -157,19 +146,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"
|
||||
@@ -178,27 +163,25 @@ 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
|
||||
dialog --clear --default-item ${NEXT} --backtitle "$(backtitle)" --title "Classic UI" --colors \
|
||||
--cancel-label "Evo" --help-button --help-label "Exit" \
|
||||
[ "$TERM" != "xterm-256color" ] && WEBCONFIG="Webconfig: http://${IPCON}${HTTPPORT:+:$HTTPPORT}" || WEBCONFIG=""
|
||||
dialog --clear --default-item ${NEXT} --backtitle "$(backtitle)" --title "Advanced UI" --colors \
|
||||
--cancel-label "Easy UI" --help-button --help-label "Exit" \
|
||||
--menu "${WEBCONFIG}" 0 0 0 --file "${TMP_PATH}/menu" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
RET=$?
|
||||
@@ -210,16 +193,20 @@ elif [ "${ARCMODE}" = "config" ]; then
|
||||
# Main Section
|
||||
0) genHardwareID; NEXT="0" ;;
|
||||
1) arcModel; NEXT="2" ;;
|
||||
2) arcSummary; NEXT="3" ;;
|
||||
3) boot; NEXT="3" ;;
|
||||
2) arcSummary; NEXT="4" ;;
|
||||
3) rm -f "${MOD_ZIMAGE_FILE}" "${MOD_RDGZ_FILE}" >/dev/null 2>&1 || true
|
||||
arcSummary;
|
||||
NEXT="4"
|
||||
;;
|
||||
4) boot; NEXT="4" ;;
|
||||
# Info Section
|
||||
a) sysinfo; NEXT="a" ;;
|
||||
A) networkdiag; NEXT="A" ;;
|
||||
# System Section
|
||||
# Arc Section
|
||||
4) [ "${ARCOPTS}" = "true" ] && ARCOPTS='false' || ARCOPTS='true'
|
||||
5) [ "${ARCOPTS}" = "true" ] && ARCOPTS='false' || ARCOPTS='true'
|
||||
ARCOPTS="${ARCOPTS}"
|
||||
NEXT="4"
|
||||
NEXT="5"
|
||||
;;
|
||||
b) addonMenu; NEXT="b" ;;
|
||||
d) modulesMenu; NEXT="d" ;;
|
||||
@@ -365,6 +352,10 @@ elif [ "${ARCMODE}" = "config" ]; then
|
||||
esac
|
||||
done
|
||||
clear
|
||||
else
|
||||
echo "Unknown Mode: ${ARCMODE} - Rebooting to Config Mode"
|
||||
sleep 3
|
||||
rebootTo config
|
||||
fi
|
||||
|
||||
# Inform user
|
||||
|
||||
@@ -5,13 +5,15 @@ 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
|
||||
|
||||
# Get Loader Disk Bus
|
||||
[ -z "${LOADER_DISK}" ] && die "Loader Disk not found!"
|
||||
BUS=$(getBus "${LOADER_DISK}")
|
||||
EFI=$([ -d /sys/firmware/efi ] && echo 1 || echo 0)
|
||||
[ -d /sys/firmware/efi ] && EFI="1" || EFI="0"
|
||||
|
||||
# Print Title centralized
|
||||
clear
|
||||
@@ -46,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')"
|
||||
@@ -56,23 +60,23 @@ 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}")"
|
||||
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
|
||||
|
||||
# Build Sanity Check
|
||||
[ "${BUILDDONE}" = "false" ] && die "Loader build not completed!"
|
||||
if [ -z "${MODELID}" ] || [ "${MODELID}" != "${MODEL}" ]; then
|
||||
die "Loader build not completed! Model mismatch!"
|
||||
fi
|
||||
[[ -z "${MODELID}" || "${MODELID}" != "${MODEL}" ]] && die "Loader build not completed! Model mismatch! -> Rebuild loader!"
|
||||
|
||||
# HardwareID Check
|
||||
if [ "${ARCPATCH}" = "true" ]; then
|
||||
if [ "${ARCPATCH}" = "true" ] || [ -n "${ARCCONF}" ]; then
|
||||
HARDWAREID="$(readConfigKey "arc.hardwareid" "${USER_CONFIG_FILE}")"
|
||||
HWID="$(genHWID)"
|
||||
if [ "${HARDWAREID}" != "${HWID}" ]; then
|
||||
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}"
|
||||
echo -e "\033[1;31m*** HardwareID does not match! - Loader can't verfify your System! You need to reconfigure your Loader - Rebooting to Config Mode! ***\033[0m"
|
||||
rm -f "${USER_CONFIG_FILE}" 2>/dev/null || true
|
||||
[ -f "${S_FILE}.bak" ] && mv -f "${S_FILE}.bak" "${S_FILE}" 2>/dev/null || true
|
||||
sleep 5
|
||||
rebootTo "config"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -81,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
|
||||
@@ -96,6 +101,7 @@ fi
|
||||
if [ "${DISKINFO}" = "true" ]; then
|
||||
echo -e "\033[1;37mDisks:\033[0m"
|
||||
echo -e "Disks: \033[1;37m$(lsblk -dpno NAME | grep -v "${LOADER_DISK}" | wc -l)\033[0m"
|
||||
echo
|
||||
fi
|
||||
if [ "${HWIDINFO}" = "true" ]; then
|
||||
echo -e "\033[1;37mHardwareID:\033[0m"
|
||||
@@ -147,7 +153,7 @@ ETHM=${ETHM:-${ETHN}}
|
||||
NIC=0
|
||||
for N in ${ETHX}; do
|
||||
MAC=$(readConfigKey "${N}" "${USER_CONFIG_FILE}" 2>/dev/null)
|
||||
MAC=${MAC:-$(cat /sys/class/net/${N}/address 2>/dev/null | tr '[:upper:]' '[:lower:]')}
|
||||
[ -z ${MAC} ] && MAC="$(cat /sys/class/net/${N}/address 2>/dev/null)"
|
||||
CMDLINE["mac$((++NIC))"]="${MAC}"
|
||||
[ ${NIC} -ge ${ETHM} ] && break
|
||||
done
|
||||
@@ -270,7 +276,6 @@ for KEY in "${!CMDLINE[@]}"; do
|
||||
[ -n "${VALUE}" ] && CMDLINE_LINE+="=${VALUE}"
|
||||
done
|
||||
CMDLINE_LINE=$(echo "${CMDLINE_LINE}" | sed 's/^ //') # Remove leading space
|
||||
echo "${CMDLINE_LINE}" >"${PART1_PATH}/cmdline.yml"
|
||||
|
||||
# Boot
|
||||
DIRECTBOOT="$(readConfigKey "directboot" "${USER_CONFIG_FILE}")"
|
||||
@@ -288,17 +293,14 @@ 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
|
||||
echo -e "\033[1;37mDetected ${ETHN} NIC:\033[0m"
|
||||
fi
|
||||
echo
|
||||
|
||||
[ ! -f /var/run/dhcpcd/pid ] && /etc/init.d/S09dhcpcd restart >/dev/null 2>&1 || true
|
||||
sleep 3
|
||||
checkNIC
|
||||
[ ! -f /var/run/dhcpcd/pid ] && /etc/init.d/S09dhcpcd restart >/dev/null 2>&1 && sleep 3 || true
|
||||
checkNIC || true
|
||||
echo
|
||||
|
||||
DSMLOGO="$(readConfigKey "bootscreen.dsmlogo" "${USER_CONFIG_FILE}")"
|
||||
@@ -310,7 +312,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
|
||||
@@ -319,22 +321,13 @@ elif [ "${DIRECTBOOT}" = "false" ]; then
|
||||
fi
|
||||
done
|
||||
|
||||
# # Unload all network interfaces
|
||||
# for D in $(realpath /sys/class/net/*/device/driver); do rmmod -f "$(basename ${D})" 2>/dev/null || true; done
|
||||
|
||||
# Unload all graphics drivers
|
||||
# for D in $(lsmod | grep -E '^(nouveau|amdgpu|radeon|i915)' | awk '{print $1}'); do rmmod -f "${D}" 2>/dev/null || true; done
|
||||
# for I in $(find /sys/devices -name uevent -exec bash -c 'cat {} 2>/dev/null | grep -Eq "PCI_CLASS=0?30[0|1|2]00" && dirname {}' \;); do
|
||||
# [ -e ${I}/reset ] && cat ${I}/vendor >/dev/null | grep -iq 0x10de && echo 1 >${I}/reset || true # Proc open nvidia driver when booting
|
||||
# done
|
||||
|
||||
echo -e "\033[1;37mLoading DSM Kernel...\033[0m"
|
||||
KEXECARGS="-a"
|
||||
if [ $(echo "${KVER:-4}" | cut -d'.' -f1) -lt 4 ] && [ ${EFI} -eq 1 ]; then
|
||||
echo -e "\033[1;33mWarning, running kexec with --noefi param, strange things will happen!!\033[0m"
|
||||
KEXECARGS="kexecboot"
|
||||
if [ ${EFI} -eq 0 ]; then
|
||||
KEXECARGS+=" --noefi"
|
||||
fi
|
||||
kexec ${KEXECARGS} -l "${MOD_ZIMAGE_FILE}" --initrd "${MOD_RDGZ_FILE}" --command-line="${CMDLINE_LINE} kexecboot" >"${LOG_FILE}" 2>&1 || dieLog
|
||||
|
||||
kexec -l "${MOD_ZIMAGE_FILE}" --initrd "${MOD_RDGZ_FILE}" --command-line="${CMDLINE_LINE} ${KEXECARGS}" >"${PART1_PATH}/cmdline.yml" || die "Failed to load DSM Kernel!"
|
||||
|
||||
echo -e "\033[1;37mBooting DSM...\033[0m"
|
||||
[ "${KERNELLOAD}" = "kexec" ] && kexec -e || poweroff
|
||||
|
||||
@@ -23,7 +23,7 @@ function backtitle() {
|
||||
BACKTITLE="${ARC_TITLE}$([ -n "${NEWTAG}" ] && [ -n "${ARC_VERSION}" ] && [ ${ARC_VERSION//[!0-9]/} -lt ${NEWTAG//[!0-9]/} ] && echo " > ${NEWTAG}") | "
|
||||
BACKTITLE+="${MODEL:-(Model)} | "
|
||||
BACKTITLE+="${PRODUCTVER:-(Version)} | "
|
||||
BACKTITLE+="${IPCON:-(IP)} | "
|
||||
BACKTITLE+="${IPCON:-(no IP)} | "
|
||||
BACKTITLE+="Patch: ${ARCPATCH} | "
|
||||
BACKTITLE+="Config: ${CONFDONE} | "
|
||||
BACKTITLE+="Build: ${BUILDDONE} | "
|
||||
@@ -33,6 +33,159 @@ function backtitle() {
|
||||
echo "${BACKTITLE}"
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# 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"
|
||||
|
||||
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
|
||||
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
|
||||
write_menu "6" "\Z1Show Boot Options\Zn"
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
write_menu "8" "\Z1Show Loader Options\Zn"
|
||||
fi
|
||||
|
||||
dialog --clear --default-item ${NEXT} --backtitle "$(backtitle)" --title "Easy 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
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
return
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
# Main loop
|
||||
@@ -57,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
|
||||
@@ -76,11 +229,11 @@ elif [ "${ARCMODE}" = "config" ]; then
|
||||
fi
|
||||
|
||||
if [ "${PLATFORM}" = "epyc7002" ]; then
|
||||
CPUINFO="$(cat /proc/cpuinfo | wc -l)"
|
||||
CPUINFO="$(cat /proc/cpuinfo | grep MHz | wc -l)"
|
||||
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"
|
||||
@@ -88,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"
|
||||
@@ -133,8 +286,8 @@ elif [ "${ARCMODE}" = "config" ]; then
|
||||
else
|
||||
WEBCONFIG=""
|
||||
fi
|
||||
dialog --clear --default-item ${NEXT} --backtitle "$(backtitle)" --title "Evo UI" --colors \
|
||||
--cancel-label "Classic" --help-button --help-label "Exit" \
|
||||
dialog --clear --default-item ${NEXT} --backtitle "$(backtitle)" --title "Easy UI" --colors \
|
||||
--cancel-label "Advanced UI" --help-button --help-label "Exit" \
|
||||
--extra-button --extra-label "${EXTRA_LABEL}" \
|
||||
--menu "${WEBCONFIG}" 0 0 0 --file "${TMP_PATH}/menu" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
@@ -225,6 +378,10 @@ elif [ "${ARCMODE}" = "config" ]; then
|
||||
;;
|
||||
esac
|
||||
done
|
||||
else
|
||||
echo "Unknown Mode: ${ARCMODE} - Rebooting to Config Mode"
|
||||
sleep 3
|
||||
rebootTo config
|
||||
fi
|
||||
|
||||
# Inform user
|
||||
|
||||
Binary file not shown.
@@ -67,14 +67,10 @@ function installAddon() {
|
||||
fi
|
||||
local ADDON="${1}"
|
||||
mkdir -p "${TMP_PATH}/${ADDON}"
|
||||
local HAS_FILES=0
|
||||
# First check generic files
|
||||
if [ -f "${ADDONS_PATH}/${ADDON}/all.tgz" ]; then
|
||||
tar -zxf "${ADDONS_PATH}/${ADDON}/all.tgz" -C "${TMP_PATH}/${ADDON}"
|
||||
HAS_FILES=1
|
||||
fi
|
||||
# If has files to copy, copy it, else return error
|
||||
[ ${HAS_FILES} -ne 1 ] && return 1
|
||||
cp -f "${TMP_PATH}/${ADDON}/install.sh" "${RAMDISK_PATH}/addons/${ADDON}.sh" 2>"${LOG_FILE}"
|
||||
chmod +x "${RAMDISK_PATH}/addons/${ADDON}.sh"
|
||||
[ -d ${TMP_PATH}/${ADDON}/root ] && (cp -rnf "${TMP_PATH}/${ADDON}/root/"* "${RAMDISK_PATH}/" 2>"${LOG_FILE}")
|
||||
|
||||
@@ -4,6 +4,10 @@ PART2_PATH="/mnt/p2"
|
||||
PART3_PATH="/mnt/p3"
|
||||
TMP_PATH="/tmp"
|
||||
|
||||
[ -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"
|
||||
@@ -43,6 +47,6 @@ EXTRACTOR_BIN="syno_extract_system_patch"
|
||||
HTTPPORT=$(grep -i '^HTTP_PORT=' /etc/arc.conf 2>/dev/null | cut -d'=' -f2)
|
||||
[ -z "${HTTPPORT}" ] && HTTPPORT="" || true
|
||||
DUFSPORT=$(grep -i '^DUFS_PORT=' /etc/arc.conf 2>/dev/null | cut -d'=' -f2)
|
||||
[ -z "${DUFSPORT}" ] && DUFSPORT=7304 || true
|
||||
[ -z "${DUFSPORT}" ] && DUFSPORT="7304" || true
|
||||
TTYDPORT=$(grep -i '^TTYD_PORT=' /etc/arc.conf 2>/dev/null | cut -d'=' -f2)
|
||||
[ -z "${TTYDPORT}" ] && TTYDPORT=7681 || true
|
||||
[ -z "${TTYDPORT}" ] && TTYDPORT="7681" || true
|
||||
@@ -3,6 +3,7 @@
|
||||
. "${ARC_PATH}/include/consts.sh"
|
||||
. "${ARC_PATH}/include/configFile.sh"
|
||||
. "${ARC_PATH}/include/addons.sh"
|
||||
. "${ARC_PATH}/include/modules.sh"
|
||||
|
||||
###############################################################################
|
||||
# Check loader disk
|
||||
@@ -11,7 +12,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
|
||||
@@ -25,21 +26,16 @@ function checkBootLoader() {
|
||||
###############################################################################
|
||||
# Check boot mode
|
||||
function arc_mode() {
|
||||
unset ARCMODE ARC_BRANCH ARC_VERSION ARC_BUILD ARCCONF
|
||||
if grep -q 'automated_arc' /proc/cmdline; then
|
||||
export ARCMODE="automated"
|
||||
ARCMODE="automated"
|
||||
elif grep -q 'update_arc' /proc/cmdline; then
|
||||
export ARCMODE="update"
|
||||
ARCMODE="update"
|
||||
elif grep -q 'force_arc' /proc/cmdline; then
|
||||
export ARCMODE="config"
|
||||
ARCMODE="config"
|
||||
else
|
||||
export ARCMODE="dsm"
|
||||
ARCMODE="dsm"
|
||||
fi
|
||||
[ -f "${PART3_PATH}/automated" ] && rm -f "${PART3_PATH}/automated" >/dev/null 2>&1 || true
|
||||
[ -f "${PART1_PATH}/ARC-BRANCH" ] && export ARC_BRANCH=$(cat "${PART1_PATH}/ARC-BRANCH") || export ARC_BRANCH="null"
|
||||
[ -f "${PART1_PATH}/ARC-VERSION" ] && export ARC_VERSION=$(cat "${PART1_PATH}/ARC-VERSION") || export ARC_VERSION="null"
|
||||
[ -f "${PART1_PATH}/ARC-BUILD" ] && export ARC_BUILD=$(cat "${PART1_PATH}/ARC-BUILD") || export ARC_BUILD="null"
|
||||
[ "$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")" ] && export ARCCONF="true" || export ARCCONF=""
|
||||
[ "$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")" ] && ARCCONF="true" || true
|
||||
}
|
||||
|
||||
|
||||
@@ -479,7 +475,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"
|
||||
@@ -619,12 +615,15 @@ function onlineCheck() {
|
||||
writeConfigKey "keymap" "${KEYMAP}" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
fi
|
||||
NEWTAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | grep -v "dev" | sort -rV | head -1)"
|
||||
if [ -n "${NEWTAG}" ]; then
|
||||
writeConfigKey "arc.offline" "false" "${USER_CONFIG_FILE}"
|
||||
updateOffline
|
||||
else
|
||||
writeConfigKey "arc.offline" "true" "${USER_CONFIG_FILE}"
|
||||
if [ "${ARC_BRANCH}" != "dev" ]; then
|
||||
NEWTAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | grep -v "dev" | sort -rV | head -1)"
|
||||
if [ -n "${NEWTAG}" ]; then
|
||||
writeConfigKey "arc.offline" "false" "${USER_CONFIG_FILE}"
|
||||
updateOffline
|
||||
checkHardwareID
|
||||
else
|
||||
writeConfigKey "arc.offline" "true" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -649,18 +648,14 @@ function systemCheck () {
|
||||
else
|
||||
AESSYS="true"
|
||||
fi
|
||||
# Check for ACPI Support
|
||||
if ! grep -q "^flags.*acpi.*" /proc/cpuinfo; then
|
||||
ACPISYS="false"
|
||||
else
|
||||
ACPISYS="true"
|
||||
fi
|
||||
# Check for CPU Frequency Scaling
|
||||
CPUFREQUENCIES=$(ls -ltr /sys/devices/system/cpu/cpufreq/* 2>/dev/null | wc -l)
|
||||
if [ ${CPUFREQUENCIES} -gt 1 ]; then
|
||||
CPUFREQUENCIES=$(ls -l /sys/devices/system/cpu/cpufreq/*/* 2>/dev/null | wc -l)
|
||||
if [ ${CPUFREQUENCIES} -gt 0 ]; then
|
||||
CPUFREQ="true"
|
||||
ACPISYS="true"
|
||||
else
|
||||
CPUFREQ="false"
|
||||
ACPISYS="false"
|
||||
fi
|
||||
# Check for Arc Patch
|
||||
arc_mode
|
||||
@@ -708,7 +703,7 @@ function __umountDSMRootDisk() {
|
||||
# bootwait SSH/Web
|
||||
function _bootwait() {
|
||||
BOOTWAIT="$(readConfigKey "bootwait" "${USER_CONFIG_FILE}")"
|
||||
[ -z "${BOOTWAIT}" ] && BOOTWAIT=10
|
||||
[ -z "${BOOTWAIT}" ] && BOOTWAIT="5"
|
||||
busybox w 2>/dev/null | awk '{print $1" "$2" "$4" "$5" "$6}' >WB
|
||||
MSG=""
|
||||
while [ ${BOOTWAIT} -gt 0 ]; do
|
||||
@@ -739,12 +734,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"
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -14,7 +14,7 @@ arc_mode || die "No bootmode found!"
|
||||
[ -f "${USER_CONFIG_FILE}" ] && sed -i "s/'/\"/g" "${USER_CONFIG_FILE}" >/dev/null 2>&1 || true
|
||||
|
||||
BUS=$(getBus "${LOADER_DISK}")
|
||||
EFI=$([ -d /sys/firmware/efi ] && echo 1 || echo 0)
|
||||
[ -d /sys/firmware/efi ] && EFI="1" || EFI="0"
|
||||
|
||||
# Print Title centralized
|
||||
clear
|
||||
@@ -131,15 +131,15 @@ elif ! echo "${BUSLIST}" | grep -wq "${BUS}"; then
|
||||
die "$(printf "The boot disk does not support the current %s, only %s are supported." "${BUS}" "${BUSLIST// /\/}")"
|
||||
fi
|
||||
|
||||
# Save variables to user config file
|
||||
writeConfigKey "vid" "${VID}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "pid" "${PID}" "${USER_CONFIG_FILE}"
|
||||
|
||||
# Inform user and check bus
|
||||
echo -e "Loader Disk: \033[1;34m${LOADER_DISK}\033[0m"
|
||||
echo -e "Loader Disk Type: \033[1;34m${BUS}\033[0m"
|
||||
echo
|
||||
|
||||
# Save variables to user config file
|
||||
writeConfigKey "vid" "${VID}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "pid" "${PID}" "${USER_CONFIG_FILE}"
|
||||
|
||||
# Decide if boot automatically
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
if [ "${ARCMODE}" = "config" ]; then
|
||||
@@ -158,12 +158,11 @@ echo
|
||||
|
||||
BOOTIPWAIT="$(readConfigKey "bootipwait" "${USER_CONFIG_FILE}")"
|
||||
[ -z "${BOOTIPWAIT}" ] && BOOTIPWAIT=30
|
||||
echo
|
||||
echo -e "\033[1;37mDetected ${ETHN} NIC:\033[0m"
|
||||
IPCON=""
|
||||
echo -e "\033[1;37mDetected ${ETHN} NIC:\033[0m"
|
||||
echo
|
||||
[ ! -f /var/run/dhcpcd/pid ] && /etc/init.d/S09dhcpcd restart >/dev/null 2>&1 || true
|
||||
sleep 3
|
||||
|
||||
[ ! -f /var/run/dhcpcd/pid ] && /etc/init.d/S09dhcpcd restart >/dev/null 2>&1 && sleep 3 || true
|
||||
checkNIC
|
||||
echo
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@ RD_COMPRESSED="$(readConfigKey "rd-compressed" "${USER_CONFIG_FILE}")"
|
||||
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
|
||||
BUILDNUM="$(readConfigKey "buildnum" "${USER_CONFIG_FILE}")"
|
||||
SMALLNUM="$(readConfigKey "smallnum" "${USER_CONFIG_FILE}")"
|
||||
ARCBRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
|
||||
# Read new PAT Info from Config
|
||||
PAT_URL="$(readConfigKey "paturl" "${USER_CONFIG_FILE}")"
|
||||
PAT_HASH="$(readConfigKey "pathash" "${USER_CONFIG_FILE}")"
|
||||
@@ -117,6 +116,16 @@ for PATCH in "${PATCHES[@]}"; do
|
||||
done
|
||||
done
|
||||
|
||||
# Add serial number to synoinfo.conf, to help to recovery a installed DSM
|
||||
echo "Set synoinfo SN" >"${LOG_FILE}"
|
||||
_set_conf_kv "SN" "${SN}" "${RAMDISK_PATH}/etc/synoinfo.conf" >>"${LOG_FILE}" 2>&1 || exit 1
|
||||
_set_conf_kv "SN" "${SN}" "${RAMDISK_PATH}/etc.defaults/synoinfo.conf" >>"${LOG_FILE}" 2>&1 || exit 1
|
||||
for KEY in "${!SYNOINFO[@]}"; do
|
||||
echo "Set synoinfo ${KEY}" >>"${LOG_FILE}"
|
||||
_set_conf_kv "${KEY}" "${SYNOINFO[${KEY}]}" "${RAMDISK_PATH}/etc/synoinfo.conf" >>"${LOG_FILE}" 2>&1 || exit 1
|
||||
_set_conf_kv "${KEY}" "${SYNOINFO[${KEY}]}" "${RAMDISK_PATH}/etc.defaults/synoinfo.conf" >>"${LOG_FILE}" 2>&1 || exit 1
|
||||
done
|
||||
|
||||
# Patch /sbin/init.post
|
||||
grep -v -e '^[\t ]*#' -e '^$' "${PATCH_PATH}/config-manipulators.sh" >"${TMP_PATH}/rp.txt"
|
||||
sed -e "/@@@CONFIG-MANIPULATORS-TOOLS@@@/ {" -e "r ${TMP_PATH}/rp.txt" -e 'd' -e '}' -i "${RAMDISK_PATH}/sbin/init.post"
|
||||
@@ -152,7 +161,7 @@ mkdir -p "${RAMDISK_PATH}/addons"
|
||||
echo "export LOADERLABEL=\"ARC\""
|
||||
echo "export LOADERVERSION=\"${ARC_VERSION}\""
|
||||
echo "export LOADERBUILD=\"${ARC_BUILD}\""
|
||||
echo "export LOADERBRANCH=\"${ARCBRANCH}\""
|
||||
echo "export LOADERBRANCH=\"${ARC_BRANCH}\""
|
||||
echo "export PLATFORM=\"${PLATFORM}\""
|
||||
echo "export MODEL=\"${MODEL}\""
|
||||
echo "export MODELID=\"${MODELID}\""
|
||||
@@ -164,12 +173,20 @@ mkdir -p "${RAMDISK_PATH}/addons"
|
||||
} >"${RAMDISK_PATH}/addons/addons.sh"
|
||||
chmod +x "${RAMDISK_PATH}/addons/addons.sh"
|
||||
|
||||
# Add redpill ADDON only if PLATFORM is epyc7002
|
||||
if [ "${PLATFORM}" = "epyc7002" ]; then
|
||||
installAddon "redpill" "${PLATFORM}" || exit 1
|
||||
echo "/addons/redpill.sh \${1}" >>"${RAMDISK_PATH}/addons/addons.sh" 2>>"${LOG_FILE}" || exit 1
|
||||
fi
|
||||
|
||||
# System Addons
|
||||
for ADDON in redpill revert misc eudev disks localrss notify wol mountloader; do
|
||||
for ADDON in "revert" "misc" "eudev" "disks" "localrss" "notify" "wol"; do
|
||||
PARAMS=""
|
||||
if [ "${ADDON}" = "disks" ]; then
|
||||
HDDSORT="$(readConfigKey "hddsort" "${USER_CONFIG_FILE}")"
|
||||
PARAMS="${HDDSORT}"
|
||||
if [ -n "${HDDSORT}" ]; then
|
||||
PARAMS="${HDDSORT}"
|
||||
fi
|
||||
[ -f "${USER_UP_PATH}/${MODEL}.dts" ] && cp -f "${USER_UP_PATH}/${MODEL}.dts" "${RAMDISK_PATH}/addons/model.dts"
|
||||
fi
|
||||
installAddon "${ADDON}" "${PLATFORM}" || exit 1
|
||||
@@ -188,7 +205,7 @@ echo "inetd" >>"${RAMDISK_PATH}/addons/addons.sh"
|
||||
|
||||
echo "Modify files" >"${LOG_FILE}"
|
||||
# Remove function from scripts
|
||||
[ "2" = "${PRODUCTVER:2:1}" ] && sed -i 's/function //g' $(find "${RAMDISK_PATH}/addons/" -type f -name "*.sh")
|
||||
[ "2" = "${BUILDNUM:0:1}" ] && sed -i 's/function //g' $(find "${RAMDISK_PATH}/addons/" -type f -name "*.sh")
|
||||
|
||||
# Build modules dependencies
|
||||
# ${ARC_PATH}/depmod -a -b ${RAMDISK_PATH} 2>/dev/null
|
||||
|
||||
@@ -104,7 +104,7 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
|
||||
menuentry 'Arc DSM Mode' ${menuentry_id_option} boot {
|
||||
gfxmode
|
||||
echo "Loading Arc Kernel..."
|
||||
linux /bzImage-arc ${ARC_CMDLINE} ${arc_cmdline}
|
||||
linux /bzImage-arc ${ARC_CMDLINE}
|
||||
echo "Loading Arc Initramfs..."
|
||||
if [ -e /initrd-user ]; then
|
||||
initrd /initrd-arc /initrd-user
|
||||
@@ -119,7 +119,7 @@ if [ -e /automated ]; then
|
||||
menuentry 'Arc Automated Mode' ${menuentry_id_option} automated {
|
||||
gfxmode
|
||||
echo "Loading Arc Kernel..."
|
||||
linux /bzImage-arc ${ARC_CMDLINE} ${arc_cmdline} automated_arc
|
||||
linux /bzImage-arc ${ARC_CMDLINE} automated_arc
|
||||
echo "Loading Arc Initramfs..."
|
||||
if [ -e /initrd-user ]; then
|
||||
initrd /initrd-arc /initrd-user
|
||||
@@ -133,7 +133,7 @@ fi
|
||||
menuentry 'Arc Config Mode' ${menuentry_id_option} config {
|
||||
gfxmode
|
||||
echo "Loading Arc Kernel..."
|
||||
linux /bzImage-arc ${ARC_CMDLINE} ${arc_cmdline} force_arc
|
||||
linux /bzImage-arc ${ARC_CMDLINE} force_arc
|
||||
echo "Loading Arc Initramfs..."
|
||||
if [ -e /initrd-user ]; then
|
||||
initrd /initrd-arc /initrd-user
|
||||
@@ -147,7 +147,7 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
|
||||
menuentry 'Arc Update Mode' ${menuentry_id_option} update {
|
||||
gfxmode
|
||||
echo "Loading Arc Kernel..."
|
||||
linux /bzImage-arc ${ARC_CMDLINE} ${arc_cmdline} update_arc
|
||||
linux /bzImage-arc ${ARC_CMDLINE} update_arc
|
||||
echo "Loading Arc Initramfs..."
|
||||
if [ -e /initrd-user ]; then
|
||||
initrd /initrd-arc /initrd-user
|
||||
@@ -159,7 +159,7 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
|
||||
menuentry 'DSM Recovery Mode' ${menuentry_id_option} recovery {
|
||||
gfxmode
|
||||
echo "Loading Arc Kernel..."
|
||||
linux /bzImage-arc ${ARC_CMDLINE} ${arc_cmdline} recovery
|
||||
linux /bzImage-arc ${ARC_CMDLINE} recovery
|
||||
echo "Loading Arc Initramfs..."
|
||||
if [ -e /initrd-user ]; then
|
||||
initrd /initrd-arc /initrd-user
|
||||
@@ -171,7 +171,7 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
|
||||
menuentry 'DSM Reinstall Mode' ${menuentry_id_option} junior {
|
||||
gfxmode
|
||||
echo "Loading Arc Kernel..."
|
||||
linux /bzImage-arc ${ARC_CMDLINE} ${arc_cmdline} force_junior
|
||||
linux /bzImage-arc ${ARC_CMDLINE} force_junior
|
||||
echo "Loading Arc Initramfs..."
|
||||
if [ -e /initrd-user ]; then
|
||||
initrd /initrd-arc /initrd-user
|
||||
|
||||
@@ -11,7 +11,7 @@ set -e
|
||||
# Clean cached Files
|
||||
sudo git clean -fdx
|
||||
|
||||
. scripts/func.sh "${AUX_TOKEN}"
|
||||
. scripts/functions.sh "${AUX_TOKEN}"
|
||||
|
||||
# Unmount Image File
|
||||
sudo umount "/tmp/p1" 2>/dev/null || true
|
||||
|
||||
624
scripts/functions.py
Normal file → Executable file
624
scripts/functions.py
Normal file → Executable file
@@ -1,373 +1,253 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
|
||||
#
|
||||
# This is free software, licensed under the MIT License.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
import os, click
|
||||
|
||||
WORK_PATH = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
|
||||
@click.group()
|
||||
def cli():
|
||||
"""
|
||||
The CLI is a commands to Arc.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
def mutually_exclusive_options(ctx, param, value):
|
||||
other_option = "file" if param.name == "data" else "data"
|
||||
if value is not None and ctx.params.get(other_option) is not None:
|
||||
raise click.UsageError(f"Illegal usage: `{param.name}` is mutually exclusive with `{other_option}`.")
|
||||
return value
|
||||
|
||||
|
||||
def validate_required_param(ctx, param, value):
|
||||
if not value and "file" not in ctx.params and "data" not in ctx.params:
|
||||
raise click.MissingParameter(param_decls=[param.name])
|
||||
return value
|
||||
|
||||
def __fullversion(ver):
|
||||
out = ver
|
||||
arr = ver.split('-')
|
||||
if len(arr) > 0:
|
||||
a = arr[0].split('.')[0] if len(arr[0].split('.')) > 0 else '0'
|
||||
b = arr[0].split('.')[1] if len(arr[0].split('.')) > 1 else '0'
|
||||
c = arr[0].split('.')[2] if len(arr[0].split('.')) > 2 else '0'
|
||||
d = arr[1] if len(arr) > 1 else '00000'
|
||||
e = arr[2] if len(arr) > 2 else '0'
|
||||
out = '{}.{}.{}-{}-{}'.format(a,b,c,d,e)
|
||||
return out
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.option("-d", "--data", type=str, callback=mutually_exclusive_options, is_eager=True, help="The data of QRCode.")
|
||||
@click.option("-f", "--file", type=str, callback=mutually_exclusive_options, is_eager=True, help="The file of QRCode.")
|
||||
@click.option("--validate", is_flag=True, callback=validate_required_param, expose_value=False, is_eager=True)
|
||||
@click.option("-l", "--location", type=click.IntRange(0, 7), required=True, help="The location of QRCode. (range 0<=x<=7)")
|
||||
@click.option("-o", "--output", type=str, required=True, help="The output file of QRCode.")
|
||||
def makeqr(data, file, location, output):
|
||||
"""
|
||||
Generate a QRCode.
|
||||
"""
|
||||
try:
|
||||
import fcntl, struct
|
||||
import qrcode
|
||||
from PIL import Image
|
||||
|
||||
FBIOGET_VSCREENINFO = 0x4600
|
||||
FBIOPUT_VSCREENINFO = 0x4601
|
||||
FBIOGET_FSCREENINFO = 0x4602
|
||||
FBDEV = "/dev/fb0"
|
||||
if data is not None:
|
||||
qr = qrcode.QRCode(version=1, box_size=10, error_correction=qrcode.constants.ERROR_CORRECT_H, border=4,)
|
||||
qr.add_data(data)
|
||||
qr.make(fit=True)
|
||||
img = qr.make_image(fill_color="grey", back_color="black")
|
||||
img = img.convert("RGBA")
|
||||
pixels = img.load()
|
||||
for i in range(img.size[0]):
|
||||
for j in range(img.size[1]):
|
||||
if pixels[i, j] == (255, 255, 255, 255):
|
||||
pixels[i, j] = (255, 255, 255, 0)
|
||||
|
||||
if os.path.exists(os.path.join(WORK_PATH, "logo.png")):
|
||||
icon = Image.open(os.path.join(WORK_PATH, "logo.png"))
|
||||
icon = icon.convert("RGBA")
|
||||
img.paste(icon.resize((int(img.size[0] / 5), int(img.size[1] / 5))), (int((img.size[0] - int(img.size[0] / 5)) / 2), int((img.size[1] - int(img.size[1] / 5)) / 2),),)
|
||||
|
||||
if file is not None:
|
||||
img = Image.open(file)
|
||||
# img = img.convert("RGBA")
|
||||
# pixels = img.load()
|
||||
# for i in range(img.size[0]):
|
||||
# for j in range(img.size[1]):
|
||||
# if pixels[i, j] == (255, 255, 255, 255):
|
||||
# pixels[i, j] = (255, 255, 255, 0)
|
||||
|
||||
(xres, yres) = (1920, 1080)
|
||||
with open(FBDEV, "rb") as fb:
|
||||
vi = fcntl.ioctl(fb, FBIOGET_VSCREENINFO, bytes(160))
|
||||
res = struct.unpack("I" * 40, vi)
|
||||
if res[0] != 0 and res[1] != 0:
|
||||
(xres, yres) = (res[0], res[1])
|
||||
xqr, yqr = (int(xres / 8), int(xres / 8))
|
||||
img = img.resize((xqr, yqr))
|
||||
|
||||
alpha = Image.new("RGBA", (xres, yres), (0, 0, 0, 0))
|
||||
if int(location) not in range(0, 8):
|
||||
location = 0
|
||||
loc = (img.size[0] * int(location), alpha.size[1] - img.size[1])
|
||||
alpha.paste(img, loc)
|
||||
alpha.save(output)
|
||||
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.option("-p", "--platforms", type=str, help="The platforms of Syno.")
|
||||
def getmodels(platforms=None):
|
||||
"""
|
||||
Get Syno Models.
|
||||
"""
|
||||
import json, requests, urllib3
|
||||
from requests.adapters import HTTPAdapter
|
||||
from requests.packages.urllib3.util.retry import Retry # type: ignore
|
||||
|
||||
adapter = HTTPAdapter(max_retries=Retry(total=3, backoff_factor=0.5, status_forcelist=[500, 502, 503, 504]))
|
||||
session = requests.Session()
|
||||
session.mount("http://", adapter)
|
||||
session.mount("https://", adapter)
|
||||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||
|
||||
if platforms is not None and platforms != "":
|
||||
PS = platforms.lower().replace(",", " ").split()
|
||||
else:
|
||||
PS = []
|
||||
|
||||
models = []
|
||||
try:
|
||||
req = session.get("https://autoupdate.synology.com/os/v2", timeout=10, verify=False)
|
||||
req.encoding = "utf-8"
|
||||
data = json.loads(req.text)
|
||||
|
||||
for I in data["channel"]["item"]:
|
||||
if not I["title"].startswith("DSM"):
|
||||
continue
|
||||
for J in I["model"]:
|
||||
arch = J["mUnique"].split("_")[1]
|
||||
name = J["mLink"].split("/")[-1].split("_")[1].replace("%2B", "+")
|
||||
if len(PS) > 0 and arch.lower() not in PS:
|
||||
continue
|
||||
if any(name == B["name"] for B in models):
|
||||
continue
|
||||
models.append({"name": name, "arch": arch})
|
||||
|
||||
models = sorted(models, key=lambda k: (k["arch"], k["name"]))
|
||||
|
||||
except:
|
||||
pass
|
||||
|
||||
models.sort(key=lambda x: (x["arch"], x["name"]))
|
||||
print(json.dumps(models, indent=4))
|
||||
|
||||
@cli.command()
|
||||
@click.option("-p", "--platforms", type=str, help="The platforms of Syno.")
|
||||
def getmodelsbykb(platforms=None):
|
||||
"""
|
||||
Get Syno Models.
|
||||
"""
|
||||
import json, requests, urllib3
|
||||
from requests.adapters import HTTPAdapter
|
||||
from requests.packages.urllib3.util.retry import Retry # type: ignore
|
||||
|
||||
adapter = HTTPAdapter(max_retries=Retry(total=3, backoff_factor=0.5, status_forcelist=[500, 502, 503, 504]))
|
||||
session = requests.Session()
|
||||
session.mount("http://", adapter)
|
||||
session.mount("https://", adapter)
|
||||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||
|
||||
if platforms is not None and platforms != "":
|
||||
PS = platforms.lower().replace(",", " ").split()
|
||||
else:
|
||||
PS = []
|
||||
|
||||
models = []
|
||||
try:
|
||||
import re
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
url="https://kb.synology.com/en-us/DSM/tutorial/What_kind_of_CPU_does_my_NAS_have"
|
||||
#url = "https://kb.synology.cn/zh-cn/DSM/tutorial/What_kind_of_CPU_does_my_NAS_have"
|
||||
req = session.get(url, timeout=10, verify=False)
|
||||
req.encoding = "utf-8"
|
||||
bs = BeautifulSoup(req.text, "html.parser")
|
||||
p = re.compile(r"data: (.*?),$", re.MULTILINE | re.DOTALL)
|
||||
data = json.loads(p.search(bs.find("script", string=p).prettify()).group(1))
|
||||
model = "(.*?)" # (.*?): all, FS6400: one
|
||||
p = re.compile(r"<td>{}<\/td><td>(.*?)<\/td><td>(.*?)<\/td><td>(.*?)<\/td><td>(.*?)<\/td><td>(.*?)<\/td><td>(.*?)<\/td>".format(model), re.MULTILINE | re.DOTALL,)
|
||||
it = p.finditer(data["preload"]["content"].replace("\n", "").replace("\t", ""))
|
||||
for i in it:
|
||||
d = i.groups()
|
||||
if len(d) == 6:
|
||||
d = model + d
|
||||
if len(PS) > 0 and d[5].lower() not in PS:
|
||||
continue
|
||||
models.append({"name": d[0].split("<br")[0], "arch": d[5].lower()})
|
||||
except:
|
||||
pass
|
||||
|
||||
models.sort(key=lambda x: (x["arch"], x["name"]))
|
||||
print(json.dumps(models, indent=4))
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.option("-m", "--model", type=str, required=True, help="The model of Syno.")
|
||||
@click.option("-v", "--version", type=str, required=True, help="The version of Syno.")
|
||||
def getpats4mv(model, version):
|
||||
import json, requests, urllib3
|
||||
from requests.adapters import HTTPAdapter
|
||||
from requests.packages.urllib3.util.retry import Retry # type: ignore
|
||||
|
||||
adapter = HTTPAdapter(max_retries=Retry(total=3, backoff_factor=0.5, status_forcelist=[500, 502, 503, 504]))
|
||||
session = requests.Session()
|
||||
session.mount("http://", adapter)
|
||||
session.mount("https://", adapter)
|
||||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||
|
||||
pats = {}
|
||||
try:
|
||||
urlInfo = "https://www.synology.com/api/support/findDownloadInfo?lang=en-us"
|
||||
urlSteps = "https://www.synology.com/api/support/findUpgradeSteps?"
|
||||
#urlInfo = "https://www.synology.cn/api/support/findDownloadInfo?lang=zh-cn"
|
||||
#urlSteps = "https://www.synology.cn/api/support/findUpgradeSteps?"
|
||||
|
||||
major = "&major={}".format(version.split('.')[0]) if len(version.split('.')) > 0 else ""
|
||||
minor = "&minor={}".format(version.split('.')[1]) if len(version.split('.')) > 1 else ""
|
||||
req = session.get("{}&product={}{}{}".format(urlInfo, model.replace("+", "%2B"), major, minor), timeout=10, verify=False)
|
||||
req.encoding = "utf-8"
|
||||
data = json.loads(req.text)
|
||||
|
||||
build_ver = data['info']['system']['detail'][0]['items'][0]['build_ver']
|
||||
build_num = data['info']['system']['detail'][0]['items'][0]['build_num']
|
||||
buildnano = data['info']['system']['detail'][0]['items'][0]['nano']
|
||||
V=__fullversion("{}-{}-{}".format(build_ver, build_num, buildnano))
|
||||
if not V in pats:
|
||||
pats[V]={}
|
||||
pats[V]['url'] = data['info']['system']['detail'][0]['items'][0]['files'][0]['url'].split('?')[0]
|
||||
pats[V]['sum'] = data['info']['system']['detail'][0]['items'][0]['files'][0]['checksum']
|
||||
|
||||
from_ver=0
|
||||
for I in data['info']['pubVers']:
|
||||
if from_ver == 0 or I['build'] < from_ver: from_ver = I['build']
|
||||
|
||||
for I in data['info']['productVers']:
|
||||
if not I['version'].startswith(version): continue
|
||||
if major == "" or minor == "":
|
||||
majorTmp = "&major={}".format(I['version'].split('.')[0]) if len(I['version'].split('.')) > 0 else ""
|
||||
minorTmp = "&minor={}".format(I['version'].split('.')[1]) if len(I['version'].split('.')) > 1 else ""
|
||||
reqTmp = session.get("{}&product={}{}{}".format(urlInfo, model.replace("+", "%2B"), majorTmp, minorTmp), timeout=10, verify=False)
|
||||
reqTmp.encoding = "utf-8"
|
||||
dataTmp = json.loads(reqTmp.text)
|
||||
|
||||
build_ver = dataTmp['info']['system']['detail'][0]['items'][0]['build_ver']
|
||||
build_num = dataTmp['info']['system']['detail'][0]['items'][0]['build_num']
|
||||
buildnano = dataTmp['info']['system']['detail'][0]['items'][0]['nano']
|
||||
V=__fullversion("{}-{}-{}".format(build_ver, build_num, buildnano))
|
||||
if not V in pats:
|
||||
pats[V]={}
|
||||
pats[V]['url'] = dataTmp['info']['system']['detail'][0]['items'][0]['files'][0]['url'].split('?')[0]
|
||||
pats[V]['sum'] = dataTmp['info']['system']['detail'][0]['items'][0]['files'][0]['checksum']
|
||||
|
||||
for J in I['versions']:
|
||||
to_ver=J['build']
|
||||
reqSteps = session.get("{}&product={}&from_ver={}&to_ver={}".format(urlSteps, model.replace("+", "%2B"), from_ver, to_ver), timeout=10, verify=False)
|
||||
if reqSteps.status_code != 200: continue
|
||||
reqSteps.encoding = "utf-8"
|
||||
dataSteps = json.loads(reqSteps.text)
|
||||
for S in dataSteps['upgrade_steps']:
|
||||
if not 'full_patch' in S or S['full_patch'] is False: continue
|
||||
if not 'build_ver' in S or not S['build_ver'].startswith(version): continue
|
||||
V=__fullversion("{}-{}-{}".format(S['build_ver'], S['build_num'], S['nano']))
|
||||
if not V in pats:
|
||||
pats[V] = {}
|
||||
pats[V]['url'] = S['files'][0]['url'].split('?')[0]
|
||||
pats[V]['sum'] = S['files'][0]['checksum']
|
||||
except:
|
||||
pass
|
||||
|
||||
pats = {k: pats[k] for k in sorted(pats.keys(), reverse=True)}
|
||||
print(json.dumps(pats, indent=4))
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.option("-p", "--models", type=str, help="The models of Syno.")
|
||||
def getpats(models=None):
|
||||
import json, requests, urllib3, re
|
||||
from bs4 import BeautifulSoup
|
||||
from requests.adapters import HTTPAdapter
|
||||
from requests.packages.urllib3.util.retry import Retry # type: ignore
|
||||
|
||||
adapter = HTTPAdapter(max_retries=Retry(total=3, backoff_factor=0.5, status_forcelist=[500, 502, 503, 504]))
|
||||
session = requests.Session()
|
||||
session.mount("http://", adapter)
|
||||
session.mount("https://", adapter)
|
||||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||
|
||||
if models is not None and models != "":
|
||||
MS = models.lower().replace(",", " ").split()
|
||||
else:
|
||||
MS = []
|
||||
|
||||
pats = {}
|
||||
try:
|
||||
req = session.get('https://archive.synology.com/download/Os/DSM', timeout=10, verify=False)
|
||||
req.encoding = 'utf-8'
|
||||
bs=BeautifulSoup(req.text, 'html.parser')
|
||||
p = re.compile(r"(.*?)-(.*?)", re.MULTILINE | re.DOTALL)
|
||||
l = bs.find_all('a', string=p)
|
||||
for i in l:
|
||||
ver = i.attrs['href'].split('/')[-1]
|
||||
if not ver.startswith('7'): continue
|
||||
req = session.get('https://archive.synology.com{}'.format(i.attrs['href']), timeout=10, verify=False)
|
||||
req.encoding = 'utf-8'
|
||||
bs=BeautifulSoup(req.text, 'html.parser')
|
||||
p = re.compile(r"^(.*?)_(.*?)_(.*?).pat$", re.MULTILINE | re.DOTALL)
|
||||
data = bs.find_all('a', string=p)
|
||||
for item in data:
|
||||
p = re.compile(r"DSM_(.*?)_(.*?).pat", re.MULTILINE | re.DOTALL)
|
||||
rels = p.search(item.attrs['href'])
|
||||
if rels != None:
|
||||
info = p.search(item.attrs['href']).groups()
|
||||
model = info[0].replace('%2B', '+')
|
||||
if len(MS) > 0 and model.lower() not in MS:
|
||||
continue
|
||||
if model not in pats.keys():
|
||||
pats[model]={}
|
||||
pats[model][__fullversion(ver)] = item.attrs['href']
|
||||
except:
|
||||
pass
|
||||
|
||||
print(json.dumps(pats, indent=4))
|
||||
|
||||
@cli.command()
|
||||
@click.option("-p", "--platforms", type=str, help="The platforms of Syno.")
|
||||
def getmodelsoffline(platforms=None):
|
||||
"""
|
||||
Get Syno Models.
|
||||
"""
|
||||
import re, json
|
||||
import requests
|
||||
import fcntl, struct
|
||||
|
||||
if platforms is not None and platforms != "":
|
||||
PS = platforms.lower().replace(",", " ").split()
|
||||
else:
|
||||
PS = []
|
||||
|
||||
models = []
|
||||
with open(os.path.join('/mnt/p3/configs', "offline.json")) as user_file:
|
||||
data = json.load(user_file)
|
||||
|
||||
for I in data["channel"]["item"]:
|
||||
if not I["title"].startswith("DSM"):
|
||||
continue
|
||||
for J in I["model"]:
|
||||
arch = J["mUnique"].split("_")[1]
|
||||
name = J["mLink"].split("/")[-1].split("_")[1].replace("%2B", "+")
|
||||
if len(PS) > 0 and arch.lower() not in PS:
|
||||
continue
|
||||
if any(name == B["name"] for B in models):
|
||||
continue
|
||||
models.append({"name": name, "arch": arch})
|
||||
|
||||
models = sorted(models, key=lambda k: (k["arch"], k["name"]))
|
||||
print(json.dumps(models, indent=4))
|
||||
|
||||
if __name__ == "__main__":
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2025 AuxXxilium <https://github.com/AuxXxilium>
|
||||
#
|
||||
# This is free software, licensed under the MIT License.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
import os, click
|
||||
|
||||
WORK_PATH = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
|
||||
@click.group()
|
||||
def cli():
|
||||
"""
|
||||
The CLI is a commands to Arc.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
def mutually_exclusive_options(ctx, param, value):
|
||||
other_option = "file" if param.name == "data" else "data"
|
||||
if value is not None and ctx.params.get(other_option) is not None:
|
||||
raise click.UsageError(f"Illegal usage: `{param.name}` is mutually exclusive with `{other_option}`.")
|
||||
return value
|
||||
|
||||
|
||||
def validate_required_param(ctx, param, value):
|
||||
if not value and "file" not in ctx.params and "data" not in ctx.params:
|
||||
raise click.MissingParameter(param_decls=[param.name])
|
||||
return value
|
||||
|
||||
def __fullversion(ver):
|
||||
out = ver
|
||||
arr = ver.split('-')
|
||||
if len(arr) > 0:
|
||||
a = arr[0].split('.')[0] if len(arr[0].split('.')) > 0 else '0'
|
||||
b = arr[0].split('.')[1] if len(arr[0].split('.')) > 1 else '0'
|
||||
c = arr[0].split('.')[2] if len(arr[0].split('.')) > 2 else '0'
|
||||
d = arr[1] if len(arr) > 1 else '00000'
|
||||
e = arr[2] if len(arr) > 2 else '0'
|
||||
out = '{}.{}.{}-{}-{}'.format(a,b,c,d,e)
|
||||
return out
|
||||
|
||||
@cli.command()
|
||||
@click.option("-p", "--platforms", type=str, help="The platforms of Syno.")
|
||||
def getmodels(platforms=None):
|
||||
"""
|
||||
Get Syno Models.
|
||||
"""
|
||||
import re, json, requests, urllib3
|
||||
from requests.adapters import HTTPAdapter
|
||||
from requests.packages.urllib3.util.retry import Retry # type: ignore
|
||||
|
||||
adapter = HTTPAdapter(max_retries=Retry(total=3, backoff_factor=1, status_forcelist=[500, 502, 503, 504]))
|
||||
session = requests.Session()
|
||||
session.mount("http://", adapter)
|
||||
session.mount("https://", adapter)
|
||||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||
|
||||
PS = platforms.lower().replace(",", " ").split() if platforms else []
|
||||
|
||||
models = []
|
||||
try:
|
||||
url = "http://update7.synology.com/autoupdate/genRSS.php?include_beta=1"
|
||||
#url = "https://update7.synology.com/autoupdate/genRSS.php?include_beta=1"
|
||||
|
||||
req = session.get(url, timeout=10, verify=False)
|
||||
req.encoding = "utf-8"
|
||||
p = re.compile(r"<mUnique>(.*?)</mUnique>.*?<mLink>(.*?)</mLink>", re.MULTILINE | re.DOTALL)
|
||||
|
||||
data = p.findall(req.text)
|
||||
for item in data:
|
||||
if not "DSM" in item[1]:
|
||||
continue
|
||||
arch = item[0].split("_")[1]
|
||||
name = item[1].split("/")[-1].split("_")[1].replace("%2B", "+")
|
||||
if PS and arch.lower() not in PS:
|
||||
continue
|
||||
if not any(m["name"] == name for m in models):
|
||||
models.append({"name": name, "arch": arch})
|
||||
|
||||
models.sort(key=lambda k: (k["arch"], k["name"]))
|
||||
|
||||
except Exception as e:
|
||||
# click.echo(f"Error: {e}")
|
||||
pass
|
||||
|
||||
print(json.dumps(models, indent=4))
|
||||
|
||||
@cli.command()
|
||||
@click.option("-m", "--model", type=str, required=True, help="The model of Syno.")
|
||||
@click.option("-v", "--version", type=str, required=True, help="The version of Syno.")
|
||||
def getpats4mv(model, version):
|
||||
import json, requests, urllib3
|
||||
from requests.adapters import HTTPAdapter
|
||||
from requests.packages.urllib3.util.retry import Retry # type: ignore
|
||||
|
||||
adapter = HTTPAdapter(max_retries=Retry(total=3, backoff_factor=1, status_forcelist=[500, 502, 503, 504]))
|
||||
session = requests.Session()
|
||||
session.mount("http://", adapter)
|
||||
session.mount("https://", adapter)
|
||||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||
|
||||
pats = {}
|
||||
try:
|
||||
urlInfo = "https://www.synology.com/api/support/findDownloadInfo?lang=en-us"
|
||||
urlSteps = "https://www.synology.com/api/support/findUpgradeSteps?"
|
||||
#urlInfo = "https://www.synology.cn/api/support/findDownloadInfo?lang=zh-cn"
|
||||
#urlSteps = "https://www.synology.cn/api/support/findUpgradeSteps?"
|
||||
|
||||
major = f"&major={version.split('.')[0]}" if len(version.split('.')) > 0 else ""
|
||||
minor = f"&minor={version.split('.')[1]}" if len(version.split('.')) > 1 else ""
|
||||
req = session.get(f"{urlInfo}&product={model.replace('+', '%2B')}{major}{minor}", timeout=10, verify=False)
|
||||
req.encoding = "utf-8"
|
||||
data = json.loads(req.text)
|
||||
|
||||
build_ver = data['info']['system']['detail'][0]['items'][0]['build_ver']
|
||||
build_num = data['info']['system']['detail'][0]['items'][0]['build_num']
|
||||
buildnano = data['info']['system']['detail'][0]['items'][0]['nano']
|
||||
V = __fullversion(f"{build_ver}-{build_num}-{buildnano}")
|
||||
if V not in pats:
|
||||
pats[V] = {
|
||||
'url': data['info']['system']['detail'][0]['items'][0]['files'][0]['url'].split('?')[0],
|
||||
'sum': data['info']['system']['detail'][0]['items'][0]['files'][0]['checksum']
|
||||
}
|
||||
|
||||
from_ver = min(I['build'] for I in data['info']['pubVers'])
|
||||
|
||||
for I in data['info']['productVers']:
|
||||
if not I['version'].startswith(version):
|
||||
continue
|
||||
if not major or not minor:
|
||||
majorTmp = f"&major={I['version'].split('.')[0]}" if len(I['version'].split('.')) > 0 else ""
|
||||
minorTmp = f"&minor={I['version'].split('.')[1]}" if len(I['version'].split('.')) > 1 else ""
|
||||
reqTmp = session.get(f"{urlInfo}&product={model.replace('+', '%2B')}{majorTmp}{minorTmp}", timeout=10, verify=False)
|
||||
reqTmp.encoding = "utf-8"
|
||||
dataTmp = json.loads(reqTmp.text)
|
||||
|
||||
build_ver = dataTmp['info']['system']['detail'][0]['items'][0]['build_ver']
|
||||
build_num = dataTmp['info']['system']['detail'][0]['items'][0]['build_num']
|
||||
buildnano = dataTmp['info']['system']['detail'][0]['items'][0]['nano']
|
||||
V = __fullversion(f"{build_ver}-{build_num}-{buildnano}")
|
||||
if V not in pats:
|
||||
pats[V] = {
|
||||
'url': dataTmp['info']['system']['detail'][0]['items'][0]['files'][0]['url'].split('?')[0],
|
||||
'sum': dataTmp['info']['system']['detail'][0]['items'][0]['files'][0]['checksum']
|
||||
}
|
||||
|
||||
for J in I['versions']:
|
||||
to_ver = J['build']
|
||||
reqSteps = session.get(f"{urlSteps}&product={model.replace('+', '%2B')}&from_ver={from_ver}&to_ver={to_ver}", timeout=10, verify=False)
|
||||
if reqSteps.status_code != 200:
|
||||
continue
|
||||
reqSteps.encoding = "utf-8"
|
||||
dataSteps = json.loads(reqSteps.text)
|
||||
for S in dataSteps['upgrade_steps']:
|
||||
if not S.get('full_patch') or not S['build_ver'].startswith(version):
|
||||
continue
|
||||
V = __fullversion(f"{S['build_ver']}-{S['build_num']}-{S['nano']}")
|
||||
if V not in pats:
|
||||
pats[V] = {
|
||||
'url': S['files'][0]['url'].split('?')[0],
|
||||
'sum': S['files'][0]['checksum']
|
||||
}
|
||||
except Exception as e:
|
||||
# click.echo(f"Error: {e}")
|
||||
pass
|
||||
|
||||
pats = {k: pats[k] for k in sorted(pats.keys(), reverse=True)}
|
||||
print(json.dumps(pats, indent=4))
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.option("-p", "--models", type=str, help="The models of Syno.")
|
||||
def getpats(models=None):
|
||||
import re, json, requests, urllib3
|
||||
from bs4 import BeautifulSoup
|
||||
from requests.adapters import HTTPAdapter
|
||||
from requests.packages.urllib3.util.retry import Retry # type: ignore
|
||||
|
||||
adapter = HTTPAdapter(max_retries=Retry(total=3, backoff_factor=1, status_forcelist=[500, 502, 503, 504]))
|
||||
session = requests.Session()
|
||||
session.mount("http://", adapter)
|
||||
session.mount("https://", adapter)
|
||||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||
|
||||
MS = models.lower().replace(",", " ").split() if models else []
|
||||
|
||||
pats = {}
|
||||
try:
|
||||
req = session.get('https://archive.synology.com/download/Os/DSM', timeout=10, verify=False)
|
||||
req.encoding = 'utf-8'
|
||||
bs = BeautifulSoup(req.text, 'html.parser')
|
||||
p = re.compile(r"(.*?)-(.*?)", re.MULTILINE | re.DOTALL)
|
||||
l = bs.find_all('a', string=p)
|
||||
for i in l:
|
||||
ver = i.attrs['href'].split('/')[-1]
|
||||
if not ver.startswith('7'):
|
||||
continue
|
||||
req = session.get(f'https://archive.synology.com{i.attrs["href"]}', timeout=10, verify=False)
|
||||
req.encoding = 'utf-8'
|
||||
bs = BeautifulSoup(req.text, 'html.parser')
|
||||
p = re.compile(r"DSM_(.*?)_(.*?).pat", re.MULTILINE | re.DOTALL)
|
||||
data = bs.find_all('a', string=p)
|
||||
for item in data:
|
||||
rels = p.search(item.attrs['href'])
|
||||
if rels:
|
||||
model, _ = rels.groups()
|
||||
model = model.replace('%2B', '+')
|
||||
if MS and model.lower() not in MS:
|
||||
continue
|
||||
if model not in pats:
|
||||
pats[model] = {}
|
||||
pats[model][__fullversion(ver)] = item.attrs['href']
|
||||
except Exception as e:
|
||||
# click.echo(f"Error: {e}")
|
||||
pass
|
||||
|
||||
print(json.dumps(pats, indent=4))
|
||||
|
||||
@cli.command()
|
||||
@click.option("-p", "--platforms", type=str, help="The platforms of Syno.")
|
||||
def getmodelsoffline(platforms=None):
|
||||
"""
|
||||
Get Syno Models.
|
||||
"""
|
||||
import json
|
||||
import os
|
||||
|
||||
PS = platforms.lower().replace(",", " ").split() if platforms else []
|
||||
|
||||
with open(os.path.join('/mnt/p3/configs', "offline.json")) as user_file:
|
||||
data = json.load(user_file)
|
||||
|
||||
models = []
|
||||
for item in data["channel"]["item"]:
|
||||
if not item["title"].startswith("DSM"):
|
||||
continue
|
||||
for model in item["model"]:
|
||||
arch = model["mUnique"].split("_")[1]
|
||||
name = model["mLink"].split("/")[-1].split("_")[1].replace("%2B", "+")
|
||||
if PS and arch.lower() not in PS:
|
||||
continue
|
||||
if not any(m["name"] == name for m in models):
|
||||
models.append({"name": name, "arch": arch})
|
||||
|
||||
models = sorted(models, key=lambda k: (k["arch"], k["name"]))
|
||||
print(json.dumps(models, indent=4))
|
||||
|
||||
if __name__ == "__main__":
|
||||
cli()
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function genRandomValue() {
|
||||
for i in 0 1 2 3 4 5 6 7 8 9 A B C D E F G H J K L M N P Q R S T V W X Y Z; do
|
||||
echo ${i}
|
||||
done | sort -R | tail -1
|
||||
}
|
||||
Reference in New Issue
Block a user