When there is no custom macs, remove the incoming data in cmdline.

This commit is contained in:
Ing 2023-05-27 11:48:32 +08:00
parent 57a18d9dae
commit 0b344ac8af
4 changed files with 56 additions and 41 deletions

View File

@ -60,7 +60,7 @@ fi
declare -A CMDLINE
# Fixed values
CMDLINE['netif_num']=0
#CMDLINE['netif_num']=0
# Automatic values
CMDLINE['syno_hw_version']="${MODEL}"
[ -z "${VID}" ] && VID="0x0000" # Sanity check
@ -97,22 +97,25 @@ for N in `seq 1 8`; do # Currently, only up to 8 are supported. (<==> menu.sh
[ -n "${CMDLINE["mac${N}"]}" ] && MACS+=(${CMDLINE["mac${N}"]})
done
NETIF_NUM=${#MACS[*]}
# set netif_num to custom mac amount, netif_num must be equal to the MACX amount, otherwise the kernel will panic.
CMDLINE["netif_num"]=${NETIF_NUM} # The current original CMDLINE['netif_num'] is no longer in use, Consider deleting.
# real network cards amount
NETRL_NUM=`ls /sys/class/net/ | grep eth | wc -l`
if [ ${NETIF_NUM} -le ${NETRL_NUM} ]; then
echo -e "\033[1;33m*** `printf "$(TEXT "Detected %s network cards, but only %s MACs were customized, the rest will use the original MACs.")" "${NETRL_NUM}" "${CMDLINE["netif_num"]}"` ***\033[0m"
ETHX=(`ls /sys/class/net/ | grep eth`) # real network cards list
for N in `seq $(expr ${NETIF_NUM} + 1) ${NETRL_NUM}`; do
MACR="`cat /sys/class/net/${ETHX[$(expr ${N} - 1)]}/address | sed 's/://g'`"
# no duplicates
while [[ "${MACS[*]}" =~ "$MACR" ]]; do # no duplicates
MACR="${MACR:0:10}`printf "%02x" $((0x${MACR:10:2} + 1))`"
NETRL_NUM=`ls /sys/class/net/ | grep eth | wc -l` # real network cards amount
if [ ${NETIF_NUM} -eq 0 ]; then
echo -e "\033[1;33m*** `printf "$(TEXT "Detected %s network cards, but No MACs were customized, they will use the original MACs.")" "${NETRL_NUM}"` ***\033[0m"
else
# set netif_num to custom mac amount, netif_num must be equal to the MACX amount, otherwise the kernel will panic.
CMDLINE["netif_num"]=${NETIF_NUM} # The current original CMDLINE['netif_num'] is no longer in use, Consider deleting.
if [ ${NETIF_NUM} -le ${NETRL_NUM} ]; then
echo -e "\033[1;33m*** `printf "$(TEXT "Detected %s network cards, but only %s MACs were customized, the rest will use the original MACs.")" "${NETRL_NUM}" "${CMDLINE["netif_num"]}"` ***\033[0m"
ETHX=(`ls /sys/class/net/ | grep eth`) # real network cards list
for N in `seq $(expr ${NETIF_NUM} + 1) ${NETRL_NUM}`; do
MACR="`cat /sys/class/net/${ETHX[$(expr ${N} - 1)]}/address | sed 's/://g'`"
# no duplicates
while [[ "${MACS[*]}" =~ "$MACR" ]]; do # no duplicates
MACR="${MACR:0:10}`printf "%02x" $((0x${MACR:10:2} + 1))`"
done
CMDLINE["mac${N}"]="${MACR}"
done
CMDLINE["mac${N}"]="${MACR}"
done
CMDLINE["netif_num"]=${NETRL_NUM}
CMDLINE["netif_num"]=${NETRL_NUM}
fi
fi
# Prepare command line

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-05-22 13:55+0800\n"
"POT-Creation-Date: 2023-05-27 11:44+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -63,49 +63,55 @@ msgid ""
"The current version of arpl does not support booting %s-%s, please rebuild."
msgstr ""
#: boot.sh:105
#: boot.sh:102
msgid ""
"Detected %s network cards, but No MACs were customized, they will use the "
"original MACs."
msgstr ""
#: boot.sh:107
msgid ""
"Detected %s network cards, but only %s MACs were customized, the rest will "
"use the original MACs."
msgstr ""
#: boot.sh:135
#: boot.sh:138
msgid "Cmdline:\\n"
msgstr ""
#: boot.sh:140
#: boot.sh:143
msgid "Reboot to boot directly in DSM"
msgstr ""
#: boot.sh:146 init.sh:175
#: boot.sh:149 init.sh:175
msgid "Detected %s network cards, Waiting IP."
msgstr ""
#: boot.sh:152 init.sh:181
#: boot.sh:155 init.sh:181
msgid "DOWN"
msgstr ""
#: boot.sh:156 init.sh:185
#: boot.sh:159 init.sh:185
msgid "ERROR"
msgstr ""
#: boot.sh:162
#: boot.sh:165
msgid "Access \\033[1;34mhttp://%s:5000\\033[0m to connect the DSM via web."
msgstr ""
#: boot.sh:171
#: boot.sh:174
msgid "Loading DSM kernel..."
msgstr ""
#: boot.sh:175
#: boot.sh:178
msgid "Warning, running kexec with --noefi param, strange things will happen!!"
msgstr ""
#: boot.sh:180
#: boot.sh:183
msgid "Booting..."
msgstr ""
#: boot.sh:183
#: boot.sh:186
msgid ""
"[This interface will not be operational. Please use the http://find.synology."
"com/ find DSM and connect.]"

View File

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: arpl-i18n\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-05-22 13:55+0800\n"
"PO-Revision-Date: 2023-05-22 13:56+0800\n"
"POT-Creation-Date: 2023-05-27 11:44+0800\n"
"PO-Revision-Date: 2023-05-27 11:45+0800\n"
"Last-Translator: ing <wjz304@qq.com>\n"
"Language-Team: Chinese (simplified) <i18n-zh@googlegroups.com>\n"
"Language: zh_CN\n"
@ -62,49 +62,55 @@ msgid ""
"The current version of arpl does not support booting %s-%s, please rebuild."
msgstr "当前版本的arpl不支持引导 %s-%s, 请重新编译."
#: boot.sh:105
#: boot.sh:102
msgid ""
"Detected %s network cards, but No MACs were customized, they will use the "
"original MACs."
msgstr "检测到 %s 个网卡, 但是没有自定义 MACs, 它们将使用自身 MACs."
#: boot.sh:107
msgid ""
"Detected %s network cards, but only %s MACs were customized, the rest will "
"use the original MACs."
msgstr "检测到 %s 个网卡, 但是仅自定义了 %s 个 MACs, 其他网卡将使用自身 MACs."
#: boot.sh:135
#: boot.sh:138
msgid "Cmdline:\\n"
msgstr "Cmdline:\\n"
#: boot.sh:140
#: boot.sh:143
msgid "Reboot to boot directly in DSM"
msgstr "重启并直接进入DSM引导"
#: boot.sh:146 init.sh:175
#: boot.sh:149 init.sh:175
msgid "Detected %s network cards, Waiting IP."
msgstr "检测到 %s 个网卡, 获取 IP."
#: boot.sh:152 init.sh:181
#: boot.sh:155 init.sh:181
msgid "DOWN"
msgstr "卸载"
#: boot.sh:156 init.sh:185
#: boot.sh:159 init.sh:185
msgid "ERROR"
msgstr "错误"
#: boot.sh:162
#: boot.sh:165
msgid "Access \\033[1;34mhttp://%s:5000\\033[0m to connect the DSM via web."
msgstr "在浏览器中访问 \\033[1;34mhttp://%s:5000\\033[0m 链接 DSM."
#: boot.sh:171
#: boot.sh:174
msgid "Loading DSM kernel..."
msgstr "加载 DSM kernel..."
#: boot.sh:175
#: boot.sh:178
msgid "Warning, running kexec with --noefi param, strange things will happen!!"
msgstr "警告, 使用'--noefi'参数运行'kexec', 可能有不好的事情发生!!"
#: boot.sh:180
#: boot.sh:183
msgid "Booting..."
msgstr "引导中..."
#: boot.sh:183
#: boot.sh:186
msgid ""
"[This interface will not be operational. Please use the http://find.synology."
"com/ find DSM and connect.]"