forked from grayearth/BuildAuto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init-settings.sh
100 lines (77 loc) · 2.32 KB
/
init-settings.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash
# Set default theme to luci-theme-argon
# uci set luci.main.mediaurlbase='/luci-static/argon'
# uci commit luci
# Disable opkg signature check
sed -i 's/option check_signature/# option check_signature/g' /etc/opkg.conf
# Disable IPV6 ula prefix
# sed -i 's/^[^#].*option ula/#&/' /etc/config/network
# Check file system during boot
uci set fstab.@global[0].check_fs=1
uci commit fstab
# Disable dns rebind protection
uci set dhcp.@dnsmasq[0].rebind_protection=0
# Set dhcp config
uci set dhcp.@domain[-1].nname='phicomm.com'
uci set dhcp.@domain[-1].nip='172.16.252.10'
uci set dhcp.@domain[-1].ncomments='Phicomm'
uci set dhcp.@domain[-1].nname='aircat.phicomm.com'
uci set dhcp.@domain[-1].nip='172.16.252.10'
uci set dhcp.@domain[-1].ncomments='Phicomm M1'
uci set dhcp.@domain[-1].nname='phiclouds.phicomm.com'
uci set dhcp.@domain[-1].nip='172.16.252.10'
uci set dhcp.@domain[-1].ncomments='Phicomm M1'
uci commit dhcp
# Set init network config
cat <<'EOF'> /etc/config/network
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
option ula_prefix 'fdd0:fb32:9b0c::/48'
option packet_steering '1'
config interface 'lan'
option type 'bridge'
option proto 'static'
option netmask '255.255.255.0'
option ifname 'eth0 eth1 eth2 eth3'
option stp '1'
option ipaddr '172.16.252.1'
option gateway '172.16.252.1'
option broadcast '172.16.252.255'
option dns '172.16.252.1'
config interface 'wan'
option proto 'dhcp'
option ifname 'eth4'
config interface 'vpn'
option ifname 'tun0'
option proto 'none'
EOF
# Set backup dirs
cat <<'EOF'> /etc/sysupgrade.conf
## This file contains files and directories that should be preserved during an upgrade.
/data/
/etc/openvpn/
EOF
# Add "/etc/rc.local" script
cat <<'EOF'> /etc/rc.local
#!/bin/bash
PATH=/usr/sbin:/usr/bin:/sbin:/bin
ROOTFS_DISK=$(mount | grep -w '/' | grep 'ro' | awk {'print $1'})
if [ ${ROOTFS_DISK} ] ; then
fsck.ext4 -y ${ROOTFS_DISK}
mount -o remount rw /
fi
if [ -b "/dev/sdb1" ]; then
mkdir -p /data
umount /dev/sdb1
mount /dev/sdb1 /data
fi
if [ -f "/data/start.sh" ]; then
/bin/bash /data/start.sh
fi
exit 0
EOF
exit 0