mirror of
https://github.com/RROrg/rr.git
synced 2025-06-21 05:51:05 +08:00
优化 boot.sh 和 functions.sh 中的配置处理逻辑
This commit is contained in:
parent
0f332893c1
commit
c7299b8158
@ -142,15 +142,34 @@ declare -A CMDLINE
|
||||
CMDLINE['syno_hw_version']="${MODELID:-${MODEL}}"
|
||||
CMDLINE['vid']="${VID:-"0x46f4"}" # Sanity check
|
||||
CMDLINE['pid']="${PID:-"0x0001"}" # Sanity check
|
||||
|
||||
if [ -z "${SN}" ]; then
|
||||
SN="$(generateSerial "${MODEL}")"
|
||||
writeConfigKey "sn" "${SN}" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
CMDLINE['sn']="${SN}"
|
||||
|
||||
CMDLINE['netif_num']="0"
|
||||
[ -z "${MAC1}" ] && [ -n "${MAC2}" ] && {
|
||||
if [ -z "${MAC1}" ]; then
|
||||
if [ -n "${MAC2}" ]; then
|
||||
MAC1=${MAC2}
|
||||
MAC2=""
|
||||
} # Sanity check
|
||||
[ -n "${MAC1}" ] && CMDLINE['mac1']="${MAC1}" && CMDLINE['netif_num']="1"
|
||||
[ -n "${MAC2}" ] && CMDLINE['mac2']="${MAC2}" && CMDLINE['netif_num']="2"
|
||||
writeConfigKey "mac1" "${MAC1}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "mac2" "${MAC2}" "${USER_CONFIG_FILE}"
|
||||
CMDLINE['mac1']="${MAC1}"
|
||||
CMDLINE['netif_num']="0"
|
||||
else
|
||||
NETIF_NUM=2
|
||||
MACS="$(generateMacAddress "${MODEL}" ${NETIF_NUM})"
|
||||
for I in $(seq 1 ${NETIF_NUM}); do
|
||||
eval MAC${I}="$(echo ${MACS} | cut -d' ' -f${I})"
|
||||
writeConfigKey "mac${I}" "$(echo ${MACS} | cut -d' ' -f${I})" "${USER_CONFIG_FILE}"
|
||||
done
|
||||
CMDLINE['mac1']="${MAC1}"
|
||||
CMDLINE['mac2']="${MAC2}"
|
||||
CMDLINE['netif_num']="${NETIF_NUM}"
|
||||
fi
|
||||
fi
|
||||
|
||||
CMDLINE['skip_vender_mac_interfaces']="$(seq -s, 0 $((${CMDLINE['netif_num']:-1} - 1)))"
|
||||
|
||||
# set fixed cmdline
|
||||
|
@ -34,10 +34,11 @@ function checkBootLoader() {
|
||||
# Check if loader is fully configured
|
||||
# Returns 1 if not
|
||||
function loaderIsConfigured() {
|
||||
SN="$(readConfigKey "sn" "${USER_CONFIG_FILE}")"
|
||||
[ -z "${SN}" ] && return 1
|
||||
[ ! -f "${MOD_ZIMAGE_FILE}" ] && return 1
|
||||
[ ! -f "${MOD_RDGZ_FILE}" ] && return 1
|
||||
[ -z "$(readConfigKey "zimage-hash" "${USER_CONFIG_FILE}")" ] && return 1
|
||||
[ -z "$(readConfigKey "ramdisk-hash" "${USER_CONFIG_FILE}")" ] && return 1
|
||||
|
||||
return 0 # OK
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ while IFS=': ' read -r KEY VALUE; do
|
||||
[ -n "${KEY}" ] && MODULES["${KEY}"]="${VALUE}"
|
||||
done <<<"$(readConfigMap "modules" "${USER_CONFIG_FILE}")"
|
||||
|
||||
SYNOINFO["SN"]="${SN}"
|
||||
# SYNOINFO["SN"]="${SN}"
|
||||
while IFS=': ' read -r KEY VALUE; do
|
||||
[ -n "${KEY}" ] && SYNOINFO["${KEY}"]="${VALUE}"
|
||||
done <<<"$(readConfigMap "synoinfo" "${USER_CONFIG_FILE}")"
|
||||
@ -146,7 +146,6 @@ chmod +x "${RAMDISK_PATH}/addons/addons.sh"
|
||||
for ADDON in "redpill" "revert" "misc" "eudev" "disks" "localrss" "notify" "wol"; do
|
||||
PARAMS=""
|
||||
if [ "${ADDON}" = "disks" ]; then
|
||||
PARAMS=${HDDSORT}
|
||||
[ -f "${USER_UP_PATH}/model.dts" ] && cp -f "${USER_UP_PATH}/model.dts" "${RAMDISK_PATH}/addons/model.dts"
|
||||
[ -f "${USER_UP_PATH}/${MODEL}.dts" ] && cp -f "${USER_UP_PATH}/${MODEL}.dts" "${RAMDISK_PATH}/addons/model.dts"
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user