Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
mgqnfoqv7k2w
AutoBuildImmortalWrt
Commits
2ba328a7
Unverified
Commit
2ba328a7
authored
Dec 07, 2024
by
wukongdaily
Committed by
GitHub
Dec 07, 2024
Browse files
Update and rename custom to custom.sh
parent
f4dab6a1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
26 deletions
+38
-26
files/etc/uci-defaults/custom
files/etc/uci-defaults/custom
+0
-26
files/etc/uci-defaults/custom.sh
files/etc/uci-defaults/custom.sh
+38
-0
No files found.
files/etc/uci-defaults/custom
deleted
100644 → 0
View file @
f4dab6a1
#!/bin/sh
# 设置默认wan口防火墙打开 方便虚拟机用户首次访问webui
uci
set
firewall.@zone[1].input
=
'ACCEPT'
uci commit firewall
# 设置主机名映射 解决安卓原生TV首次连不上网的问题
uci add dhcp domain
uci
set
"dhcp.@domain[-1].name=time.android.com"
uci
set
"dhcp.@domain[-1].ip=203.107.6.88"
uci commit dhcp
# 根据网卡数量配置网络
count
=
0
for
iface
in
$(
ls
/sys/class/net |
grep
-v
lo
)
;
do
# 检查是否有对应的设备,并且排除无线网卡
if
[
-e
/sys/class/net/
$iface
/device
]
&&
[[
$iface
==
eth
*
||
$iface
==
en
*
]]
;
then
count
=
$((
count
+
1
))
fi
done
if
[
"
$count
"
-eq
1
]
;
then
# 单个网卡,设置为 DHCP 模式
uci
set
network.lan.proto
=
'dhcp'
uci commit network
elif
[
"
$count
"
-gt
1
]
;
then
# 多个网卡,保持静态 IP
uci
set
network.lan.ipaddr
=
'192.168.100.1'
uci commit network
fi
\ No newline at end of file
files/etc/uci-defaults/custom.sh
0 → 100644
View file @
2ba328a7
#!/bin/sh
# 设置默认防火墙规则,方便虚拟机首次访问 WebUI
uci
set
firewall.@zone[1].input
=
'ACCEPT'
# 设置主机名映射,解决安卓原生 TV 无法联网的问题
uci add dhcp domain
uci
set
"dhcp.@domain[-1].name=time.android.com"
uci
set
"dhcp.@domain[-1].ip=203.107.6.88"
# 根据网卡数量配置网络
count
=
0
for
iface
in
/sys/class/net/
*
;
do
iface_name
=
$(
basename
"
$iface
"
)
# 检查是否为物理网卡(排除回环设备和无线设备)
if
[
-e
"
$iface
/device"
]
&&
echo
"
$iface_name
"
|
grep
-Eq
'^eth|^en'
;
then
count
=
$((
count
+
1
))
fi
done
# 网络设置
if
[
"
$count
"
-eq
1
]
;
then
uci
set
network.lan.proto
=
'dhcp'
elif
[
"
$count
"
-gt
1
]
;
then
uci
set
network.lan.ipaddr
=
'192.168.100.1'
fi
# 设置所有网口可连接 SSH
uci
set
dropbear.@dropbear[0].Interface
=
''
uci commit
# 设置编译作者信息
FILE_PATH
=
"/etc/openwrt_release"
NEW_DESCRIPTION
=
"ImmortalWrt 23.05.4 Compiled by wukongdaily"
sed
-i
"s/DISTRIB_DESCRIPTION='[^']*'/DISTRIB_DESCRIPTION='
$NEW_DESCRIPTION
'/"
"
$FILE_PATH
"
exit
0
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment