* Migrate configuration to UCI
 * Minor Makefile cleanups

git-svn-id: svn://svn.openwrt.org/openwrt/packages@8596 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
olli 2007-09-03 14:48:21 +00:00
parent f6861b1b92
commit fd171424b1
6 changed files with 55 additions and 65 deletions

View File

@ -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
@ -36,26 +33,16 @@ define Package/p910nd
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))

View File

@ -0,0 +1,4 @@
config p910nd
option portnumber
option device
option bidirectional

View File

@ -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

View File

@ -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
}

View File

@ -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)

View File

@ -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"