Skip to content
Browse files

Added code to install and remove qwebirc's mDNS descriptor file. Also,

cleaned up comments a little.

Signed-off-by: The Doctor <drwho@virtadpt.net>
  • Loading branch information...
1 parent 7ced470 commit 0d8764c2a9826f1c220ff6043a13901d07fe22c5 @virtadpt virtadpt committed Jun 9, 2012
Showing with 23 additions and 4 deletions.
  1. +23 −4 porteus/qwebirc/rc.qwebirc
View
27 porteus/qwebirc/rc.qwebirc
@@ -8,32 +8,51 @@
# v1.0 - Initial release.
# TODO:
-# - Make this run without privileges!
+# -
# Variables
BASE=/opt/qwebirc
PID=/var/run/qwebirc.pid
+DESCRIPTOR="qwebirc.service"
+INACTIVE=/etc/avahi/inactive
+ACTIVE=/etc/avahi/services
# Core code.
# Here's where the heavy lifting happens - this parses the arguments passed to
# script and triggers what has to be triggered.
case "$1" in
'start')
- # Start up the server. It'll drop into the background on its own.
+ # Start up the server. It'll drop into the background on its
+ # own.
cd $BASE
./run.py
# Save the PID.
sleep 5
ps ax | grep [r]un.py | grep -v 'grep' | awk '{print $1}' > $PID
+
+ # Copy the mDNS descriptor into Avahi's configuration
+ # directory
+ if [ -f $INACTIVE/$DESCRIPTOR ]; then
+ cp $INACTIVE/$DESCRIPTOR $ACTIVE
+
+ # Reload Avahi's list of service descriptors.
+ avahi-daemon --reload
+ fi
;;
'stop')
kill `cat $PID`
rm -f $PID
+
+ # Stop announcing its mDNS descriptor.
+ if [ -f $ACTIVE/$DESCRIPTOR ]; then
+ rm -f $ACTIVE/$DESCRIPTOR
+ avahi-daemon --reload
+ fi
;;
'status')
- # Extract the PID from the process list, in case the PID file doesn't
- # line up anymore.
+ # Extract the PID from the process list, in case the PID file
+ # doesn't line up anymore.
ps ax | grep [r]un.py | grep -v 'grep' | awk '{print $1}'
;;
*)

0 comments on commit 0d8764c

Please sign in to comment.
Something went wrong with that request. Please try again.