Set the hostname for mesh peers
This commit is contained in:
parent
970417a972
commit
b3114fc58e
|
@ -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
|
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
|
||||||
|
sed -i "s|host-name=.*|host-name=${PROJECT_NAME}|g" $rootdir/etc/avahi/avahi-daemon.conf
|
||||||
|
|
||||||
chroot "$rootdir" /bin/bash -x <<EOF
|
chroot "$rootdir" /bin/bash -x <<EOF
|
||||||
git clone $PROJECT_REPO /root/$PROJECT_NAME
|
git clone $PROJECT_REPO /root/$PROJECT_NAME
|
||||||
|
|
|
@ -42,11 +42,26 @@ TOX_NODES=
|
||||||
# '144.76.60.215,2a01:4f8:191:64d6::1,33445,04119E835DF3E78BACF0F84235B300546AF8B936F035185E2A8E9E0A67C8924F,sonOfRa,DE'
|
# '144.76.60.215,2a01:4f8:191:64d6::1,33445,04119E835DF3E78BACF0F84235B300546AF8B936F035185E2A8E9E0A67C8924F,sonOfRa,DE'
|
||||||
#)
|
#)
|
||||||
|
|
||||||
|
function set_hostname {
|
||||||
|
DEFAULT_DOMAIN_NAME="$1"
|
||||||
|
|
||||||
|
echo "$DEFAULT_DOMAIN_NAME" > /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 {
|
function change_avahi_name {
|
||||||
decarray=( 1 2 3 4 5 6 7 8 9 0 )
|
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]}
|
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
|
||||||
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"
|
echo "New avahi name for this peer is P$PEER_ID"
|
||||||
toilet "mesh-$PEER_ID"
|
toilet "mesh-$PEER_ID"
|
||||||
echo $"avahi name changed to P${PEER_ID}.local" >> $INSTALL_LOG
|
echo $"avahi name changed to P${PEER_ID}.local" >> $INSTALL_LOG
|
||||||
|
|
Loading…
Reference in New Issue