mirror of
https://github.com/RROrg/rr.git
synced 2025-06-21 05:51:05 +08:00
Detect maxdisks and internalportcfg automatically
This commit is contained in:
parent
6fa3ce03e7
commit
b6bdcdb2d3
4
TODO
4
TODO
@ -1,7 +1,5 @@
|
||||
A fazer
|
||||
- Implementar update do bzimage e ramdisk online
|
||||
- Arrumar detecção de discos/maxdisks. 918 tem só 4 discos e dá problema com proxmox
|
||||
- Melhorar opções de HD, talvez criar um menu a parte
|
||||
|
||||
Concluidos:
|
||||
- Generalizar código dos addons
|
||||
@ -21,5 +19,7 @@ Concluidos:
|
||||
- Verificar se fica legal colocar na config dos modelos os addons obrigatórios como o qjs-dtb *** Usado outra maneira ***
|
||||
- Implementar escolha de maxdisks
|
||||
- Limpar addons quando usuário muda de modelo
|
||||
- Arrumar detecção de discos/maxdisks. 918 tem só 4 discos e dá problema com proxmox
|
||||
- Melhorar opções de HD, talvez criar um menu a parte
|
||||
|
||||
https://kb.synology.com/en-me/DSM/tutorial/What_kind_of_CPU_does_my_NAS_have
|
||||
|
@ -455,23 +455,8 @@ function cmdlineMenu() {
|
||||
done
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Sets variables to configure maxdisks
|
||||
# 1 - Number of disks
|
||||
function setMaxDisks() {
|
||||
SYNOINFO["maxdisks"]="${1}"
|
||||
writeConfigKey "synoinfo.maxdisks" "${1}" "${USER_CONFIG_FILE}"
|
||||
INTPORTCFG=""
|
||||
for I in `seq 1 ${1}`; do INTPORTCFG+="1"; done
|
||||
INTPORTCFG="0x`printf "%x" "$((2#${INTPORTCFG}))"`"
|
||||
SYNOINFO["internalportcfg"]="${INTPORTCFG}"
|
||||
writeConfigKey "synoinfo.internalportcfg" "${INTPORTCFG}" "${USER_CONFIG_FILE}"
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
function synoinfoMenu() {
|
||||
# Read device-tree flag
|
||||
DT="`readModelKey "${MODEL}" "dt"`"
|
||||
# Read synoinfo from user config
|
||||
unset SYNOINFO
|
||||
declare -A SYNOINFO
|
||||
@ -481,9 +466,6 @@ function synoinfoMenu() {
|
||||
|
||||
echo "a \"Add/edit an synoinfo item\"" > "${TMP_PATH}/menu"
|
||||
echo "d \"Delete synoinfo item(s)\"" >> "${TMP_PATH}/menu"
|
||||
if [ "${DT}" != "true" ]; then
|
||||
echo "h \"Change maxdisks\"" >> "${TMP_PATH}/menu"
|
||||
fi
|
||||
echo "s \"Show user synoinfo\"" >> "${TMP_PATH}/menu"
|
||||
echo "m \"Show model/build synoinfo\"" >> "${TMP_PATH}/menu"
|
||||
echo "e \"Exit\"" >> "${TMP_PATH}/menu"
|
||||
@ -530,19 +512,6 @@ function synoinfoMenu() {
|
||||
done
|
||||
DIRTY=1
|
||||
;;
|
||||
h) MODEL_DISKS="`readModelKey "${MODEL}" "disks"`"
|
||||
dialog --backtitle "`backtitle`" --title "Change max of disks" \
|
||||
--inputbox "${MODEL} disks: ${MODEL_DISKS}\nType the desired number of disks (1-26)" 0 0 \
|
||||
2>${TMP_PATH}/resp
|
||||
[ $? -ne 0 ] && continue
|
||||
VALUE="`<"${TMP_PATH}/resp"`"
|
||||
[ -z "${VALUE}" ] && continue
|
||||
if [ ${VALUE} -ge 1 -a ${VALUE} -le 26 ]; then
|
||||
setMaxDisks ${VALUE}
|
||||
else
|
||||
dialog --backtitle "`backtitle`" --msgbox "Invalid number" 0 0
|
||||
fi
|
||||
;;
|
||||
s)
|
||||
ITEMS=""
|
||||
for KEY in ${!SYNOINFO[@]}; do
|
||||
|
@ -62,6 +62,15 @@ while read f; do
|
||||
(cd "${RAMDISK_PATH}" && patch -p1 < "${PATCH_PATH}/${f}") >>"${LOG_FILE}" 2>&1 || dieLog
|
||||
done < <(readModelArray "${MODEL}" "builds.${BUILD}.patch")
|
||||
|
||||
# Temporary workaround
|
||||
DT="`readModelKey "${MODEL}" "dt"`"
|
||||
if [ "${DT}" != "true" ]; then
|
||||
NUMPORTS=$((`ls /sys/class/scsi_host | wc -w`-1))
|
||||
SYNOINFO["maxdisks"]=${NUMPORTS}
|
||||
INTPORTCFG="0x`printf "%x" "$((2**${NUMPORTS}-1))"`"
|
||||
SYNOINFO["internalportcfg"]="${INTPORTCFG}"
|
||||
fi
|
||||
|
||||
# Patch /etc/synoinfo.conf
|
||||
echo -n "."
|
||||
for KEY in ${!SYNOINFO[@]}; do
|
||||
|
Loading…
x
Reference in New Issue
Block a user