buildscript: support community files with templates

Signed-off-by: Tim Niemeyer <tim.niemeyer@mastersword.de>
This commit is contained in:
Tim Niemeyer 2013-09-14 00:09:35 +02:00
parent fe192d9a21
commit 8329a1fbfd
23 changed files with 117 additions and 349 deletions

View File

@ -7,7 +7,7 @@ config 'script'
config 'api'
option 'ipv4_address' '1'
option 'ipv6_interface' 'br-mesh'
option 'ipv6_address' 'fe80::201:2ff:fe03:405'
option 'ipv6_address' '${NETMON_IP}'
option 'timeout' '5'
option 'retry' '5'
option 'api_key' '1'
@ -21,4 +21,4 @@ config 'crawl'
option 'update_hash' '1'
config 'netmon'
option 'autoadd_ipv6_address' '1'
option 'autoadd_ipv6_address' '1'

View File

@ -1,23 +0,0 @@
config 'wifi-device' 'wifi0'
option 'type' 'atheros'
option 'disabled' '0'
option 'channel' '6'
option 'bgscan' '0'
option 'diversity' '1'
option 'hwmode' '11g'
config 'wifi-iface'
option 'device' 'wifi0'
option 'network' 'wlanmesh'
option 'mode' 'adhoc'
option 'ssid' 'batman.oldenburg.freifunk.net'
option 'bssid' '02:CA:FF:EE:BA:BE'
option 'encryption' 'none'
option 'hidden' '1'
config 'wifi-iface'
option 'device' 'wifi0'
option 'network' 'mesh'
option 'mode' 'ap'
option 'ssid' 'oldenburg.freifunk.net'
option 'encryption' 'none'

View File

@ -1,6 +1,6 @@
config wifi-device radio0
option type mac80211
option channel 6
option channel ${BATMAN_CHANNEL}
option phy phy0
option hwmode 11ng
@ -8,8 +8,8 @@ config wifi-iface
option device radio0
option network wlanmesh
option mode adhoc
option bssid '02:CA:FF:EE:BA:BE'
option ssid 'batman.oldenburg.freifunk.net'
option bssid '${BSSID_MESH}'
option ssid '${ESSID_MESH}'
option mcast_rate 6000
# option bintval 1000
option 'encryption' 'none'
@ -19,5 +19,5 @@ config wifi-iface
option device radio0
option network mesh
option mode ap
option ssid 'oldenburg.freifunk.net'
option ssid '${ESSID_AP}'
option 'encryption' 'none'

View File

@ -3,7 +3,11 @@
SERVER="no"
#SERVERNAME="--servername--"
<<<<<<< HEAD:bsp/default/root_file_system/etc/fastdstart.sh
project="ffol"
=======
project="${VPN_PROJECT}"
>>>>>>> 8804270... buildscript: support community file with templates:bsp/default/root_file_system/etc/fastdstart.sh.tpl
test_internet_host1="mastersword.de"
test_internet_host2="109.163.229.254"
@ -67,7 +71,7 @@ if ping -w5 -c3 "$test_internet_host1" &>/dev/null ||
fi
# register
wget -T15 "http://mastersword.de/~reddog/fastd/?name=$hostname&port=$port&key=$pubkey" -O /tmp/fastd_${project}_output
wget -T15 "http://mastersword.de/~reddog/${project}/?name=$hostname&port=$port&key=$pubkey" -O /tmp/fastd_${project}_output
filenames=$(awk '/^####/ { gsub(/^####/, "", $0); gsub(/.conf/, "", $0); print $0; }' /tmp/fastd_${project}_output)
for file in $filenames; do

View File

@ -1,46 +0,0 @@
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
# collect environment info and write to dot-script
/etc/environment.sh > /tmp/environment
# todo: all devices or only dir300 ?
if uci get network.mesh.macaddr
then
echo "MAC is set already"
else
BRMAC=$(awk '{ tolower($0); print }' /sys/class/net/br-mesh/address)
WLMAC=$(awk '{ tolower($0); print }' /sys/class/net/wlan0/address)
ETMAC=$(awk '{ tolower($0); print }' /sys/class/net/eth0/address)
if [ "$WLMAC" != "" ] && [ "$BRMAC" != "" ] && [ "$BRMAC" = "$ETMAC" ]; then
if [[ "$BRMAC" != "$WLMAC" ]]; then
echo "Fixing wrong MAC on br-mesh"
uci set network.mesh.macaddr=$WLMAC
uci commit
ifconfig br-mesh hw ether $WLMAC
ifconfig br-mesh down
ifconfig br-mesh up
#wait before reboot to generate tinc certificates and to be able
#to login over ssh bevore reboot in case of errors
fi
fi
fi
batctl if add wlan0-1
batctl if add br-ethmesh1
batctl if add br-ethmesh2
# Starting NTP-Client Daemon
ntpd -p "fe80::201:2ff:fe03:405%br-mesh"
. /etc/firewall.user
/etc/init.d/qos disable
/etc/init.d/qos stop
#busybox-httpd for crawldata
mkdir /tmp/crawldata
httpd -h /tmp/crawldata
exit 0

View File

@ -0,0 +1,21 @@
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
# collect environment info and write to dot-script
/etc/environment.sh > /tmp/environment
. /etc/rc.local.board
# Starting NTP-Client Daemon
ntpd -p ${NTPD_IP}
. /etc/firewall.user
/etc/init.d/qos disable
/etc/init.d/qos stop
#busybox-httpd for crawldata
mkdir /tmp/crawldata
httpd -h /tmp/crawldata
exit 0

View File

@ -2,15 +2,15 @@ config 'wifi-device' 'wifi0'
option 'type' 'mac80211'
option 'phy' 'phy0'
option 'disabled' '0'
option 'channel' '6'
option 'channel' '${BATMAN_CHANNEL}'
option 'hwmode' '11g'
config 'wifi-iface'
option 'device' 'wifi0'
option 'network' 'wlanmesh'
option 'mode' 'adhoc'
option 'ssid' 'batman.oldenburg.freifunk.net'
option 'bssid' '02:CA:FF:EE:BA:BE'
option 'ssid' '${ESSID_MESH}'
option 'bssid' '${BSSID_MESH}'
option 'encryption' 'none'
option 'hidden' '1'
@ -18,5 +18,5 @@ config 'wifi-iface'
option 'device' 'wifi0'
option 'network' 'mesh'
option 'mode' 'ap'
option 'ssid' 'oldenburg.freifunk.net'
option 'ssid' '${ESSID_AP}'
option 'encryption' 'none'

View File

@ -1,10 +1,4 @@
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
# collect environment info and write to dot-script
/etc/environment.sh > /tmp/environment
# todo: all devices or only dir300 ?
if uci get network.mesh.macaddr
then
echo "MAC is set already"
@ -43,13 +37,3 @@ fi
batctl if add wlan0-1
batctl if add eth0.3
# Starting NTP-Client Daemon
ntpd -p "fe80::201:2ff:fe03:405%br-mesh"
#. /etc/firewall.user
#busybox-httpd for crawldata
mkdir /tmp/crawldata
httpd -h /tmp/crawldata
exit 0

View File

@ -2,15 +2,15 @@ config 'wifi-device' 'wifi0'
option 'type' 'mac80211'
option 'phy' 'phy0'
option 'disabled' '0'
option 'channel' '6'
option 'channel' '${BATMAN_CHANNEL}'
option 'hwmode' '11g'
config 'wifi-iface'
option 'device' 'wifi0'
option 'network' 'wlanmesh'
option 'mode' 'adhoc'
option 'ssid' 'batman.oldenburg.freifunk.net'
option 'bssid' '02:CA:FF:EE:BA:BE'
option 'ssid' '${ESSID_MESH}'
option 'bssid' '${BSSID_MESH}'
option 'encryption' 'none'
option 'hidden' '1'
@ -18,6 +18,5 @@ config 'wifi-iface'
option 'device' 'wifi0'
option 'network' 'mesh'
option 'mode' 'ap'
option 'ssid' 'oldenburg.freifunk.net'
option 'ssid' '${ESSID_AP}'
option 'encryption' 'none'

View File

@ -1,15 +1,3 @@
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
# collect environment info and write to dot-script
/etc/environment.sh > /tmp/environment
#. /etc/firewall.user
#busybox-httpd for crawldata
mkdir /tmp/crawldata
httpd -h /tmp/crawldata
# fonera to slow?
sleep 10
@ -36,7 +24,3 @@ fi
batctl if add wlan0-1
# Starting NTP-Client Daemon
ntpd -p "fe80::201:2ff:fe03:405%br-mesh"
exit 0

View File

@ -1,28 +0,0 @@
config wifi-device radio0
option type mac80211
option channel 6
option phy phy0
option hwmode 11ng
option htmode HT20
list ht_capab SHORT-GI-40
list ht_capab DSSS_CCK-40
# REMOVE THIS LINE TO ENABLE WIFI:
option disabled 0
config wifi-iface
option device radio0
option network wlanmesh
option mode adhoc
option bssid '02:CA:FF:EE:BA:BE'
option ssid 'batman.oldenburg.freifunk.net'
option mcast_rate 6000
# option bintval 1000
option 'encryption' 'none'
option 'hidden' '1'
config wifi-iface
option device radio0
option network mesh
option mode ap
option ssid 'oldenburg.freifunk.net'
option 'encryption' 'none'

View File

@ -1,50 +0,0 @@
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
# collect environment info and write to dot-script
/etc/environment.sh > /tmp/environment
#Set Mac-Addr of wr1043nd wifi interface if not right
#HARDWARE_MACADDR=`ifconfig -a wlan0 | grep 'HWaddr' | awk '{ print $5}'`
#SOFTWARE_MACADDR=`uci get wireless.@wifi-device[0].macaddr`
#
#if [[ "$HARDWARE_MACADDR" != "$SOFTWARE_MACADDR" ]]; then
# uci set wireless.@wifi-device[0].macaddr=$HARDWARE_MACADDR
# uci commit
# #wait before reboot to generate tinc certificates and to be able
# #to login over ssh bevore reboot in case of errors
# sleep 30
# reboot
#fi
if uci get network.ethmesh.macaddr
then
echo "MAC for ETH-BATMAN is set already"
else
echo "Fixing MAC on eth0.3 (ethmesh)"
NEW=$(awk -F: '{ printf("%02x:%02x:%02x:%02x:%02x:%02x\n", ("0x"$1)+2, "0x"$2, "0x"$3, "0x"$4, "0x"$5, "0x"$6 ) }' /sys/class/net/eth0/address)
uci set network.ethmesh.macaddr=$NEW
uci commit
ifconfig eth0.3 hw ether $NEW
ifconfig eth0.3 down
ifconfig eth0.3 up
fi
batctl if add wlan0-1
batctl if add eth0.3
# Starting NTP-Client Daemon
ntpd -p "fe80::201:2ff:fe03:405%br-mesh"
. /etc/firewall.user
/etc/init.d/qos disable
/etc/init.d/qos stop
#busybox-httpd for crawldata
mkdir /tmp/crawldata
httpd -h /tmp/crawldata
#sh /etc/configurator.sh
exit 0

View File

@ -0,0 +1,17 @@
if uci get network.ethmesh.macaddr
then
echo "MAC for ETH-BATMAN is set already"
else
echo "Fixing MAC on eth0.3 (ethmesh)"
NEW=$(awk -F: '{ printf("%02x:%02x:%02x:%02x:%02x:%02x\n", ("0x"$1)+2, "0x"$2, "0x"$3, "0x"$4, "0x"$5, "0x"$6 ) }' /sys/class/net/eth0/address)
uci set network.ethmesh.macaddr=$NEW
uci commit
ifconfig eth0.3 hw ether $NEW
ifconfig eth0.3 down
ifconfig eth0.3 up
fi
batctl if add wlan0-1
batctl if add eth0.3

View File

@ -1,23 +0,0 @@
config wifi-device radio0
option type mac80211
option channel 6
option phy phy0
option hwmode 11ng
config wifi-iface
option device radio0
option network wlanmesh
option mode adhoc
option bssid '02:CA:FF:EE:BA:BE'
option ssid 'batman.oldenburg.freifunk.net'
option mcast_rate 6000
# option bintval 1000
option 'encryption' 'none'
option 'hidden' '1'
config wifi-iface
option device radio0
option network mesh
option mode ap
option ssid 'oldenburg.freifunk.net'
option 'encryption' 'none'

View File

@ -1,8 +1,3 @@
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
# collect environment info and write to dot-script
/etc/environment.sh > /tmp/environment
#Set Mac-Addr of wr1043nd wifi interface if not right
WLAN0_MACADDR=$(cat /sys/class/net/wlan0/address)
@ -33,16 +28,3 @@ fi
batctl if add wlan0-1
batctl if add eth0.3
# Starting NTP-Client Daemon
ntpd -p "fe80::201:2ff:fe03:405%br-mesh"
. /etc/firewall.user
/etc/init.d/qos disable
/etc/init.d/qos stop
#busybox-httpd for crawldata
mkdir /tmp/crawldata
httpd -h /tmp/crawldata
exit 0

View File

@ -1,23 +0,0 @@
config wifi-device radio0
option type mac80211
option channel 6
option phy phy0
option hwmode 11ng
config wifi-iface
option device radio0
option network wlanmesh
option mode adhoc
option bssid '02:CA:FF:EE:BA:BE'
option ssid 'batman.oldenburg.freifunk.net'
option mcast_rate 6000
# option bintval 1000
option 'encryption' 'none'
option 'hidden' '1'
config wifi-iface
option device radio0
option network mesh
option mode ap
option ssid 'oldenburg.freifunk.net'
option 'encryption' 'none'

View File

@ -1,8 +1,3 @@
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
# collect environment info and write to dot-script
/etc/environment.sh > /tmp/environment
#Set Mac-Addr of wr1043nd wifi interface if not right
WLAN0_MACADDR=$(cat /sys/class/net/wlan0/address)
@ -32,17 +27,3 @@ fi
batctl if add wlan0-1
batctl if add eth0.3
# Starting NTP-Client Daemon
ntpd -p "fe80::201:2ff:fe03:405%br-mesh"
. /etc/firewall.user
/etc/init.d/qos disable
/etc/init.d/qos stop
#busybox-httpd for crawldata
mkdir /tmp/crawldata
httpd -h /tmp/crawldata
exit 0

View File

@ -1,23 +0,0 @@
config wifi-device radio0
option type mac80211
option channel 6
option phy phy0
option hwmode 11ng
config wifi-iface
option device radio0
option network wlanmesh
option mode adhoc
option bssid '02:CA:FF:EE:BA:BE'
option ssid 'batman.oldenburg.freifunk.net'
option mcast_rate 6000
# option bintval 1000
option 'encryption' 'none'
option 'hidden' '1'
config wifi-iface
option device radio0
option network mesh
option mode ap
option ssid 'oldenburg.freifunk.net'
option 'encryption' 'none'

View File

@ -1,8 +1,3 @@
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
# collect environment info and write to dot-script
/etc/environment.sh > /tmp/environment
#Set Mac-Addr of wr1043nd wifi interface if not right
WLAN0_MACADDR=$(cat /sys/class/net/wlan0/address)
@ -33,16 +28,3 @@ fi
batctl if add wlan0-1
batctl if add eth1.3
# Starting NTP-Client Daemon
ntpd -p "fe80::201:2ff:fe03:405%br-mesh"
. /etc/firewall.user
/etc/init.d/qos disable
/etc/init.d/qos stop
#busybox-httpd for crawldata
mkdir /tmp/crawldata
httpd -h /tmp/crawldata
exit 0

View File

@ -1,8 +1,3 @@
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
# collect environment info and write to dot-script
/etc/environment.sh > /tmp/environment
#Set Mac-Addr of wr1043nd wifi interface if not right
WLAN0_MACADDR=$(cat /sys/class/net/wlan0/address)
@ -32,17 +27,3 @@ fi
batctl if add wlan0-1
batctl if add eth0.3
# Starting NTP-Client Daemon
ntpd -p "fe80::201:2ff:fe03:405%br-mesh"
. /etc/firewall.user
/etc/init.d/qos disable
/etc/init.d/qos stop
#busybox-httpd for crawldata
mkdir /tmp/crawldata
httpd -h /tmp/crawldata
exit 0

View File

@ -53,6 +53,13 @@ prebuild() {
board_prebuild
for template in $(find $target/files -name *.tpl)
do
echo "Translating $template .."
$tpl_translate $template > $(basename $template .tpl)
/bin/rm $template
done
#insert actual firware version informations into release file
version=$(git describe --tags --dirty)
@ -118,29 +125,55 @@ routers() {
echo " wr1043nd"
}
if [ "$1" != "select" ]; then
if [ "$1" != "selectbsp" -a "$1" != "selectcommunity" ]; then
if [ ! -h selected_bsp ]; then
echo "Please select a Board-Support-Package using:"
echo "$0 select"
echo "$0 selectbsp"
exit
else
echo "Working with $(/bin/ls -l selected_bsp | awk '{ print $11 }')"
. selected_bsp
echo
fi
fi
if [ ! -h selected_community ]; then
echo "Please select a community file using:"
echo "$0 selectcommunity"
exit
fi
echo "Working with $(/bin/ls -l selected_bsp | awk '{ print $11 }') and" \
"$(/bin/ls -l selected_community | awk '{ print $11 }')"
. selected_bsp
tpl_translate=$(awk -F= 'BEGIN{printf("sed")} /^.+$/{printf(" -es/\\${%s}/%s/g",$1,$2)}' selected_community)
echo
fi
case "$1" in
"select")
"selectbsp")
if [ "$2" = "help" ] || [ "$2" = "" ]; then
echo "Select a Board-Support-Package:"
echo
echo "Usage: $0 $1 bsp"
echo "bsp: "
cd bsp; /bin/ls *.bsp; cd ..
/bin/ls bsp/*.bsp
else
/bin/rm -rf selected_bsp
/bin/ln -s bsp/$2 selected_bsp
if [ ! -f $2 ]; then
echo "Could not find $2"
else
/bin/rm -rf selected_bsp
/bin/ln -s $2 selected_bsp
fi
fi
;;
"selectcommunity")
if [ "$2" = "help" ] || [ "$2" = "" ]; then
echo "Select a Community-File:"
echo
echo "Usage: $0 $1 community.cfg"
echo "community.cfg: "
/bin/ls community/*.cfg
else
if [ ! -f $2 ]; then
echo "Could not find $2"
else
/bin/rm -rf selected_community
/bin/ln -s $2 selected_community
fi
fi
;;
"prepare")

8
community/franken.cfg Normal file
View File

@ -0,0 +1,8 @@
BATMAN_CHANNEL=1
ESSID_AP=franken.freifunk.net
ESSID_MESH=batman.franken.freifunk.net
BSSID_MESH=02:CA:FF:EE:BA:BE
NETMON_IP=fe80::ff:feee:1
VPN_PROJECT=fff
NTPD_IP=fe80::ff:feee:1%br-mesh

8
community/oldenburg.cfg Normal file
View File

@ -0,0 +1,8 @@
BATMAN_CHANNEL=6
ESSID_AP=oldenburg.freifunk.net
ESSID_MESH=batman.oldenburg.freifunk.net
BSSID_MESH=02:CA:FF:EE:BA:BE
NETMON_IP=fe80::201:2ff:fe03:405
VPN_PROJECT=ffol
NTPD_IP=fe80::201:2ff:fe03:405%br-mesh