diff --git a/src/freedombone-image-customise b/src/freedombone-image-customise index 8302c530..7f494259 100755 --- a/src/freedombone-image-customise +++ b/src/freedombone-image-customise @@ -1051,6 +1051,7 @@ chroot "$rootdir" apt-get install -y libnss-mdns libnss-myhostname libnss-gw-nam chroot "$rootdir" apt-get install -y locales locales-all debconf wireless-tools wpasupplicant sed -i "s|#host-name=.*|host-name=${PROJECT_NAME}|g" $rootdir/etc/avahi/avahi-daemon.conf +sed -i "s|host-name=.*|host-name=${PROJECT_NAME}|g" $rootdir/etc/avahi/avahi-daemon.conf chroot "$rootdir" /bin/bash -x < /etc/hostname + hostname $DEFAULT_DOMAIN_NAME + + if grep -q "127.0.1.1" /etc/hosts; then + sed -i "s/127.0.1.1.*/127.0.1.1 $DEFAULT_DOMAIN_NAME/g" /etc/hosts + else + echo "127.0.1.1 $DEFAULT_DOMAIN_NAME" >> /etc/hosts + fi +} + function change_avahi_name { 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]}${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}${decarray[$RANDOM%10]} sed -i "s|#host-name=.*|host-name=P$PEER_ID|g" /etc/avahi/avahi-daemon.conf sed -i "s|host-name=.*|host-name=P$PEER_ID|g" /etc/avahi/avahi-daemon.conf + set_hostname P$PEER_ID + echo "New avahi name for this peer is P$PEER_ID" toilet "mesh-$PEER_ID" echo $"avahi name changed to P${PEER_ID}.local" >> $INSTALL_LOG