This commit is contained in:
jeka
2023-12-15 15:53:58 +05:00
parent 6dad25656a
commit a14d86f0bd
5 changed files with 1191 additions and 41 deletions

View File

@@ -1,26 +0,0 @@
uci -q batch << EOI
set network.lan.ipaddr='192.168.47.6'
commit network
set system.@system[0].zonename='Asia/Yekaterinburg'
set system.@system[0].hostname='gw-aramil'
commit system
set dropbear.@dropbear[0].PasswordAuth="1"
commit dropbear
set system.@system[0].timezone='<+05>-5'
set system.ntp.enable_server='1'
set system.ntp.interface='lan'
commit timeserver
set uhttpd.main.listen_http='0.0.0.0:8080' '[::]:8080'
set uhttpd.main.listen_https='0.0.0.0:4431' '[::]:4431'
commit uhttpd
set dhcp.lan.ignore='1'
set dhcp.@host[0]=host
set dhcp.@host[0].name='kyocera1'
set dhcp.@host[0].ip='192.168.47.30'
set dhcp.@host[0].mac='00:17:C8:76:43:91'
set dhcp.@host[1]=host
set dhcp.@host[1].name='kyocera0'
set dhcp.@host[1].mac='00:17:C8:42:1C:AA'
set dhcp.@host[1].ip='192.168.47.31'
commit dhcp
EOI

View File

@@ -1,15 +0,0 @@
#!/bin/sh
[ "$(uci -q get system.@system[0].init)" = "" ] && exit 0
[ -e /etc/init ] && exit 0
touch /etc/init
uci batch <<EOC
set system.@system[0].init='initiated'
commit
EOC
/usr/bin/passwd root <<EOP
AsD7fg
AsD7fg
EOP
exit 0 # IMPORTANT, IF WE NO PUT THIS, WILL EXECUTED ENDLESSLY

View File

@@ -0,0 +1,99 @@
# Beware! This script will be in /rom/etc/uci-defaults/ as part of the image.
# Uncomment lines to apply:
wlan_name="office"
wlan_password="fuckingwep"
root_password="AsD7fg"
lan_ip_address="192.168.77.4"
hostname="gw-elmash"
# dhcp server 1 disable, 0 enable
dhcpsrv="1"
# log potential errors
exec >/tmp/setup.log 2>&1
if [ -n "$root_password" ]; then
(echo "$root_password"; sleep 1; echo "$root_password") | passwd > /dev/null
fi
# Configure LAN
# More options: https://openwrt.org/docs/guide-user/base-system/basic-networking
if [ -n "$lan_ip_address" ]; then
uci set network.lan.ipaddr="$lan_ip_address"
uci commit network
fi
# Configure WLAN
# More options: https://openwrt.org/docs/guide-user/network/wifi/basic#wi-fi_interfaces
if [ -n "$wlan_name" -a -n "$wlan_password" -a ${#wlan_password} -ge 8 ]; then
uci set wireless.@wifi-device[0].disabled='0'
uci set wireless.@wifi-device[0].channel='11'
uci set wireless.@wifi-device[0].txpower='15'
uci set wireless.@wifi-device[0].disabled='0'
uci set wireless.@wifi-device[0].country='RU'
uci set wireless.@wifi-iface[0].mode='ap'
uci set wireless.@wifi-iface[0].encryption='psk2'
uci set wireless.@wifi-iface[0].ssid="$wlan_name"
uci set wireless.@wifi-iface[0].key="$wlan_password"
#uci set wireless.@wifi-iface[0].macfilter='allow'
#uci add_list wireless.@wifi-iface[0].maclist=''
uci commit wireless
fi
# Configure system
uci set system.@system[0].hostname="$hostname"
uci set system.@system[0].timezone='<+05>-5'
uci set system.ntp.enable_server='1'
uci set system.ntp.interface='lan'
uci set system.@system[0].zonename='Asia/Yekaterinburg
commit system
/etc/init.d/system restart
# Configure ssh dropbear
uci set dropbear.@dropbear[0].PasswordAuth="1"
#uci set dropbear.@dropbear[0].GatewayPorts='on'
commit dropbear
/etc/init.d/dropbear restart
# Configure uhttpd
uci set uhttpd.main.listen_http='0.0.0.0:8080'
uci set uhttpd.main.listen_https='0.0.0.0:4431'
commit uhttpd
/etc/init.d/uhttpd restart
# DHCP server on/off
uci set dhcp.lan.ignore="$dhcpsrv"
uci add host
uci set dhcp.@host[-1].name='jeka-office'
uci set dhcp.@host[-1].mac=''4c:cc:6a:01:5d:30'
uci set dhcp.@host[-1].ip='192.168.77.35'
uci add host
uci set dhcp.@host[-1].name='fs1370dn'
uci set dhcp.@host[-1].mac='00:C0:EE:9E:01:55'
uci set dhcp.@host[-1].ip='192.168.77.33'
uci add host
uci set dhcp.@host[-1].name='kyoceraigor'
uci set dhcp.@host[-1].mac='00:17:C8:21:A7:F2'
uci set dhcp.@host[-1].ip='192.168.77.30'
uci add host
uci set dhcp.@host[-1].name='kyocerascanner'
uci set dhcp.@host[-1].mac='00:C0:EE:BB:85:2C'
uci set dhcp.@host[-1].ip='192.168.77.31'
uci add host
uci set dhcp.@host[-1].name='natasha-office'
uci set dhcp.@host[-1].mac='50:46:5D:09:D0:69'
uci set dhcp.@host[-1].ip='192.168.77.36'
uci add host
uci set dhcp.@host[-1].name='klipper'
uci set dhcp.@host[-1].mac='B8:27:EB:B9:82:6D'
uci set dhcp.@host[-1].ip='192.168.77.44'
uci commit dhcp
/etc/init.d/dnsmasq restart
# Configure network
/etc/init.d/network restart
# Configure firewall
/etc/init.d/firewall restart
echo "All done!"