IGD3000系列(一体屏)网关的app和文件系统的打包目录
lgq
2025-07-19 5c570ddd7e5b7879149af374de5aa8964ca08ece
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
#!/bin/sh
json="/usr/sbin/jsoner"
file="/work/config.json"
 
subnet_mask_to_cidr() {
    local subnet_mask="$1"
    local cidr=0
 
    # ¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿1¿¿¿
    for octet in $(echo "$subnet_mask" | tr '.' ' '); do
        binary=$(printf "%08d" $(echo "obase=2;$octet" | bc))
        cidr=$((cidr + $(echo -n "$binary" | tr -d '0' | wc -c)))
    done
 
    echo "$cidr"
}
#==================================
#LAN1-ip
#==================================
 
ip=`$json -g $file "eth0.ip"`
mask=`$json -g $file "eth0.mask"`
 
cidr=$(subnet_mask_to_cidr "$mask")
crudini --set   /etc/systemd/network/eth1.network Network Address $ip/$cidr
 
gate=`$json -g $file "eth0.gate"`
echo "$gate"
crudini --set   /etc/systemd/network/eth1.network Route Gateway $gate
route add default gw $gate
 
#=================================
#LAN2-ip
#=================================
 
ip=`$json -g $file "eth1.ip"`
mask=`$json -g $file "eth1.mask"`
 
cidr=$(subnet_mask_to_cidr "$mask")
crudini --set   /etc/systemd/network/eth2.network Network Address $ip/$cidr
 
gate=`$json -g $file "eth1.gate"`
echo "$gate"
crudini --set   /etc/systemd/network/eth2.network Route Gateway $gate
 
#ÉèÖÃ4g
#if [ ${VALID_4G} = "true" ]
#then
#    $start4G &
#fi