Separate avahi configuration

This commit is contained in:
Bob Mottram 2015-07-25 13:30:46 +01:00
parent 9ce7e1ab70
commit 5641cd3bc8
1 changed files with 24 additions and 2 deletions

View File

@ -1637,6 +1637,27 @@ function install_atheros_wifi {
echo 'install_atheros_wifi' >> $COMPLETION_FILE echo 'install_atheros_wifi' >> $COMPLETION_FILE
} }
function configure_avahi {
if grep -Fxq "configure_avahi" $COMPLETION_FILE; then
return
fi
# only enable avahi if we're doing mesh networking
if [[ $ENABLE_BABEL != "yes" && $ENABLE_BATMAN != "yes" && $ENABLE_CJDNS != "yes" ]]; then
return
fi
apt-get -y install avahi-utils avahi-autoipd
if [ $DEFAULT_DOMAIN_NAME ]; then
sed -i "s|#host-name=.*|host-name=$DEFAULT_DOMAIN_NAME|g" /etc/avahi/avahi-daemon.conf
else
decarray=( 1 2 3 4 5 6 7 8 9 0 )
PEER_ID=${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}
sed -i "s|#host-name=.*|host-name=freedombone-$PEER_ID|g" /etc/avahi/avahi-daemon.conf
fi
systemctl restart avahi-daemon
echo 'configure_avahi' >> $COMPLETION_FILE
}
function mesh_babel { function mesh_babel {
if grep -Fxq "mesh_babel" $COMPLETION_FILE; then if grep -Fxq "mesh_babel" $COMPLETION_FILE; then
return return
@ -1644,7 +1665,7 @@ function mesh_babel {
if [[ $ENABLE_BABEL != "yes" ]]; then if [[ $ENABLE_BABEL != "yes" ]]; then
return return
fi fi
apt-get -y install babeld avahi-utils avahi-autoipd apt-get -y install babeld
numarray=( 1 2 3 4 5 6 7 8 9 0 ) numarray=( 1 2 3 4 5 6 7 8 9 0 )
a=${numarray[$RANDOM%2]}${numarray[$RANDOM%10]}${numarray[$RANDOM%10]} a=${numarray[$RANDOM%2]}${numarray[$RANDOM%10]}${numarray[$RANDOM%10]}
@ -1678,7 +1699,7 @@ function mesh_batman_bridge {
apt-get -y install iproute bridge-utils libnetfilter-conntrack3 batctl apt-get -y install iproute bridge-utils libnetfilter-conntrack3 batctl
apt-get -y install python-dev libevent-dev ebtables python-pip git apt-get -y install python-dev libevent-dev ebtables python-pip git
apt-get -y install avahi-utils avahi-autoipd wireless-tools apt-get -y install wireless-tools
install_vpn_tunnel install_vpn_tunnel
@ -9851,6 +9872,7 @@ set_your_domain_name
time_synchronisation time_synchronisation
configure_internet_protocol configure_internet_protocol
create_git_project create_git_project
configure_avahi
install_atheros_wifi install_atheros_wifi
mesh_cjdns mesh_cjdns
mesh_cjdns_tools mesh_cjdns_tools