forked from freifunk-berlin/falter-packages
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
falter-common: consolidate uci-default files
- Loading branch information
Showing
6 changed files
with
187 additions
and
189 deletions.
There are no files selected for viewing
187 changes: 187 additions & 0 deletions
187
packages/falter-common/files/etc/uci-defaults/falter-defaults
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,187 @@ | ||
#!/bin/sh | ||
|
||
# . /lib/functions/guard.sh | ||
# guard "falter" | ||
|
||
# | ||
# luci-app-ffwizard-falter --> wizarddefaults | ||
# - enable policyrouting | ||
# falter-policyrouting --> freifunk-policyrouting | ||
# falter-berlin-uplink-notunnel --> freifunk-berlin-z95_notunnel | ||
# falter-berlin-uplink-tunnelberlin --> freifunk-berlin-z95_tunnelberlin-tunneldigger | ||
# falter-berlin-migration --> freifunk-berlin-01-migration.sh | ||
# falter-more --> freifunk-berlin-firewall-defaults | ||
# falter-common --> freifunk-berlin-correct-nsm2-txpower | ||
# falter-common --> freifunk-berlin-dhcp-defaults | ||
# falter-common --> freifunk-berlin-ffuplink-defaults | ||
# falter-common --> freifunk-berlin-ffwizard3-json | ||
# falter-common --> freifunk-berlin-freifunk-defaults | ||
# falter-common --> freifunk-berlin-network-defaults | ||
# falter-common --> freifunk-berlin-network-ip-route | ||
# falter-common --> freifunk-berlin-olsrd-defaults | ||
# falter-common --> freifunk-berlin-pingcheck-defaults | ||
# falter-common --> freifunk-berlin-statistics-defaults | ||
# falter-common --> freifunk-berlin-system-defaults | ||
# falter-common --> freifunk-berlin-uhttpd-defaults | ||
# falter-common --> freifunk-berlin-wireless-defaults | ||
# - add hook for /etc/init.d/freifunk-policyrouting restart | ||
# | ||
|
||
|
||
|
||
# quieten down dnsmasq a bit (do not log lease-mgmt) | ||
uci set dhcp.@dnsmasq[0].quietdhcp=1 | ||
|
||
# dnsmasq should not care for 'wan', | ||
# prevents: daemon.warn dnsmasq-dhcp: DHCP packet received on xxx-wan which has no address. | ||
uci add_list dhcp.@dnsmasq[0].notinterface='wan' | ||
|
||
# on IPv6-islands we also should give a default-route to the clients, | ||
# so they can also reach IPv6-neighbours. | ||
uci set dhcp.lan.ra_default=1 | ||
|
||
# add dns entry frei.funk | ||
uci set dhcp.frei_funk=domain | ||
uci set dhcp.frei_funk.name=frei.funk | ||
uci set dhcp.frei_funk.ip=192.168.42.1 | ||
|
||
# add dns entry frei.funk for ipv6 | ||
router_ula=$(uci get network.globals.ula_prefix | sed -e 's/\/48/1/') | ||
uci set dhcp.frei_funk_ipv6=domain | ||
uci set dhcp.frei_funk_ipv6.name=frei.funk | ||
uci set dhcp.frei_funk_ipv6.ip="$router_ula" | ||
|
||
# don't send default-route to clients to prevent them sending pakets | ||
# to us, that we can't forward now | ||
uci add_list dhcp.lan.dhcp_option='3' | ||
|
||
uci commit dhcp | ||
|
||
|
||
|
||
# change default ip to avoid collision with user's local network | ||
uci set network.lan.ipaddr=192.168.42.1 | ||
|
||
WANDEV=$(uci -q get network.wan.device) | ||
echo "$WANDEV" | grep ^br- > /dev/null | ||
BRIDGECHECK=$? | ||
|
||
# setup wan as a bridge | ||
if [ "X${WANDEV}X" = "XX" ]; then | ||
# This device does not have a wan port. Create a wan device without | ||
# a physical port. This makes it easier to change a single | ||
# port device from the client network to wan. This is also needed | ||
# in the case where the user decides to use the "notunnel" variant | ||
NEWDEV=$(uci add network device) | ||
uci set "network.$NEWDEV.type=bridge" | ||
uci set "network.$NEWDEV.name=br-wan" | ||
|
||
# create a wan interface, even if it can't do anything | ||
uci set network.wan=interface | ||
uci set network.wan.device="br-wan" | ||
uci set network.wan.proto="dhcp" | ||
|
||
# create a wan6 interface, even if it can't do anything | ||
uci set network.wan6=interface | ||
uci set network.wan6.device="br-wan" | ||
uci set network.wan6.proto="dhcp6" | ||
|
||
elif [ $BRIDGECHECK = "0" ]; then | ||
# The wan device is a bridge (ex DSA with multiple physical ports) | ||
# everything should be set up fine in this case | ||
: # do nothing | ||
else | ||
# The wan device is not a bridge. Change it to a bridge | ||
NEWDEV=$(uci add network device) | ||
uci set "network.$NEWDEV.type=bridge" | ||
uci set "network.$NEWDEV.name=br-wan" | ||
uci add_list "network.$NEWDEV.ports=$WANDEV" | ||
|
||
uci set network.wan.device="br-wan" | ||
uci set network.wan6.device="br-wan" | ||
fi | ||
|
||
# do not use dns servers provided by dhcp - we maintain a static list of | ||
# dns servers instead | ||
uci set network.wan.peerdns=0 | ||
uci set network.wan6.peerdns=0 | ||
|
||
# add tunl0 interface - tunl0 is the ipip tunnel interface for the olsr | ||
# SmartGateway plugin | ||
uci set network.tunl0=interface | ||
uci set network.tunl0.device=tunl0 | ||
uci set network.tunl0.proto=none | ||
|
||
uci commit network | ||
|
||
|
||
|
||
. /lib/functions/freifunk-berlin-network.sh | ||
|
||
# create ffberlin-uplink file an fill with basic settings | ||
uci import ffberlin-uplink <<EOF | ||
EOF | ||
|
||
uci set ffberlin-uplink.preset=settings | ||
uci set ffberlin-uplink.preset.current="undefined" | ||
uci set ffberlin-uplink.uplink=settings | ||
uci set ffberlin-uplink.uplink.auth=none | ||
uci commit ffberlin-uplink | ||
|
||
create_ffuplink | ||
uci set network.ffuplink.disabled=1 | ||
uci commit network.ffuplink | ||
|
||
echo 120 ffuplink >>/etc/iproute2/rt_tables | ||
|
||
|
||
|
||
mac_addr=$(get_mac_label | cut -c 10-) | ||
|
||
if [ -z "$mac_addr" ]; then | ||
# get propable labels-MAC manually instead | ||
mac_addr=$(ubus call network.device status | sed -n 's/.*macaddr": "\(.*\)".*/\1/p' | | ||
sort | uniq | grep -v "00:00:00:00:00:00" | sed -n '1p' | cut -c 10-) | ||
fi | ||
|
||
if [ -z "$mac_addr" ]; then | ||
# use device name instead | ||
mac_addr=$(board_name | cut -d',' -f2) | ||
fi | ||
|
||
if [ ${#mac_addr} -gt 16 ]; then | ||
# crop it, if string got too long | ||
mac_addr=$(echo "$mac_addr" | cut -c -16) | ||
fi | ||
|
||
ssid="freifunk-setup $mac_addr" | ||
|
||
enable_device() { | ||
local config="$1" | ||
|
||
if [ "$(uci_get wireless "$config" disabled)" = "1" ]; then | ||
uci_set wireless "$config" disabled 0 | ||
fi | ||
} | ||
|
||
modify_ssid() { | ||
local config="$1" | ||
|
||
if [ "$(uci_get wireless "$config" ssid)" = "OpenWrt" ]; then | ||
uci_set wireless "$config" ssid "$ssid" | ||
uci_set wireless "$config" disabled 0 | ||
fi | ||
} | ||
|
||
reset_cb | ||
config_load wireless | ||
config_foreach enable_device wifi-device | ||
|
||
reset_cb | ||
config_load wireless | ||
config_foreach modify_ssid wifi-iface | ||
|
||
uci_commit wireless | ||
|
||
|
||
|
34 changes: 0 additions & 34 deletions
34
packages/falter-common/files/etc/uci-defaults/freifunk-berlin-dhcp-defaults
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
packages/falter-common/files/etc/uci-defaults/freifunk-berlin-ffuplink-defaults
This file was deleted.
Oops, something went wrong.
62 changes: 0 additions & 62 deletions
62
packages/falter-common/files/etc/uci-defaults/freifunk-berlin-network-defaults
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
packages/falter-common/files/etc/uci-defaults/freifunk-berlin-network-ip-route
This file was deleted.
Oops, something went wrong.
63 changes: 0 additions & 63 deletions
63
packages/falter-common/files/etc/uci-defaults/freifunk-berlin-wireless-defaults
This file was deleted.
Oops, something went wrong.