[23006] | 1 | #!/bin/sh |
---|
| 2 | set -e |
---|
| 3 | |
---|
| 4 | name=lprng |
---|
[23067] | 5 | daversionappend=debathena4 |
---|
[23078] | 6 | section=debathena |
---|
[23006] | 7 | |
---|
| 8 | hack_package () { |
---|
[23017] | 9 | # Rename the package and make it not conflict with lpr or cupsys-bsd. |
---|
[23006] | 10 | perl -pe 's/^Package: lprng$/Package: debathena-lprng/' -i debian/control |
---|
[23017] | 11 | perl -ne '/^Provides: lpr$/ || print;' -i debian/control |
---|
| 12 | perl -pe '/^Conflicts/ && s/lpr, //' -i debian/control |
---|
[23006] | 13 | perl -pe '/^Conflicts/ && s/cupsys-bsd/lprng/' -i debian/control |
---|
[23017] | 14 | perl -pe '/^Replaces/ && s/lpr/lprng/' -i debian/control |
---|
[23006] | 15 | |
---|
| 16 | perl -n -i - debian/rules << 'EOS' |
---|
| 17 | if (/^build:/) { |
---|
| 18 | # lprng has a gcc 4.2.3-related build failure on some dists. |
---|
| 19 | # src/common/plp_snprintf.c uses a macro safestrlen() on |
---|
| 20 | # character arrays in four places; the macro triggers GCC's |
---|
| 21 | # -Waddress warning since it tests for the falsehood of an |
---|
| 22 | # array address. This is a workaround. |
---|
| 23 | print "confflags += --disable-werror\n"; |
---|
| 24 | } |
---|
| 25 | |
---|
| 26 | # Since we're renaming the main package, we have to adjust |
---|
| 27 | # where things get installed. But make sure not to change |
---|
| 28 | # references to debian/lprng-doc, which we aren't renaming. |
---|
| 29 | s|debian/lprng|debian/debathena-lprng|; |
---|
| 30 | s|debian/debathena-lprng-doc|debian/lprng-doc|; |
---|
| 31 | |
---|
| 32 | print; |
---|
| 33 | |
---|
| 34 | # Rename the commands. |
---|
| 35 | if (/^[^#]*MAKE.*install/) { |
---|
| 36 | my $usr = "debian/debathena-lprng/usr"; |
---|
| 37 | my $man1 = "$usr/share/man/man1"; |
---|
| 38 | my $man8 = "$usr/share/man/man8"; |
---|
| 39 | print "\trm $usr/bin/cancel\n"; |
---|
| 40 | print "\tln -s mit-lprm $usr/bin/cancel\n"; |
---|
| 41 | print "\trm $usr/bin/lp\n"; |
---|
| 42 | print "\tln -s mit-lpr $usr/bin/lp\n"; |
---|
| 43 | print "\tmv $usr/bin/cancel $usr/bin/mit-cancel\n"; |
---|
| 44 | print "\tmv $usr/bin/lp $usr/bin/mit-lp\n"; |
---|
| 45 | print "\tmv $usr/bin/lpq $usr/bin/mit-lpq\n"; |
---|
| 46 | print "\tmv $usr/bin/lprm $usr/bin/mit-lprm\n"; |
---|
| 47 | print "\tmv $usr/bin/lpr $usr/bin/mit-lpr\n"; |
---|
| 48 | print "\tmv $usr/bin/lpstat $usr/bin/mit-lpstat\n"; |
---|
| 49 | print "\tmv $usr/sbin/lpc $usr/sbin/mit-lpc\n"; |
---|
| 50 | print "\tmv $man1/cancel.1 $man1/mit-cancel.1\n"; |
---|
| 51 | print "\tmv $man1/lp.1 $man1/mit-lp.1\n"; |
---|
| 52 | print "\tmv $man1/lpq.1 $man1/mit-lpq.1\n"; |
---|
| 53 | print "\tmv $man1/lprm.1 $man1/mit-lprm.1\n"; |
---|
| 54 | print "\tmv $man1/lpr.1 $man1/mit-lpr.1\n"; |
---|
| 55 | print "\tmv $man1/lpstat.1 $man1/mit-lpstat.1\n"; |
---|
| 56 | print "\tmv $man8/lpc.8 $man8/mit-lpc.8\n"; |
---|
| 57 | } |
---|
| 58 | EOS |
---|
| 59 | |
---|
[23016] | 60 | # The postinst script sets or unsets the setuid bit of |
---|
| 61 | # lpr/lprm/lpq and thus needs to be adjusted for the command |
---|
| 62 | # renaming. |
---|
| 63 | perl -pe 's|/usr/bin/lp|/usr/bin/mit-lp|' -i debian/postinst |
---|
| 64 | |
---|
[23006] | 65 | # The renamed binary package no longer matches the source package |
---|
| 66 | # name, so we have to rename a bunch of debhelper files. |
---|
[23007] | 67 | for f in config cron.daily dirs examples init.d mime postinst postrm \ |
---|
| 68 | preinst prerm templates; do |
---|
[23010] | 69 | [ -f debian/$f ] && mv debian/$f debian/debathena-lprng.$f |
---|
[23006] | 70 | done |
---|
| 71 | perl -pe 's/templates/debathena-lprng.templates/' -i debian/po/POTFILES.in |
---|
| 72 | |
---|
[23008] | 73 | # lprng's cron job generates mail to root each day if you're not |
---|
| 74 | # running a server. Fix this problem by making the cron script |
---|
| 75 | # conditional on the existence of /etc/printcap, just as the |
---|
| 76 | # init.d script is. |
---|
| 77 | perl -ne 'print; /#.*main/ && print "[ -f /etc/printcap ] || exit 0\n";' \ |
---|
| 78 | -i debian/debathena-lprng.cron.daily |
---|
| 79 | |
---|
[23006] | 80 | append_description <<EOF |
---|
| 81 | . |
---|
[23377] | 82 | This package was rebuilt for the Debathena project to rename the |
---|
[23006] | 83 | package and commands so that it no longer conflicts with cupsys-bsd. |
---|
| 84 | EOF |
---|
| 85 | add_changelog 'Rename commands.' |
---|
[23078] | 86 | munge_sections |
---|
[23006] | 87 | } |
---|
| 88 | |
---|
| 89 | . ../common/debathenificator.sh |
---|