p910nd fixes:

* move DESCRIPTION to a separate macro
 * add conffiles back
 * indent initscript and config file
 * supply reasonable default config values


git-svn-id: svn://svn.openwrt.org/openwrt/packages@8597 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
nico 2007-09-03 15:33:05 +00:00
parent fd171424b1
commit 50d1b76d54
3 changed files with 35 additions and 29 deletions

View File

@ -22,17 +22,23 @@ define Package/p910nd
SECTION:=net SECTION:=net
CATEGORY:=Network CATEGORY:=Network
TITLE:=A small non-spooling printer server 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 \\\
default is port 9100 to /dev/lp0.
URL:=http://www.etherboot.org/p910nd/ URL:=http://www.etherboot.org/p910nd/
endef endef
define Package/p910nd/conffiles
/etc/config/p910nd
endef
define Package/p910nd/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
default is port 9100 to /dev/lp0.
endef
MAKE_FLAGS += \ MAKE_FLAGS += \
CFLAGS="$(TARGET_CFLAGS) -DLOCKFILE_DIR=\"\\\"/tmp\"\\\"" CFLAGS="$(TARGET_CFLAGS) -DLOCKFILE_DIR=\"\\\"/tmp\"\\\""

View File

@ -1,4 +1,4 @@
config p910nd config p910nd
option portnumber option device "/dev/usb/lp0"
option device option port 0
option bidirectional option bidirectional 1

View File

@ -5,34 +5,34 @@ START=50
BIN=p910nd BIN=p910nd
start_service() { start_service() {
local section="$1" local section="$1"
config_get port "$section" port config_get port "$section" port
config_get device "$section" device config_get device "$section" device
config_get_bool bidirectional "$section" bidirectional config_get_bool bidirectional "$section" bidirectional
options="" options=""
[ $bidirectional -eq 1 ] && { [ $bidirectional -eq 1 ] && {
options="$options -b" options="$options -b"
} }
options="$options -f $device $port" options="$options -f $device $port"
$BIN $options $BIN $options
} }
stop_service() { stop_service() {
local section="$1" local section="$1"
config_get port "$section" port config_get port "$section" port
PID_F=/var/run/p910${port}d.pid PID_F=/var/run/p910${port}d.pid
[ -f $PID_F ] && kill $(cat $PID_F) [ -f $PID_F ] && kill $(cat $PID_F)
} }
start() { start() {
config_load "p910nd" config_load "p910nd"
config_foreach start_service p910nd config_foreach start_service p910nd
} }
stop() { stop() {
config_load "p910nd" config_load "p910nd"
config_foreach stop_service p910nd config_foreach stop_service p910nd
} }