Commit b1b259b4 authored by nanahira's avatar nanahira

support custom things

parent 105c24a0
......@@ -22,14 +22,14 @@ replace_ip() {
# 检查 $INPUT 是否包含点
if [[ "$INPUT" == *.* ]]; then
IFS='.' read -r -a INPUT_PARTS <<< "$INPUT"
PART_COUNT=${#INPUT_PARTS[@]}
PART_COUNT=${{'{#'}}INPUT_PARTS[@]}
# 如果有 4 个或以上的部分,那么这是一个完整的 IP 地址,直接返回
if [[ $PART_COUNT -ge 4 ]]; then
echo "$INPUT"
else
# 根据 PART_COUNT,补全 IP 地址
AWK_SCRIPT='{print '
for ((i = 0; i < $((4 - PART_COUNT)); i++)); do
AWK_SCRIPT="${AWK_SCRIPT}\$$((i + 1))"
if [[ $i -lt 3 ]]; then
......
......@@ -15,6 +15,10 @@ iface lo inet loopback
auto {{link.name}}
iface {{link.name}} inet manual
iface {{link.name}} inet6 manual
{% if link.interfaces_custom is defined and link.interfaces_custom %}
### custom
{{link.interfaces_custom}}
{% endif %}
{% endfor %}
{% endif %}
......@@ -53,6 +57,10 @@ bond-updelay 200
bond-lacp-rate fast
bond-xmit-hash-policy {{ bond.hash_policy | default('layer2+3') }}
{% endif %}
{% if bond.interfaces_custom is defined and bond.interfaces_custom %}
### custom
{{bond.interfaces_custom}}
{% endif %}
{% endfor %}
......@@ -144,6 +152,11 @@ provider ppp{{ppp.id}}
# end PPPs
{% endif %}
{% if interfaces_custom is defined and interfaces_custom %}
### custom
{{interfaces_custom}}
{% endif %}
# end MyCard NextGen Router config file
source /etc/network/interfaces.d/*
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment