-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #592 from freifunk-berlin/tunnelberlin-tunneldigger
add uplink type tunneldigger to the build environment
- Loading branch information
Showing
11 changed files
with
343 additions
and
2 deletions.
There are no files selected for viewing
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
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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,85 @@ | ||
-ppp | ||
-ppp-mod-pppoe | ||
-wpad-mini | ||
wpad | ||
|
||
# Defaults | ||
freifunk-berlin-dhcp-defaults | ||
freifunk-berlin-firewall-defaults | ||
freifunk-berlin-freifunk-defaults | ||
freifunk-berlin-migration | ||
freifunk-berlin-network-defaults | ||
freifunk-berlin-olsrd-defaults | ||
freifunk-berlin-statistics-defaults | ||
freifunk-berlin-system-defaults | ||
freifunk-berlin-uhttpd-defaults | ||
community-profiles | ||
|
||
# Common | ||
mtr | ||
ip | ||
iperf | ||
tmux | ||
vnstat | ||
ethtool | ||
dnsmasq | ||
qos-scripts | ||
firewall | ||
iwinfo | ||
libiwinfo-lua | ||
tcpdump | ||
|
||
# GUI-basics | ||
uhttpd | ||
uhttpd-mod-ubus | ||
px5g-mbedtls | ||
libustream-mbedtls | ||
luci-app-ffwizard-berlin | ||
luci-mod-freifunk-ui | ||
luci-app-olsr | ||
luci-app-firewall | ||
luci-app-olsr-services | ||
luci-app-owm | ||
luci-app-owm-ant | ||
luci-app-owm-cmd | ||
luci-app-owm-gui | ||
luci-theme-bootstrap | ||
# GUI addon | ||
luci-i18n-base-de | ||
luci-i18n-base-en | ||
luci-i18n-firewall-de | ||
luci-i18n-firewall-en | ||
luci-i18n-olsr-de | ||
luci-i18n-olsr-en | ||
luci-i18n-statistics-de | ||
luci-i18n-statistics-en | ||
|
||
# OLSR | ||
olsrd | ||
olsrd-mod-arprefresh | ||
olsrd-mod-dyn-gw | ||
olsrd-mod-jsoninfo | ||
olsrd-mod-txtinfo | ||
olsrd-mod-nameservice | ||
olsrd-mod-watchdog | ||
kmod-ipip | ||
|
||
# BATMAN | ||
kmod-batman-adv | ||
alfred | ||
batctl | ||
|
||
# Uplink | ||
freifunk-berlin-uplink-tunnelberlin-tunneldigger-files | ||
|
||
# Statistics | ||
luci-app-statistics | ||
collectd | ||
collectd-mod-interface | ||
collectd-mod-iwinfo | ||
collectd-mod-network | ||
collectd-mod-olsrd | ||
collectd-mod-rrdtool | ||
collectd-mod-ping | ||
collectd-mod-uptime | ||
collectd-mod-memory |
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,63 @@ | ||
#!/bin/bash | ||
|
||
# This is a custom postinst script that gets run by a (patched) | ||
# ImageBuilder Makefile in the target root after installing OpenWrt | ||
# packages, just before building the SquashFS image. | ||
|
||
echo "Deleting OLSR i18n files..." | ||
rm -vf usr/lib/lua/luci/i18n/olsr.* | ||
|
||
# see https://github.com/freifunk-berlin/firmware/pull/341 & | ||
# https://github.com/freifunk-berlin/firmware/issues/262 | ||
cat > lib/upgrade/freiunk-berlin_no-opkg-info-on-4mb-workaround.sh <<'KEEPLIST' | ||
# check for opkg-conffiles that have changed | ||
# this is a workaround for removing opkg from the image and having something | ||
# similar to "opkg list-changed-conffiles" | ||
add_opkg_fix_conffiles() | ||
{ | ||
local filelist="$1" | ||
# find the separator line (### opkg conffiles ###) and check all files listed there | ||
# it's just the list of conffiles extracted from opkg-/status during image-creation | ||
content_separator_line=`sed -n '/^### opkg conffiles ###/=' /lib/upgrade/freiunk-berlin_no-opkg-info-on-4mb-workaround.sh` | ||
let content_separator_line++ | ||
# iterate over all lines after "separator line" | ||
tail -n +$content_separator_line /lib/upgrade/freiunk-berlin_no-opkg-info-on-4mb-workaround.sh | \ | ||
while read filename; do | ||
file_has_changed ${filename} && echo ${filename} >> $filelist | ||
done | ||
} | ||
file_has_changed() { | ||
if cmp -s "$@" "/rom/$@"; then | ||
return 1 | ||
else | ||
# modified | ||
return 0 | ||
fi | ||
} | ||
sysupgrade_init_conffiles="$sysupgrade_init_conffiles add_opkg_fix_conffiles" | ||
# to exit before going down to the filelist | ||
return 0 | ||
### opkg conffiles ### | ||
KEEPLIST | ||
|
||
# this is run during firmware-image creation | ||
# add all conffiles known to opkg | ||
echo "adding opkg-conffiles to sysupgrade-hook" | ||
for file in `cat usr/lib/opkg/info/*.conffiles`; do | ||
grep ${file} usr/lib/opkg/status | awk '{ print $1 }' >>lib/upgrade/freiunk-berlin_no-opkg-info-on-4mb-workaround.sh | ||
done | ||
|
||
echo "deleting opkg status-files ..." | ||
rm -rf usr/lib/opkg | ||
rm -rf etc/opkg* | ||
# as this will be included into image for some reason, even it's | ||
# not listed for inclusion | ||
echo "manually removing usign ..." | ||
rm usr/bin/usign | ||
rm usr/bin/signify |
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,50 @@ | ||
-kmod-usb-core | ||
-kmod-usb2 | ||
-kmod-ledtrig-usbdev | ||
-kmod-usb-ohci | ||
-kmod-ppp | ||
-kmod-usb-serial | ||
-ppp | ||
-ppp-mod-pppoe | ||
-wpad | ||
-opkg | ||
-usign | ||
|
||
# Defaults | ||
freifunk-berlin-dhcp-defaults | ||
freifunk-berlin-firewall-defaults | ||
freifunk-berlin-freifunk-defaults | ||
freifunk-berlin-migration | ||
freifunk-berlin-network-defaults | ||
freifunk-berlin-olsrd-defaults | ||
freifunk-berlin-system-defaults | ||
community-profiles | ||
|
||
# Common | ||
dnsmasq | ||
qos-scripts | ||
firewall | ||
iwinfo | ||
libiwinfo-lua | ||
|
||
# GUI | ||
uhttpd | ||
uhttpd-mod-ubus | ||
luci-app-ffwizard-berlin | ||
luci-mod-freifunk-ui | ||
luci-app-olsr | ||
luci-app-olsr-services | ||
luci-app-owm | ||
luci-app-owm-cmd | ||
luci-theme-bootstrap | ||
|
||
# OLSR | ||
olsrd | ||
olsrd-mod-arprefresh | ||
olsrd-mod-dyn-gw | ||
olsrd-mod-jsoninfo | ||
olsrd-mod-nameservice | ||
kmod-ipip | ||
|
||
# Uplink | ||
freifunk-berlin-uplink-tunnelberlin-tunneldigger-files |
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,141 @@ | ||
--- a/feeds/gluon/net/tunneldigger/files/tunneldigger.init | ||
+++ b/feeds/gluon/net/tunneldigger/files/tunneldigger.init | ||
@@ -8,72 +8,80 @@ PIDPATH=/var/run | ||
tunnel_id=1 | ||
|
||
missing() { | ||
- echo "Not starting tunneldigger - missing $1" >&2 | ||
+ echo "Not starting tunneldigger \"$1\" - missing $2" >&2 | ||
} | ||
|
||
-config_cb() { | ||
- local cfg="$CONFIG_SECTION" | ||
- config_get configname "$cfg" TYPE | ||
- case "$configname" in | ||
- broker) | ||
- config_get_bool enabled "$cfg" enabled 1 | ||
- config_get addresses "$cfg" address | ||
- config_get uuid "$cfg" uuid | ||
- config_get interface "$cfg" interface | ||
- config_get group "$cfg" group | ||
- config_get limit_bw_down "$cfg" limit_bw_down | ||
- config_get hook_script "$cfg" hook_script | ||
- config_get bind_interface "$cfg" bind_interface | ||
- config_get broker_selection "$cfg" broker_selection | ||
+handle_td() { | ||
+ local cfg=$1 | ||
+ local enabled | ||
+ local addresses | ||
+ local uuid | ||
+ local interface | ||
+ local group | ||
+ local limit_bw_down | ||
+ local hook_script | ||
+ local bind_interface | ||
+ local broker_selection | ||
+ | ||
+ | ||
+ config_get_bool enabled "$cfg" enabled 1 | ||
+ config_get addresses "$cfg" address | ||
+ config_get uuid "$cfg" uuid | ||
+ config_get interface "$cfg" interface | ||
+ config_get group "$cfg" group | ||
+ config_get limit_bw_down "$cfg" limit_bw_down | ||
+ config_get hook_script "$cfg" hook_script | ||
+ config_get bind_interface "$cfg" bind_interface | ||
+ config_get broker_selection "$cfg" broker_selection | ||
|
||
- [ $enabled -eq 0 ] && return | ||
+ [ $enabled -eq 0 ] && return | ||
|
||
- local broker_opts="" | ||
- for address in $addresses; do | ||
- append broker_opts "-b ${address}" | ||
- done | ||
- | ||
- [ ! -z "${limit_bw_down}" ] && append broker_opts "-L ${limit_bw_down}" | ||
- [ ! -z "${hook_script}" ] && append broker_opts "-s ${hook_script}" | ||
- [ ! -z "${bind_interface}" ] && { | ||
- # Resolve logical interface name. | ||
- unset _bind_interface | ||
- network_get_device _bind_interface "${bind_interface}" || _bind_interface="${bind_interface}" | ||
- append broker_opts "-I ${_bind_interface}" | ||
- } | ||
- [ ! -z "${broker_selection}" ] && { | ||
- # Set broker selection. | ||
- case "${broker_selection}" in | ||
- usage) | ||
- append broker_opts "-a" | ||
- ;; | ||
- first) | ||
- append broker_opts "-g" | ||
- ;; | ||
- random) | ||
- append broker_opts "-r" | ||
- ;; | ||
- esac | ||
- } | ||
- | ||
- if [ -z "$uuid" ]; then | ||
- missing uuid | ||
- return | ||
- elif [ -z "$interface" ]; then | ||
- missing interface | ||
- return | ||
- fi | ||
- | ||
- echo "Starting tunneldigger on ${interface}" | ||
- /sbin/start-stop-daemon -S -q -b -m -c root:${group} -p ${PIDPATH}/tunneldigger.${interface}.pid -x /usr/bin/tunneldigger -- -u ${uuid} -i ${interface} -t ${tunnel_id} ${broker_opts} | ||
- | ||
- let tunnel_id++ | ||
- ;; | ||
- esac | ||
+ local broker_opts="" | ||
+ local address | ||
+ for address in $addresses; do | ||
+ append broker_opts "-b ${address}" | ||
+ done | ||
+ | ||
+ [ ! -z "${limit_bw_down}" ] && append broker_opts "-L ${limit_bw_down}" | ||
+ [ ! -z "${hook_script}" ] && append broker_opts "-s ${hook_script}" | ||
+ [ ! -z "${bind_interface}" ] && { | ||
+ # Resolve logical interface name. | ||
+ unset _bind_interface | ||
+ network_get_device _bind_interface "${bind_interface}" || _bind_interface="${bind_interface}" | ||
+ append broker_opts "-I ${_bind_interface}" | ||
+ } | ||
+ [ ! -z "${broker_selection}" ] && { | ||
+ # Set broker selection. | ||
+ case "${broker_selection}" in | ||
+ usage) | ||
+ append broker_opts "-a" | ||
+ ;; | ||
+ first) | ||
+ append broker_opts "-g" | ||
+ ;; | ||
+ random) | ||
+ append broker_opts "-r" | ||
+ ;; | ||
+ esac | ||
+ } | ||
+ | ||
+ if [ -z "$uuid" ]; then | ||
+ missing $cfg uuid | ||
+ return | ||
+ elif [ -z "$interface" ]; then | ||
+ missing $cfg interface | ||
+ return | ||
+ fi | ||
+ | ||
+ echo "Starting tunneldigger \"$cfg\" on ${interface}" | ||
+ /sbin/start-stop-daemon -S -q -b -m -c root:${group} -p ${PIDPATH}/tunneldigger.${interface}.pid -x /usr/bin/tunneldigger -- -u ${uuid} -i ${interface} -t ${tunnel_id} ${broker_opts} | ||
+ | ||
+ let tunnel_id++ | ||
} | ||
|
||
start() { | ||
config_load tunneldigger | ||
+ config_foreach handle_td broker | ||
} | ||
|
||
stop() { |
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