From f53814b039ef43e2f30fcd49ac5796db23f0e95c Mon Sep 17 00:00:00 2001 From: Oliver Ertl Date: Mon, 3 Sep 2007 14:48:21 +0000 Subject: [PATCH] p910nd: * Migrate configuration to UCI * Minor Makefile cleanups SVN-Revision: 8596 --- net/p910nd/Makefile | 41 +++++--------- net/p910nd/files/p910nd.conf | 4 ++ net/p910nd/files/p910nd.default | 9 ---- net/p910nd/files/p910nd.init | 54 ++++++++++--------- net/p910nd/patches/100-Makefile.patch | 6 ++- ...{200-p910nd-0.7.patch => 200-p910nd.patch} | 6 ++- 6 files changed, 55 insertions(+), 65 deletions(-) create mode 100644 net/p910nd/files/p910nd.conf delete mode 100644 net/p910nd/files/p910nd.default rename net/p910nd/patches/{200-p910nd-0.7.patch => 200-p910nd.patch} (97%) diff --git a/net/p910nd/Makefile b/net/p910nd/Makefile index d3acf0d0a6..89148d8f56 100644 --- a/net/p910nd/Makefile +++ b/net/p910nd/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2006 OpenWrt.org +# Copyright (C) 2007 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -10,14 +10,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=p910nd PKG_VERSION:=0.7 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=http://www.etherboot.org/p910nd PKG_MD5SUM:=7bf752532d26c9106f8039db95df3a6b -PKG_CAT:=bzcat - -PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) include $(INCLUDE_DIR)/package.mk @@ -26,36 +23,26 @@ define Package/p910nd CATEGORY:=Network TITLE:=A small non-spooling printer server DESCRIPTION:=\ - p910nd is a small daemon that copies any data received on \\\ - the port it is listening on to the corresponding printer \\\ - port. It is primarily intended for diskless Linux hosts \\\ - running as printer drivers but there is no reason why it \\\ - could not be used on diskful hosts. Port 9100 is copied \\\ - to /dev/lp0, 9101 to /dev/lp1 and 9102 to /dev/lp2. The \\\ + p910nd is a small daemon that copies any data received on \\\ + the port it is listening on to the corresponding printer \\\ + port. It is primarily intended for diskless Linux hosts \\\ + running as printer drivers but there is no reason why it \\\ + could not be used on diskful hosts. Port 9100 is copied \\\ + to /dev/lp0, 9101 to /dev/lp1 and 9102 to /dev/lp2. The \\\ default is port 9100 to /dev/lp0. URL:=http://www.etherboot.org/p910nd/ endef -define Package/p910nd/conffiles -/etc/default/p910nd -endef - -define Build/Configure -endef - -define Build/Compile - $(MAKE) -C $(PKG_BUILD_DIR) \ - $(TARGET_CONFIGURE_OPTS) \ - CFLAGS="$(TARGET_CFLAGS) -DLOCKFILE_DIR=\"\\\"/tmp\\\"\"" -endef +MAKE_FLAGS += \ + CFLAGS="$(TARGET_CFLAGS) -DLOCKFILE_DIR=\"\\\"/tmp\"\\\"" define Package/p910nd/install $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/p910nd $(1)/usr/sbin/ - $(INSTALL_DIR) $(1)/etc/default - $(INSTALL_DATA) ./files/p910nd.default $(1)/etc/default/p910nd + $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/$(PKG_NAME).conf $(1)/etc/config/$(PKG_NAME) $(INSTALL_DIR) $(1)/etc/init.d - $(INSTALL_BIN) ./files/p910nd.init $(1)/etc/init.d/p910nd + $(INSTALL_BIN) ./files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME) endef $(eval $(call BuildPackage,p910nd)) diff --git a/net/p910nd/files/p910nd.conf b/net/p910nd/files/p910nd.conf new file mode 100644 index 0000000000..6f61005a62 --- /dev/null +++ b/net/p910nd/files/p910nd.conf @@ -0,0 +1,4 @@ +config p910nd + option portnumber + option device + option bidirectional diff --git a/net/p910nd/files/p910nd.default b/net/p910nd/files/p910nd.default deleted file mode 100644 index 77317cfad3..0000000000 --- a/net/p910nd/files/p910nd.default +++ /dev/null @@ -1,9 +0,0 @@ -# printing port list, in the form "number [options]" -# where: -# - number is the port number in the range [0-9] -# the p910nd daemon will listen on tcp port 9100+number -# - options can be : -# -b to turn on bidirectional copying. -# -f to specify a different printer device. -# -0 -b -f /dev/usb/lp0 diff --git a/net/p910nd/files/p910nd.init b/net/p910nd/files/p910nd.init index cc14fcbcb4..42e6fc38e1 100644 --- a/net/p910nd/files/p910nd.init +++ b/net/p910nd/files/p910nd.init @@ -1,34 +1,38 @@ #!/bin/sh /etc/rc.common -# Copyright (C) 2006 OpenWrt.org +# Copyright (C) 2007 OpenWrt.org START=50 -DEFAULT=/etc/default/p910nd -RUN_D=/var/run +BIN=p910nd + +start_service() { + local section="$1" + config_get port "$section" port + config_get device "$section" device + config_get_bool bidirectional "$section" bidirectional + + options="" + [ $bidirectional -eq 1 ] && { + options="$options -b" + } + options="$options -f $device $port" + + $BIN $options +} + +stop_service() { + local section="$1" + config_get port "$section" port + + PID_F=/var/run/p910${port}d.pid + [ -f $PID_F ] && kill $(cat $PID_F) +} start() { - mkdir -p $RUN_D - [ -f $DEFAULT ] && ( - while read port options; do - case "$port" in - ""|\#*) continue;; - esac - p910nd $options $port - if [ $? -ne 0 ]; then - exit 1 - fi - done - ) < $DEFAULT + config_load "p910nd" + config_foreach start_service p910nd } stop() { - [ -f $DEFAULT ] && ( - while read port options; do - case "$port" in - ""|\#*) continue;l - esac - PID_F=$RUN_D/p910${port}d.pid - [ -f $PID_F ] && kill $(cat $PID_F) - done - ) < $DEFAULT + config_load "p910nd" + config_foreach stop_service p910nd } - diff --git a/net/p910nd/patches/100-Makefile.patch b/net/p910nd/patches/100-Makefile.patch index 83b4f6c67b..e37bb51f13 100644 --- a/net/p910nd/patches/100-Makefile.patch +++ b/net/p910nd/patches/100-Makefile.patch @@ -1,5 +1,7 @@ ---- p910nd-0.7/Makefile.orig 2005-09-25 13:54:28.465506888 +0200 -+++ p910nd-0.7/Makefile 2005-09-25 13:54:46.928700056 +0200 +Index: p910nd-0.7/Makefile +=================================================================== +--- p910nd-0.7.orig/Makefile 2007-09-02 15:17:23.000000000 +0200 ++++ p910nd-0.7/Makefile 2007-09-02 15:17:23.000000000 +0200 @@ -2,9 +2,9 @@ # below if you don't want to use libwrap (hosts.{allow,deny} access control) diff --git a/net/p910nd/patches/200-p910nd-0.7.patch b/net/p910nd/patches/200-p910nd.patch similarity index 97% rename from net/p910nd/patches/200-p910nd-0.7.patch rename to net/p910nd/patches/200-p910nd.patch index 9165498fe8..ec66e47c38 100644 --- a/net/p910nd/patches/200-p910nd-0.7.patch +++ b/net/p910nd/patches/200-p910nd.patch @@ -1,5 +1,7 @@ ---- p910nd-0.7/p910nd.c.orig 2005-09-29 11:31:02.442914400 +0200 -+++ p910nd-0.7/p910nd.c 2005-09-29 11:31:49.236800648 +0200 +Index: p910nd-0.7/p910nd.c +=================================================================== +--- p910nd-0.7.orig/p910nd.c 2007-09-02 15:17:23.000000000 +0200 ++++ p910nd-0.7/p910nd.c 2007-09-02 15:17:23.000000000 +0200 @@ -73,8 +73,7 @@ #else #define LOCKFILE "/var/lock/subsys/p910%cd" -- 2.30.2