From 90c8dbfd64d6e9af7184dc7291ff6e9e23ae20d3 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 2 Jun 2017 17:03:41 +0100 Subject: [PATCH] Keep the avahi daemon running in the image install --- src/freedombone-image-customise | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/freedombone-image-customise b/src/freedombone-image-customise index 3ee482a3..599ab6a6 100755 --- a/src/freedombone-image-customise +++ b/src/freedombone-image-customise @@ -1301,6 +1301,32 @@ sed -i "s|use-ipv6=.*|use-ipv6=no|g" $rootdir/etc/avahi/avahi-daemon.conf sed -i "s|#disallow-other-stacks=.*|disallow-other-stacks=yes|g" $rootdir/etc/avahi/avahi-daemon.conf sed -i "s|hosts:.*|hosts: files mdns4_minimal dns mdns4 mdns|g" $rootdir/etc/nsswitch.conf +# Add an ssh avahi service +echo '' > $rootdir/etc/avahi/services/ssh.service +echo '' >> $rootdir/etc/avahi/services/ssh.service +echo '' >> $rootdir/etc/avahi/services/ssh.service +echo ' %h SSH' >> $rootdir/etc/avahi/services/ssh.service +echo ' ' >> $rootdir/etc/avahi/services/ssh.service +echo ' _ssh._tcp' >> $rootdir/etc/avahi/services/ssh.service +echo " $SSH_PORT" >> $rootdir/etc/avahi/services/ssh.service +echo ' ' >> $rootdir/etc/avahi/services/ssh.service +echo '' >> $rootdir/etc/avahi/services/ssh.service + +echo '#!/bin/bash' > $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME +echo 'LOGFILE=/var/log/keepon.log' >> $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME +echo 'CURRENT_DATE=$(date)' >> $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME +echo '' >> $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME +echo "# keep avahi-daemon daemon running" >> $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME +echo "RUNNING=$(pgrep avahi-daemon > /dev/null && echo Running)" >> $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME +echo 'if [ ! $RUNNING ]; then' >> $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME +echo " systemctl start avahi-daemon" >> $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME +echo ' echo -n $CURRENT_DATE >> $LOGFILE' >> $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME +echo " echo \"avahi-daemon daemon restarted\" >> \$LOGFILE" >> $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME +echo 'fi' >> $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME +echo "# End of avahi-daemon" >> $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME +chmod +x $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME +echo "*/1 * * * * root /usr/bin/$WATCHDOG_SCRIPT_NAME" >> $rootdir/etc/crontab + # TODO temporary for stretch chroot "$rootdir" /bin/bash -x <