new package : p910nd print server
PATCH RESEND 1/1 new package : p910nd print server
p910nd is a lightweight, nonspooling printserver that accepts jobs on ports 9100-9102 via network, and sends them directly to a USB printer. It is ideally suited for embedded devices and diskless workstations.
--- package/Config.in | 1 + package/p910nd/Config.in | 8 +++ package/p910nd/S55p910nd | 48 ++++++++++++++++++++ ...var-lock-instead-of-var_log_subsys_p910nd.patch | 13 +++++ package/p910nd/p910nd.default | 9 ++++ package/p910nd/p910nd.mk | 23 +++++++++ 6 files changed, 102 insertions(+), 0 deletions(-) create mode 100644 package/p910nd/Config.in create mode 100644 package/p910nd/S55p910nd create mode 100644 package/p910nd/p910nd-0.95-use_var-lock-instead-of-var_log_subsys_p910nd.patch create mode 100644 package/p910nd/p910nd.default create mode 100644 package/p910nd/p910nd.mk
package/Config.in +1 -0
@@ -549,6 +549,7 @@ source "package/openntpd/Config.in" source "package/openssh/Config.in" source "package/openswan/Config.in" source "package/openvpn/Config.in" +source "package/p910nd/Config.in" source "package/portmap/Config.in" source "package/pppd/Config.in" source "package/pptp-linux/Config.in"
package/p910nd/Config.in new file +8 -0
@@ -0,0 +1,8 @@ +config BR2_PACKAGE_P910ND + bool "p910nd" + help + p910nd is a small printer daemon intended for diskless + workstations. Using ports 9100-9102, it accepts + print jobs and passes them directly to a USB printer. + + http://p910nd.sourceforge.net/
package/p910nd/S55p910nd new file +48 -0
48 lines not on this page · raw message
(quoted diff) +0 -0
b/package/p910nd/p910nd-0.95-use_var-lock-instead-of-var_log_subsys_p910nd.patch new file mode 100644
index 0000000..867b8cf
package/p910nd/p910nd-0.95-use_var-lock-instead-of-var_log_subsys_p910nd.patch new file +13 -0
@@ -0,0 +1,13 @@ +Index: p910nd/p910nd.c +=================================================================== +--- p910nd.orig/p910nd.c 2011-11-14 22:47:41.986401420 +0100 ++++ p910nd/p910nd.c 2011-11-14 22:49:27.274923524 +0100 +@@ -122,7 +122,7 @@ + #ifdef LOCKFILE_DIR + #define LOCKFILE LOCKFILE_DIR "/p910%cd" + #else +-#define LOCKFILE "/var/lock/subsys/p910%cd" ++#define LOCKFILE "/var/lock/p910%cd" + #endif + #ifndef PRINTERFILE + #define PRINTERFILE "/dev/lp%c"
package/p910nd/p910nd.default new file +9 -0
@@ -0,0 +1,9 @@ +# 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
package/p910nd/p910nd.mk new file +8 -0
@@ -0,0 +1,23 @@ +############################################################# +# +# p910nd +# +############################################################# + +P910ND_VERSION = 0.95 +P910ND_SITE =
http://voxel.dl.sourceforge.net/project/p910nd/p910nd/$(P910ND_VERSION)
+P910ND_SOURCE = p910nd-$(P910ND_VERSION).tar.bz2
+
+define P910ND_BUILD_CMDS
+ $(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_LD)" -C $(@D)
+endef
+
+define P910ND_INSTALL_TARGET_CMDS
+ $(INSTALL) -D -m 0755 $(@D)/p910nd $(TARGET_DIR)/usr/sbin/p910nd
+ $(INSTALL) -d -m 0755 $(TARGET_DIR)/etc/default
+ $(INSTALL) -m 0755 -D package/p910nd/p910nd.default
$(TARGET_DIR)/etc/default/p910nd
+ $(INSTALL) -m 0755 -D package/p910nd/S55p910nd
$(TARGET_DIR)/etc/init.d/S55p910nd
+
+endef
+
+$(eval $(call GENTARGETS,package,p910nd))
Signature · 1 line
1.7.0.4
PATCH RESEND 1/1 new package : p910nd print server
Quoted 4 lines · David Purdy
p910nd is a lightweight, nonspooling printserver that accepts jobs on ports 9100-9102 via network, and sends them directly to a USB printer. It is ideally suited for embedded devices and diskless workstations.
Please include a Signed-off-by line for yourself. This is a short way
for you to assert that you are entitled to contribute the patch under buildroot's GPL license. See http://kerneltrap.org/files/Jeremy/DCO.txt
for more details.
The rest of my comments are a bit of nitpicking.
[snip]
Quoted 6 lines
package/p910nd/Config.in new file +0
-0
package/p910nd/Config.in line 8
Quoted 8 lines
package/p910nd/Config.in new file +8
-0@@ -0,0 +1,8 @@ +config BR2_PACKAGE_P910ND + bool "p910nd" + help + p910nd is a small printer daemon intended for diskless + workstations. Using ports 9100-9102, it accepts + print jobs and passes them directly to a USB printer. + + http://p910nd.sourceforge.net/
Doesn't this package rely on any external libary at all?
Not even libusb?
package/p910nd/S55p910nd line 3
Quoted 9 lines
package/p910nd/S55p910nd new file +3
-0@@ -0,0 +1,48 @@ +#!/bin/sh + +DEFAULT=/etc/default/p910nd
We don't normally have a /etc/default directory. Even so, it
normally contains shell fragments rather than configuration files (at least it does on Debian+derivatives).
Instead I would name the config file /etc/p910nd.conf
package/p910nd/S55p910nd line 7
Quoted 4 lines
package/p910nd/S55p910nd new file +4
-0+RUN_D=/var/run + +_start() { + mkdir -p $RUN_D
We usually use tabs to indent shell scripts.
package/p910nd/S55p910nd line 8
Quoted 1 line
package/p910nd/S55p910nd new file +1
-0+ [ -f $DEFAULT ]&& (
Space between ] and &&
The sub-shell isn't needed, { ... } would be sufficient.
Or it could even be left out since there's only one command (while) inside.
package/p910nd/S55p910nd line 14
Quoted 6 lines
package/p910nd/S55p910nd new file +6
-0+ while read port options; do + case "$port" in + ""|\#*) + continue; + esac + p910nd $options $port
We usually use start-stop-daemon to control daemons.
Quoted 7 lines
package/p910nd/S55p910nd new file +7
-0+ if [ $? -ne 0 ]; then + exit 1 + fi + done + )< $DEFAULT + exit 0 +}
package/p910nd/S55p910nd
Quoted 10 lines
package/p910nd/S55p910nd new file +10
-0+ +_stop() { + [ -f $DEFAULT ]&& ( + while read port options; do + case "$port" in + ""|\#*) + continue; + esac + PID_F=$RUN_D/p910${port}d.pid + [ -f $PID_F ]&& kill $(cat $PID_F)
This has the annoying effect of not killing things properly
if the configuration file has changed. What about:
for PID_F in $RUN_D/p910?d.pid; do start-stop-daemon -K -p $PID_F -x /usr/sbin/p910nd done
Quoted 4 lines
package/p910nd/S55p910nd new file +4
-0+ rm $PID_F + done + )< $DEFAULT +}
package/p910nd/S55p910nd line 45
Quoted 10 lines
package/p910nd/S55p910nd new file +10
-0+ +case $1 in + start) + _start + ;; + stop) + _stop + ;; + *) + echo "usage: $0 (start|stop)"
Please add a restart as well.
package/p910nd/p910nd-0.95-use_var-lock-instead-of-var_log_subsys_p910nd.patch line 1
Quoted 11 lines
package/p910nd/S55p910nd new file +3
-0+ exit 1 +esac +exit $?package/p910nd/p910nd-0.95-use_var-lock-instead-of-var_log_subsys_p910nd.patch new file +1
-0@@ -0,0 +1,13 @@ +Index: p910nd/p910nd.c
Patches should start with a comment explaining what the patch does and why
it is needed, just like a commit message. It should also contain a Signed-off-by line.
package/p910nd/p910nd-0.95-use_var-lock-instead-of-var_log_subsys_p910nd.patch line 7
Quoted 6 lines
package/p910nd/p910nd-0.95-use_var-lock-instead-of-var_log_subsys_p910nd.patch new file +6
-0+=================================================================== +--- p910nd.orig/p910nd.c 2011-11-14 22:47:41.986401420 +0100 ++++ p910nd/p910nd.c 2011-11-14 22:49:27.274923524 +0100 +@@ -122,7 +122,7 @@ + #ifdef LOCKFILE_DIR + #define LOCKFILE LOCKFILE_DIR "/p910%cd"
Wouldn't it be possible to simply add -DLOCKFILE_DIR='"/var/lock"' to CFLAGS
(if the Makefile allows extending CFLAGS with something extra).
Quoted 35 lines
package/p910nd/p910nd-0.95-use_var-lock-instead-of-var_log_subsys_p910nd.patch new file +6
-0+ #else +-#define LOCKFILE "/var/lock/subsys/p910%cd" ++#define LOCKFILE "/var/lock/p910%cd" + #endif + #ifndef PRINTERFILE + #define PRINTERFILE "/dev/lp%c"package/p910nd/p910nd.default new file +9
-0@@ -0,0 +1,9 @@ +# 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/lp0package/p910nd/p910nd.mk new file +8
-0@@ -0,0 +1,23 @@ +############################################################# +# +# p910nd +# +############################################################# + +P910ND_VERSION = 0.95 +P910ND_SITE =
Use $(BR2_SOURCEFORGE_MIRROR) instead of a fixed mirror (voxel).
Also, it looks like your patch is line-wrapped, so it won't apply cleanly.
The easiest way to avoid this is to use git send-email (see the man page on how to use it with gmail).
package/p910nd/p910nd.mk
Quoted 4 lines
package/p910nd/p910nd.mk new file +4
-0+P910ND_SOURCE = p910nd-$(P910ND_VERSION).tar.bz2 + +define P910ND_BUILD_CMDS + $(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_LD)" -C $(@D)
Nowadays, we usually use
$(MAKE) $(TARGET_CONFIGURE_OPTS) $(P910ND_MAKE_OPTS) -C $(@D)
where P910ND_MAKE_OPTS are the extra make flags, if any (in this case none).
package/p910nd/p910nd.mk
Quoted 5 lines
package/p910nd/p910nd.mk new file +5
-0+endef + +define P910ND_INSTALL_TARGET_CMDS + $(INSTALL) -D -m 0755 $(@D)/p910nd $(TARGET_DIR)/usr/sbin/p910nd + $(INSTALL) -d -m 0755 $(TARGET_DIR)/etc/default
Creating the directory is done automatically by the -D option used below.
Quoted 2 lines
package/p910nd/p910nd.mk new file +1
-0+ $(INSTALL) -m 0755 -D package/p910nd/p910nd.default$(TARGET_DIR)/etc/default/p910nd
This one shouldn't be executable (mode 0644 instead of 0755).
package/p910nd/p910nd.mk
Quoted 6 lines
package/p910nd/p910nd.mk new file +1
-0+ $(INSTALL) -m 0755 -D package/p910nd/S55p910nd$(TARGET_DIR)/etc/init.d/S55p910nd
package/p910nd/p910nd.mk new file +4
-0+ +endef + +$(eval $(call GENTARGETS,package,p910nd))
The extra arguments for GENTARGETS are unnecessary.
Regards,
Arnout
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286540 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
PATCH RESEND 1/1 new package : p910nd print server
Arnout, bedankt ...
Your comments were very insightful and helpful. I addressed each item you mentioned... [do I need to put a version history (listing changes) with my V2 patch?]
Quoted 3 lines · Arnout Vandecappelle
Quoted 1 line · David Purdy
?Please include a Signed-off-by line for yourself.
Yes, I normally do... it was actually a "resend" of the original git send-email-generated patch, I guess no one saw the original one... ?
Quoted 3 lines
?The rest of my comments are a bit of nitpicking.
**Nitpicking?** Certainly just good suggestions - I highly appreciate them. Hartelijk bedankt!
Quoted 11 lines
[snip]
Quoted 9 lines
package/p910nd/Config.in new file +3
-0@@ -0,0 +1,8 @@ +config BR2_PACKAGE_P910ND + ? ? ? bool "p910nd" + ? ? ? help
Quoted 8 lines
package/p910nd/Config.in line 8
Quoted 5 lines
package/p910nd/Config.in new file +5
-0+ ? ? ? ? p910nd is a small printer daemon intended for diskless + ? ? ? ? workstations. Using ports 9100-9102, it accepts + ? ? ? ? print jobs and passes them directly to a USB printer. + + ? ? ? ? http://p910nd.sourceforge.net/?Doesn't this package rely on any external libary at all? Not even libusb?
Nope, none at all.
Quoted 15 lines
package/p910nd/S55p910nd line 3
Quoted 9 lines
package/p910nd/S55p910nd new file +3
-0@@ -0,0 +1,48 @@ +#!/bin/sh + +DEFAULT=/etc/default/p910nd?We don't normally have a
/etc/defaultdirectory. ?Even so, it normally contains shell fragments rather than configuration files (at least it does on Debian+derivatives).
Quoted 1 line
?Instead I would name the config file
/etc/p910nd.conf
Done, you are right, it makes better sense.
Quoted 8 lines
package/p910nd/S55p910nd line 7
Quoted 5 lines
package/p910nd/S55p910nd new file +4
-0+RUN_D=/var/run + +_start() { + mkdir -p $RUN_D?We usually use tabs to indent shell scripts.
Fixed.
Quoted 19 lines
package/p910nd/S55p910nd line 8
Quoted 2 lines
package/p910nd/S55p910nd new file +1
-0+ [ -f $DEFAULT ]&& ?(?Space between ] and &&
?The sub-shell isn't needed, { ... } would be sufficient. Or it could even be left out since there's only one command (while) inside.
package/p910nd/S55p910nd line 14
Quoted 6 lines
package/p910nd/S55p910nd new file +6
-0+ ?while read port options; do + ? case "$port" in + ? ?""|\#*) + ? ? continue; + ? esac + ? p910nd $options $port
Quoted 1 line
?We usually use start-stop-daemon to control daemons.
Will also change & clean up the entire initscript...
Quoted 23 lines
Quoted 8 lines
package/p910nd/S55p910nd new file +7
-0+ ? if [ $? -ne 0 ]; then + ? ?exit 1 + ? fi + ?done + )< ?$DEFAULT + exit 0 +}package/p910nd/S55p910nd line 31
Quoted 10 lines
package/p910nd/S55p910nd new file +10
-0+ +_stop() { + [ -f $DEFAULT ]&& ?( + ?while read port options; do + ? case "$port" in + ? ?""|\#*) + ? ? continue; + ? esac + ? PID_F=$RUN_D/p910${port}d.pid + ? [ -f $PID_F ]&& ?kill $(cat $PID_F)?This has the annoying effect of not killing things properly if the configuration file has changed. ?What about:
Quoted 3 lines
? ? ? ?for
PID_Fin $RUN_D/p910?d.pid; do
? ? ? ? ? ? ? ?start-stop-daemon -K -p $PID_F -x/usr/sbin/p910nd? ? ? ?done
Thanks for this - I'll certainly try to incorporate it.
Quoted 9 lines
Quoted 9 lines
package/p910nd/S55p910nd new file +9
-0+ ? rm $PID_F + ?done + )< ?$DEFAULT +} + +case $1 in + start) + ?_start + ?;;
Quoted 8 lines
package/p910nd/S55p910nd line 45
Quoted 5 lines
package/p910nd/S55p910nd new file +5
-0+ stop) + ?_stop + ?;; + *) + ?echo "usage: $0 (start|stop)"?Please add a restart as well.
Yup, that makes sense as well.
Quoted 6 lines
Quoted 6 lines
package/p910nd/S55p910nd new file +3
-0+ ?exit 1 +esac +exit $?diff --git
a/package/p910nd/p910nd-0.95-use_var-lock-instead-of-var_log_subsys_p910nd.patch
Quoted 13 lines
package/p910nd/S55p910nd line 1
Quoted 8 lines
b/package/p910nd/p910nd-0.95-use_var-lock-instead-of-var_log_subsys_p910nd.patchnew file mode 100644
index 0000000..867b8cf
---/dev/null
+++b/package/p910nd/p910nd-0.95-use_var-lock-instead-of-var_log_subsys_p910nd.patchpackage/p910nd/S55p910nd new file +1
-0@@ -0,0 +1,13 @@ +Index: p910nd/p910nd.c?Patches should start with a comment explaining what the patch does and why it is needed, just like a commit message. ?It should also contain a Signed-off-by line.
With your suggestions about P910ND_MAKE_OPTS, the patch is unnecessary (yes, simpler this way) - thanks for the idea.
Quoted 44 lines
package/p910nd/S55p910nd line 7
Quoted 6 lines
package/p910nd/S55p910nd new file +6
-0+=================================================================== +--- p910nd.orig/p910nd.c ? ? ? 2011-11-14 22:47:41.986401420 +0100 ++++ p910nd/p910nd.c ? ?2011-11-14 22:49:27.274923524 +0100 +@@ -122,7 +122,7 @@ + #ifdef ? ? ? ? ? ? ? ?LOCKFILE_DIR + #define ? ? ? ? ? ? ? LOCKFILE ? ? ? ?LOCKFILE_DIR "/p910%cd"?Wouldn't it be possible to simply add -DLOCKFILE_DIR='"/var/lock"' to CFLAGS
(if theMakefileallows extending CFLAGS with something extra).Quoted 31 lines
package/p910nd/S55p910nd new file +6
-0+ #else +-#define ? ? ? ? ? ? ? LOCKFILE ? ? ? ?"/var/lock/subsys/p910%cd" ++#define ? ? ? ? ? ? ? LOCKFILE ? ? ? ?"/var/lock/p910%cd" + #endif + #ifndef ? ? ? ? ? ? ? PRINTERFILE + #define ? ? ? ? PRINTERFILE ? ? "/dev/lp%c"package/p910nd/p910nd.default new file +9
-0@@ -0,0 +1,9 @@ +# 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/lp0package/p910nd/p910nd.mk new file +4
-0@@ -0,0 +1,23 @@ +############################################################# +# +# p910nd +#
Quoted 8 lines
Quoted 5 lines
package/p910nd/p910nd.mk new file +4
-0+############################################################# + +P910ND_VERSION = 0.95 +P910ND_SITE =http://voxel.dl.sourceforge.net/project/p910nd/p910nd/$(P910ND_VERSION)
?Use $(BR2_SOURCEFORGE_MIRROR) instead of a fixed mirror (voxel).
Also fixed to be standardized as all the other packages/*.mk files that utilize SourceForge...
Quoted 3 lines
?Also, it looks like your patch is line-wrapped, so it won't apply cleanly. The easiest way to avoid this is to use git send-email (see the man page on how to use it with gmail).
Addressed above...
Quoted 8 lines
package/p910nd/p910nd.mk
Quoted 4 lines
package/p910nd/p910nd.mk new file +4
-0+P910ND_SOURCE = p910nd-$(P910ND_VERSION).tar.bz2 + +define P910ND_BUILD_CMDS + ? ? ? $(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_LD)" -C $(@D)?Nowadays, we usually use
Quoted 4 lines
$(MAKE) $(TARGET_CONFIGURE_OPTS) $(P910ND_MAKE_OPTS) -C $(@D)
where
P910ND_MAKE_OPTSare the extra make flags, if any (in this case none).
Yes, addressed as well. Thanks.
Quoted 8 lines
package/p910nd/p910nd.mk
Quoted 5 lines
package/p910nd/p910nd.mk new file +5
-0+endef + +define P910ND_INSTALL_TARGET_CMDS + ? ? ? $(INSTALL) -D -m 0755 $(@D)/p910nd $(TARGET_DIR)/usr/sbin/p910nd + ? ? ? $(INSTALL) -d -m 0755 $(TARGET_DIR)/etc/default?Creating the directory is done automatically by the -D option used below.
Unneeded, since p910nd.conf will live in /etc
Quoted 5 lines
Quoted 2 lines
+ ? ? ? $(INSTALL) -m 0755 -D package/p910nd/p910nd.default $(TARGET_DIR)/etc/default/p910nd
?This one shouldn't be executable (mode 0644 instead of 0755).
Fixed.
Quoted 9 lines
package/p910nd/p910nd.mk
Quoted 6 lines
+ ? ? ? $(INSTALL) -m 0755 -D package/p910nd/S55p910nd $(TARGET_DIR)/etc/init.d/S55p910nd
package/p910nd/p910nd.mk new file +4
-0+ +endef + +$(eval $(call GENTARGETS,package,p910nd))?The extra arguments for GENTARGETS are unnecessary.
Yes, you're right.
Quoted 8 lines
?Regards,
?Arnout--
Arnout Vandecappelle ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? arnout at mind be Senior Embedded Software Architect ? ? ? ? ? ? ? ? +32-16-286540 Essensium/Mind ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium ? ? ? ? ? ? ? ?BE 872 984 063 RPR Leuven
Overall, this actually shortened and cleaned it up a lot, both for the package files, and when installed, as well.
Will send a [PATCH V2] within a few days.
regards, thanks,
Dave Purdy