wok-tiny view p910nd/receipt @ rev 82

fix p910nd
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Jul 20 00:33:31 2012 +0200 (2012-07-20)
parents dc79b649a4b9
children c5d2f4ae4c16
line source
1 # SliTaz package receipt.
3 PACKAGE="p910nd"
4 VERSION="0.93"
5 CATEGORY="network"
6 SHORT_DESC="Forward printer device to 9100+ ports"
7 MAINTAINER="pascal.bellard@slitaz.org"
8 TARBALL="$PACKAGE-$VERSION.tar.bz2"
9 WEB_SITE="http://p910nd.sourceforge.net/"
10 WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
11 [ -n "$TARGET" ] || TARGET="i486"
12 BUILD_DEPENDS="uclibc-cross-compiler-$TARGET"
13 DEPENDS="base-tiny"
14 CONFIG_FILES="/etc/inetd.conf /etc/rcS.conf"
16 # Rules to configure and make the package.
17 compile_rules()
18 {
19 cd $src
20 make CC=uclibc-$TARGET-cc CFLAGS=-DLOCKFILE_DIR=\\\"/var/lock\\\" &&
21 make DESTDIR=$PWD/_pkg install
22 }
24 # Rules to gen a SliTaz package suitable for Tazpkg.
25 genpkg_rules()
26 {
27 mkdir -p $fs/usr $fs/etc/init.d $fs/dev
28 cp -a $_pkg/usr/sbin $fs/usr
29 ln -s daemon $fs/etc/init.d/p910nd
30 mkdir $fs/dev
31 }
33 post_install()
34 {
35 [ -n "$DEVICES" ] || DEVICES="/dev/lp0"
36 grep -q inetd $1/etc/rcS.conf ||
37 sed -i 's/^RUN_DAEMONS="/&inetd /' $1/etc/rcS.conf
38 grep -q p910nd $1/etc/rcS.conf ||
39 sed -i 's/^RUN_DAEMONS="/&p910nd /' $1/etc/rcS.conf
40 grep -q p910nd $1/etc/inetd.conf ||
41 echo "$DEVICES" | dos2unix | awk '{ if ($1 != "") printf \
42 "%d stream tcp nowait root %s %s -b -f %s\n", 9100 + n++, \
43 "/usr/sbin/p910nd", "/usr/sbin/p910nd", $1 }' >> $1/etc/inetd.conf
44 for dev in $(cat $DEVICES | dos2unix); do
45 mknod -m 660 $1$dev c 6 ${dev#*lp}
46 done
47 }
49 config_form()
50 {
51 [ -n "$DEVICES" ] || DEVICES=/dev/lp0
52 grep -q p910nd $1/etc/inetd.conf && return 1
53 cat <<EOT
54 Printer device(s):
55 <textarea name="DEVICES">
56 $DEVICES
57 </textarea>
58 EOT
59 }