-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi,
comments inline. > From: Karl Palsson <ka...@remake.is> > > Use the service helper scripts to build a simple init script for the > mosquitto broker. To make sure that the standard shipped config file > works, add a mosquitto user if not found. > > Signed-off-by: Karl Palsson <ka...@remake.is> > --- > net/mosquitto/Makefile | 24 +++++++++++++++++++++++- > net/mosquitto/files/mosquitto.init | 24 ++++++++++++++++++++++++ > 2 files changed, 47 insertions(+), 1 deletions(-) > create mode 100755 net/mosquitto/files/mosquitto.init > > diff --git a/net/mosquitto/Makefile b/net/mosquitto/Makefile > index 4ed8bc4..551f286 100644 > --- a/net/mosquitto/Makefile > +++ b/net/mosquitto/Makefile > @@ -1,5 +1,5 @@ > # > -# Copyright (C) 2011 OpenWrt.org > +# Copyright (C) 2011,2012 OpenWrt.org > # Copyright (C) 2010 Jo-Philipp Wich <x...@subsignal.org> > # > # This is free software, licensed under the GNU General Public License v2. > @@ -72,6 +72,28 @@ define Package/mosquitto/install > $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mosquitto $(1)/usr/sbin/mosquitto > $(INSTALL_DIR) $(1)/etc/mosquitto > $(INSTALL_CONF) $(PKG_BUILD_DIR)/mosquitto.conf > $(1)/etc/mosquitto/mosquitto.conf > + $(INSTALL_DIR) $(1)/etc/init.d > + $(INSTALL_BIN) ./files/mosquitto.init $(1)/etc/init.d/mosquitto > +endef > + > +define Package/mosquitto/postinst > +#!/bin/sh > +# check if we are on real system > +if [ -z "$${IPKG_INSTROOT}" ]; then > + echo "Enabling rc.d symlink for mosquitto" > + /etc/init.d/mosquitto enable > +fi > +exit 0 > +endef The choice of not enabling package init scripts upon opkg install was made deliberately, you should not violate that assumption here. > + > +define Package/mosquitto/prerm > +#!/bin/sh > +# check if we are on real system > +if [ -z "$${IPKG_INSTROOT}" ]; then > + echo "Removing rc.d symlink for mosquitto" > + /etc/init.d/mosquitto disable > +fi > +exit 0 > endef Same here. Remove the postinst and prerm hooks. > > define Package/mosquitto-client/install > diff --git a/net/mosquitto/files/mosquitto.init > b/net/mosquitto/files/mosquitto.init > new file mode 100755 > index 0000000..7590981 > --- /dev/null > +++ b/net/mosquitto/files/mosquitto.init > @@ -0,0 +1,24 @@ > +#!/bin/sh /etc/rc.common > +# Basic init script for mosquitto > +# April 2012, OpenWRT.org OpenWrt.org > + > +START=80 > +APP=`which mosquitto` > + > +SERVICE_DAEMONIZE=1 > +SERVICE_WRITE_PID=1 > + > +start() { > + user_exists mosquitto 200 || user_add mosquitto 200 > + service_start $APP -c /etc/mosquitto/mosquitto.conf > +} > + > +stop() { > + service_stop $APP > +} > + > +restart() { > + stop; > + sleep 1; > + start; > +} Remove this restart procedure, there is no need to sleep between stop and start. ~ Jow -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk+J4gwACgkQdputYINPTPORlwCgkM/tk32zLoti0ICN4RKnP2cH X9gAn2DlcEAswDMRUsTDBLz9WEnrhnar =hFfo -----END PGP SIGNATURE----- _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel