source: trunk/debathena/third/lprng/debathenify-lprng @ 23067

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