Package: radioclk
Version: 1.0.ds1-12
Severity: wishlist

It would be useful if there was a way to stop the radioclk daemon being 
started. The attached patches
add an ENABLED option to /etc/default/radioclk

-- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 4.6.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages radioclk depends on:
ii  debconf [debconf-2.0]  1.5.59
ii  libc6                  2.23-5
ii  ntp                    1:4.2.8p8+dfsg-1

radioclk recommends no packages.

radioclk suggests no packages.

-- Configuration Files:
/etc/init.d/radioclk changed [not included]

-- debconf information excluded
--- radioclk-1.0.ds1/debian/radioclk.init	2012-05-18 13:45:53.000000000 +0100
+++ radioclk-1.0.ds1-new/debian/radioclk.init	2016-09-05 13:36:45.564979755 +0100
@@ -32,6 +32,10 @@
 
 case "$1" in
   start)
+	if [ "$ENABLED" != "yes" ] ; then
+		printf "Not starting $NAME, Disabled in $DEFAULTS.\n"
+		exit 0
+	fi
 	echo -n "Starting $DESC: "
 	start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
 		--exec $DAEMON -- $PORT
--- radioclk-1.0.ds1/debian/radioclk.postinst	2012-04-25 16:09:14.000000000 +0100
+++ radioclk-1.0.ds1-new/debian/radioclk.postinst	2016-09-05 11:51:48.172374944 +0100
@@ -42,10 +42,18 @@
 		# keep any admin changes, while replacing the variable content
 		sed "s/^PORT=\".*\"/PORT=\"$PORT\"/" < $RC > $RC.new &&
 		        mv $RC.new $RC
+		# and add the enabled line if it's missing
+		grep -q ENABLED $RC
+		if [ $? -eq 1 ] then
+			echo "# Start daemon? yes or no" >> $RC
+			echo "ENABLED=\"yes\"" >> $RC
+		fi
 	else
 		# the radioclk file does not yet exist, so create it
 		echo "# Serial port to listen on" > $RC
 		echo "PORT=\"$PORT\"" >> $RC
+		echo "# Start daemon? yes or no" >> $RC
+		echo "ENABLED=\"yes\"" >> $RC
 	fi
 
 	# finished with debconf

Reply via email to