├── debian ├── compat ├── source │ └── format ├── config-package-dev.docs ├── config-package-dev.examples ├── config-package-dev.manpages ├── tests │ ├── control │ └── examples ├── rules ├── config-package-dev.install ├── control ├── copyright └── changelog ├── examples ├── cdbs │ ├── debathena-bin-example-1.0 │ │ └── debian │ │ │ ├── compat │ │ │ ├── debathena-bin-example.install │ │ │ ├── less.debathena │ │ │ ├── changelog │ │ │ ├── elinks.debathena │ │ │ ├── control.in │ │ │ ├── control │ │ │ ├── rules │ │ │ └── copyright │ ├── debathena-bin-example-1.1 │ │ └── debian │ │ │ ├── compat │ │ │ ├── debathena-bin-example.install │ │ │ ├── less.debathena │ │ │ ├── changelog │ │ │ ├── control.in │ │ │ ├── control │ │ │ ├── rules │ │ │ └── copyright │ ├── debathena-cron-example-1.0 │ │ └── debian │ │ │ ├── compat │ │ │ ├── changelog │ │ │ ├── debathena-cron-example.cron.d │ │ │ ├── control.in │ │ │ ├── control │ │ │ ├── rules │ │ │ └── copyright │ ├── debathena-conffile-example-1.0 │ │ ├── debian │ │ │ ├── compat │ │ │ ├── debathena-conffile-example.install │ │ │ ├── changelog │ │ │ ├── rules │ │ │ ├── control.in │ │ │ ├── control │ │ │ └── copyright │ │ └── files │ │ │ └── etc │ │ │ └── issue.net.debathena │ ├── debathena-conffile-example-1.1 │ │ ├── debian │ │ │ ├── compat │ │ │ ├── debathena-conffile-example.install │ │ │ ├── transform_legal.debathena │ │ │ ├── changelog │ │ │ ├── control.in │ │ │ ├── control │ │ │ ├── rules │ │ │ └── copyright │ │ └── files │ │ │ └── etc │ │ │ └── issue.net.debathena │ └── debathena-transform-example-1.0 │ │ └── debian │ │ ├── compat │ │ ├── changelog │ │ ├── rules │ │ ├── transform_lynx.cfg.debathena │ │ ├── control.in │ │ ├── control │ │ └── copyright ├── debhelper │ ├── debathena-bin-example-1.0 │ │ └── debian │ │ │ ├── compat │ │ │ ├── source │ │ │ └── format │ │ │ ├── rules │ │ │ ├── debathena-bin-example.install │ │ │ ├── less.debathena │ │ │ ├── changelog │ │ │ ├── debathena-bin-example.displace │ │ │ ├── debathena-bin-example.links │ │ │ ├── elinks.debathena │ │ │ ├── control │ │ │ └── copyright │ ├── debathena-bin-example-1.1 │ │ └── debian │ │ │ ├── compat │ │ │ ├── source │ │ │ └── format │ │ │ ├── debathena-bin-example.install │ │ │ ├── rules │ │ │ ├── debathena-bin-example.displace │ │ │ ├── debathena-bin-example.undisplace │ │ │ ├── debathena-bin-example.links │ │ │ ├── less.debathena │ │ │ ├── changelog │ │ │ ├── control │ │ │ └── copyright │ ├── debathena-cron-example-1.0 │ │ └── debian │ │ │ ├── compat │ │ │ ├── source │ │ │ └── format │ │ │ ├── debathena-cron-example.hide │ │ │ ├── rules │ │ │ ├── changelog │ │ │ ├── debathena-cron-example.cron.d │ │ │ ├── control │ │ │ └── copyright │ ├── debathena-conffile-example-1.0 │ │ ├── debian │ │ │ ├── compat │ │ │ ├── source │ │ │ │ └── format │ │ │ ├── debathena-conffile-example.install │ │ │ ├── debathena-conffile-example.displace │ │ │ ├── rules │ │ │ ├── changelog │ │ │ ├── control │ │ │ └── copyright │ │ └── files │ │ │ └── etc │ │ │ └── issue.net.debathena │ ├── debathena-conffile-example-1.1 │ │ ├── debian │ │ │ ├── compat │ │ │ ├── source │ │ │ │ └── format │ │ │ ├── debathena-conffile-example.install │ │ │ ├── debathena-conffile-example.displace │ │ │ ├── transform_legal.debathena │ │ │ ├── rules │ │ │ ├── changelog │ │ │ ├── control │ │ │ └── copyright │ │ └── files │ │ │ └── etc │ │ │ └── issue.net.debathena │ └── debathena-transform-example-1.0 │ │ └── debian │ │ ├── compat │ │ ├── source │ │ └── format │ │ ├── rules │ │ ├── debathena-transform-example.transform │ │ ├── changelog │ │ ├── control │ │ └── copyright ├── .gitignore └── EXAMPLES ├── .gitignore ├── .travis.yml ├── lib └── Debian │ └── Debhelper │ ├── Sequence │ └── config_package.pm │ └── config_package.pm ├── decode ├── doc └── DOCUMENTATION ├── encode ├── debconf-hack.sh ├── transform-files.mk ├── README.md ├── debconf-divert.mk ├── check-files.mk ├── displace.sh.in ├── config-package.mk ├── displace.mk └── dh_configpackage /debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /debian/config-package-dev.docs: -------------------------------------------------------------------------------- 1 | doc/* 2 | -------------------------------------------------------------------------------- /debian/config-package-dev.examples: -------------------------------------------------------------------------------- 1 | examples/* 2 | -------------------------------------------------------------------------------- /debian/config-package-dev.manpages: -------------------------------------------------------------------------------- 1 | dh_configpackage.1 2 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-bin-example-1.0/debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-bin-example-1.1/debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-cron-example-1.0/debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-conffile-example-1.0/debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-conffile-example-1.1/debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-transform-example-1.0/debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-bin-example-1.0/debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-bin-example-1.1/debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-cron-example-1.0/debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-conffile-example-1.0/debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-conffile-example-1.1/debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-transform-example-1.0/debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-bin-example-1.0/debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-bin-example-1.1/debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-cron-example-1.0/debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-conffile-example-1.0/debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-conffile-example-1.1/debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-transform-example-1.0/debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-conffile-example-1.0/debian/debathena-conffile-example.install: -------------------------------------------------------------------------------- 1 | files/* / 2 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-conffile-example-1.1/debian/debathena-conffile-example.install: -------------------------------------------------------------------------------- 1 | files/* / 2 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-conffile-example-1.0/debian/debathena-conffile-example.install: -------------------------------------------------------------------------------- 1 | files/* / 2 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-conffile-example-1.1/debian/debathena-conffile-example.install: -------------------------------------------------------------------------------- 1 | files/* / 2 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-cron-example-1.0/debian/debathena-cron-example.hide: -------------------------------------------------------------------------------- 1 | /etc/cron.d/logcheck 2 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-bin-example-1.1/debian/debathena-bin-example.install: -------------------------------------------------------------------------------- 1 | debian/less.debathena usr/bin 2 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-bin-example-1.1/debian/debathena-bin-example.install: -------------------------------------------------------------------------------- 1 | debian/less.debathena usr/bin 2 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-conffile-example-1.0/debian/debathena-conffile-example.displace: -------------------------------------------------------------------------------- 1 | /etc/issue.net.debathena 2 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-conffile-example-1.1/debian/debathena-conffile-example.displace: -------------------------------------------------------------------------------- 1 | /etc/issue.net.debathena 2 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-bin-example-1.0/debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | %: 4 | dh $@ --with=config-package 5 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-bin-example-1.1/debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | %: 4 | dh $@ --with=config-package 5 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-cron-example-1.0/debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | %: 4 | dh $@ --with=config-package 5 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-conffile-example-1.0/debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | %: 4 | dh $@ --with config-package 5 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-transform-example-1.0/debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | %: 4 | dh $@ --with=config-package 5 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-conffile-example-1.0/files/etc/issue.net.debathena: -------------------------------------------------------------------------------- 1 | Debian Linux running debathena-conffile-example version 1.0 2 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-conffile-example-1.1/files/etc/issue.net.debathena: -------------------------------------------------------------------------------- 1 | Debian Linux running debathena-conffile-example version 1.0 2 | -------------------------------------------------------------------------------- /debian/tests/control: -------------------------------------------------------------------------------- 1 | Tests: examples 2 | Depends: @, build-essential, debhelper, cdbs, dh-buildinfo, lynx 3 | Restrictions: allow-stderr 4 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-conffile-example-1.0/files/etc/issue.net.debathena: -------------------------------------------------------------------------------- 1 | Debian Linux running debathena-conffile-example version 1.0 2 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-conffile-example-1.1/files/etc/issue.net.debathena: -------------------------------------------------------------------------------- 1 | Debian Linux running debathena-conffile-example version 1.0 2 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-bin-example-1.0/debian/debathena-bin-example.install: -------------------------------------------------------------------------------- 1 | debian/elinks.debathena usr/bin 2 | debian/less.debathena usr/bin 3 | -------------------------------------------------------------------------------- /debian/tests/examples: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -eu 4 | 5 | for pkg in examples/*/*/; do 6 | (cd "$pkg" && dpkg-buildpackage --no-sign) 7 | done 8 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-bin-example-1.0/debian/debathena-bin-example.install: -------------------------------------------------------------------------------- 1 | debian/elinks.debathena usr/bin 2 | debian/less.debathena usr/bin 3 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-bin-example-1.1/debian/debathena-bin-example.displace: -------------------------------------------------------------------------------- 1 | /usr/bin/less.debathena 2 | /usr/share/man/man1/less.debathena.1.gz 3 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-bin-example-1.1/debian/debathena-bin-example.undisplace: -------------------------------------------------------------------------------- 1 | /usr/bin/elinks.debathena 2 | /usr/share/man/man1/elinks.debathena.1.gz 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | debian/config-package-dev.debhelper.log 2 | debian/config-package-dev.substvars 3 | debian/config-package-dev/ 4 | debian/files 5 | dh_configpackage.1 6 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-bin-example-1.1/debian/debathena-bin-example.links: -------------------------------------------------------------------------------- 1 | /usr/share/man/man1/less.debathena-orig.1.gz /usr/share/man/man1/less.debathena.1.gz 2 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-bin-example-1.0/debian/less.debathena: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Wrapper to make less read tarballs and so on. 3 | eval $(lesspipe) 4 | exec less.debathena-orig "$@" 5 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-bin-example-1.1/debian/less.debathena: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Wrapper to make less read tarballs and so on. 3 | eval $(lesspipe) 4 | exec less.debathena-orig "$@" 5 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-bin-example-1.0/debian/less.debathena: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Wrapper to make less read tarballs and so on. 3 | eval $(lesspipe) 4 | exec less.debathena-orig "$@" 5 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-bin-example-1.1/debian/less.debathena: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Wrapper to make less read tarballs and so on. 3 | eval $(lesspipe) 4 | exec less.debathena-orig "$@" 5 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-transform-example-1.0/debian/debathena-transform-example.transform: -------------------------------------------------------------------------------- 1 | /etc/lynx/lynx.cfg.debathena perl -0pe 's|^#STARTFILE:.*$|$&\nSTARTFILE:http://web.mit.edu/|m or die' 2 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-bin-example-1.0/debian/changelog: -------------------------------------------------------------------------------- 1 | debathena-bin-example (1.0) unstable; urgency=low 2 | 3 | * Initial release. 4 | 5 | -- Tim Abbott Sun, 13 Jul 2008 00:37:03 -0400 6 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-cron-example-1.0/debian/changelog: -------------------------------------------------------------------------------- 1 | debathena-cron-example (1.0) unstable; urgency=low 2 | 3 | * Initial release. 4 | 5 | -- Tim Abbott Sun, 13 Jul 2008 00:37:03 -0400 6 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-conffile-example-1.0/debian/changelog: -------------------------------------------------------------------------------- 1 | debathena-conffile-example (1.0) unstable; urgency=low 2 | 3 | * Initial release. 4 | 5 | -- Tim Abbott Sun, 13 Jul 2008 00:37:03 -0400 6 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-transform-example-1.0/debian/changelog: -------------------------------------------------------------------------------- 1 | debathena-transform-example (1.0) unstable; urgency=low 2 | 3 | * Initial release. 4 | 5 | -- Tim Abbott Sun, 13 Jul 2008 00:37:03 -0400 6 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-bin-example-1.0/debian/changelog: -------------------------------------------------------------------------------- 1 | debathena-bin-example (1.0) unstable; urgency=low 2 | 3 | * Initial release. 4 | 5 | -- Geoffrey Thomas Tue, 11 Sep 2012 12:39:03 -0700 6 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-cron-example-1.0/debian/changelog: -------------------------------------------------------------------------------- 1 | debathena-cron-example (1.0) unstable; urgency=low 2 | 3 | * Initial release. 4 | 5 | -- Geoffrey Thomas Mon, 17 Sep 2012 23:55:40 -0700 6 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | language: generic 3 | 4 | services: 5 | - docker 6 | 7 | script: 8 | - wget -O- http://travis.debian.net/script.sh | sh - 9 | 10 | env: 11 | - TRAVIS_DEBIAN_DISTRIBUTION=unstable 12 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-bin-example-1.0/debian/debathena-bin-example.displace: -------------------------------------------------------------------------------- 1 | /usr/bin/elinks.debathena 2 | /usr/bin/less.debathena 3 | /usr/share/man/man1/elinks.debathena.1.gz 4 | /usr/share/man/man1/less.debathena.1.gz 5 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-conffile-example-1.0/debian/changelog: -------------------------------------------------------------------------------- 1 | debathena-conffile-example (1.0) unstable; urgency=low 2 | 3 | * Initial release. 4 | 5 | -- Geoffrey Thomas Wed, 08 Aug 2012 18:37:54 -0700 6 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-transform-example-1.0/debian/changelog: -------------------------------------------------------------------------------- 1 | debathena-transform-example (1.0) unstable; urgency=low 2 | 3 | * Initial release. 4 | 5 | -- Geoffrey Thomas Mon, 17 Sep 2012 23:45:47 -0700 6 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-bin-example-1.0/debian/debathena-bin-example.links: -------------------------------------------------------------------------------- 1 | /usr/share/man/man1/elinks.debathena-orig.1.gz /usr/share/man/man1/elinks.debathena.1.gz 2 | /usr/share/man/man1/less.debathena-orig.1.gz /usr/share/man/man1/less.debathena.1.gz 3 | -------------------------------------------------------------------------------- /lib/Debian/Debhelper/Sequence/config_package.pm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # debhelper sequence file for config-package-dev 3 | 4 | use warnings; 5 | use strict; 6 | use Debian::Debhelper::Dh_Lib; 7 | 8 | insert_before("dh_link", "dh_configpackage"); 9 | 10 | 1 11 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-conffile-example-1.1/debian/transform_legal.debathena: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cat 4 | echo 5 | echo "Use of Athena facilities is restricted to authorized holders of Athena" 6 | echo "accounts (MIT students, faculty, staff, and other authorized guests.)" 7 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-conffile-example-1.1/debian/transform_legal.debathena: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cat 4 | echo 5 | echo "Use of Athena facilities is restricted to authorized holders of Athena" 6 | echo "accounts (MIT students, faculty, staff, and other authorized guests.)" 7 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-bin-example-1.0/debian/elinks.debathena: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Wrapper to make elinks put its UNIX sockets under /tmp rather than in $HOME. 3 | # Works around . 4 | TMPDIR=mktemp -d 5 | export ELINKS_CONFDIR=$TMPDIR 6 | exec elinks.debathena-orig "$@"x 7 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-bin-example-1.0/debian/elinks.debathena: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Wrapper to make elinks put its UNIX sockets under /tmp rather than in $HOME. 3 | # Works around . 4 | TMPDIR=mktemp -d 5 | export ELINKS_CONFDIR=$TMPDIR 6 | exec elinks.debathena-orig "$@"x 7 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-conffile-example-1.1/debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | %: 4 | dh $@ --with config-package 5 | 6 | override_dh_configpackage: 7 | dh_configpackage 8 | ifneq ($(wildcard /etc/sysctl.d/10-ptrace.conf),) 9 | dh_configpackage --hide /etc/sysctl.d/10-ptrace.conf 10 | endif 11 | -------------------------------------------------------------------------------- /examples/.gitignore: -------------------------------------------------------------------------------- 1 | */*/debian/*.debhelper.log 2 | */*/debian/*.postinst.debhelper 3 | */*/debian/*.prerm.debhelper 4 | */*/debian/*.substvars 5 | */*/debian/*/ 6 | !*/*/debian/source/ 7 | */*/debian/files 8 | */*.dsc 9 | */*.tar.gz 10 | */*.tar.xz 11 | */*.deb 12 | */*.build 13 | */*.changes 14 | */*.buildinfo 15 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-transform-example-1.0/debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | DEB_DISPLACE_EXTENSION = .debathena 4 | DEB_TRANSFORM_FILES_debathena-transform-example += \ 5 | /etc/lynx/lynx.cfg.debathena 6 | 7 | include /usr/share/cdbs/1/rules/debhelper.mk 8 | include /usr/share/cdbs/1/rules/config-package.mk 9 | -------------------------------------------------------------------------------- /decode: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # Reverse the encoding performed by the "encode" helper. 3 | # 4 | # This is not currently used by config-package-dev itself, but can by 5 | # used by helper programs that want to determine what files are diverted 6 | # by a package generated using this system. 7 | 8 | use strict; 9 | use warnings; 10 | use Debian::Debhelper::config_package; 11 | 12 | print decode($ARGV[0]); 13 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-bin-example-1.1/debian/changelog: -------------------------------------------------------------------------------- 1 | debathena-bin-example (1.1) unstable; urgency=low 2 | 3 | * suppose elinks bug is fixed; stop displacing elinks. 4 | 5 | -- Tim Abbott Sun, 13 Jul 2008 02:06:39 -0400 6 | 7 | debathena-bin-example (1.0) unstable; urgency=low 8 | 9 | * Initial release. 10 | 11 | -- Tim Abbott Sun, 13 Jul 2008 00:37:03 -0400 12 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-bin-example-1.1/debian/changelog: -------------------------------------------------------------------------------- 1 | debathena-bin-example (1.1) unstable; urgency=low 2 | 3 | * suppose elinks bug is fixed; stop displacing elinks. 4 | 5 | -- Geoffrey Thomas Tue, 11 Sep 2012 12:50:13 -0700 6 | 7 | debathena-bin-example (1.0) unstable; urgency=low 8 | 9 | * Initial release. 10 | 11 | -- Geoffrey Thomas Tue, 11 Sep 2012 12:39:03 -0700 12 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | version := $(shell dpkg-parsechangelog | sed -nr 's/^Version: (.*)/\1/p') 3 | pod2man := pod2man -r "config-package-dev $(version)" -c config-package-dev 4 | 5 | %: 6 | dh $@ 7 | 8 | override_dh_auto_build: 9 | $(pod2man) --section=1 dh_configpackage dh_configpackage.1 10 | 11 | override_dh_compress: 12 | dh_compress -Xexamples/ 13 | 14 | override_dh_clean: 15 | dh_clean dh_configpackage.1 16 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-cron-example-1.0/debian/debathena-cron-example.cron.d: -------------------------------------------------------------------------------- 1 | # /etc/cron.d/logcheck: crontab entries for the logcheck package 2 | 3 | PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin 4 | MAILTO=root 5 | 6 | @reboot logcheck if [ -x /usr/sbin/logcheck ]; then nice -n10 /usr/sbin/logcheck -R; fi 7 | * * * * * logcheck if [ -x /usr/sbin/logcheck ]; then nice -n10 /usr/sbin/logcheck; fi 8 | 9 | # EOF 10 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-cron-example-1.0/debian/debathena-cron-example.cron.d: -------------------------------------------------------------------------------- 1 | # /etc/cron.d/logcheck: crontab entries for the logcheck package 2 | 3 | PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin 4 | MAILTO=root 5 | 6 | @reboot logcheck if [ -x /usr/sbin/logcheck ]; then nice -n10 /usr/sbin/logcheck -R; fi 7 | * * * * * logcheck if [ -x /usr/sbin/logcheck ]; then nice -n10 /usr/sbin/logcheck; fi 8 | 9 | # EOF 10 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-conffile-example-1.1/debian/changelog: -------------------------------------------------------------------------------- 1 | debathena-conffile-example (1.1) unstable; urgency=low 2 | 3 | * Remove /etc/sysctl.d/10-ptrace.conf if it exists. Once again, 4 | convenience trumps security. 5 | 6 | -- Jonathan Reed Mon, 25 Feb 2013 15:22:59 -0500 7 | 8 | debathena-conffile-example (1.0) unstable; urgency=low 9 | 10 | * Initial release. 11 | 12 | -- Tim Abbott Sun, 13 Jul 2008 00:37:03 -0400 13 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-conffile-example-1.1/debian/changelog: -------------------------------------------------------------------------------- 1 | debathena-conffile-example (1.1) unstable; urgency=low 2 | 3 | * Remove /etc/sysctl.d/10-ptrace.conf if it exists. Once again, 4 | convenience trumps security. 5 | 6 | -- Geoffrey Thomas Thu, 13 Dec 2012 16:46:39 -0800 7 | 8 | debathena-conffile-example (1.0) unstable; urgency=low 9 | 10 | * Initial release. 11 | 12 | -- Geoffrey Thomas Wed, 08 Aug 2012 18:37:54 -0700 13 | -------------------------------------------------------------------------------- /debian/config-package-dev.install: -------------------------------------------------------------------------------- 1 | displace.mk usr/share/cdbs/1/rules/ 2 | debconf-divert.mk usr/share/cdbs/1/rules/ 3 | check-files.mk usr/share/cdbs/1/rules/ 4 | config-package.mk usr/share/cdbs/1/rules/ 5 | transform-files.mk usr/share/cdbs/1/rules/ 6 | encode usr/share/config-package-dev/ 7 | decode usr/share/config-package-dev/ 8 | displace.sh.in usr/share/debhelper/autoscripts/ 9 | debconf-hack.sh usr/share/config-package-dev/ 10 | dh_configpackage usr/bin/ 11 | lib/Debian usr/share/perl5/ 12 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-conffile-example-1.0/debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | DEB_DISPLACE_EXTENSION = .debathena 4 | # Replace some base files with simple replacements. 5 | DEB_DISPLACE_FILES_debathena-conffile-example += \ 6 | /etc/issue.net.debathena 7 | # These files are installed via dh_install from the files/ directory 8 | # (see debian/debathena-conffile-example.install) 9 | 10 | include /usr/share/cdbs/1/rules/debhelper.mk 11 | include /usr/share/cdbs/1/rules/config-package.mk 12 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-transform-example-1.0/debian/transform_lynx.cfg.debathena: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -0p 2 | # perl -0p is useful for writing efficient transform scripts. 3 | 4 | # Set the default lynx home page to web.mit.edu. As noted in the 5 | # comments in lynx.cfg, if the lynx home page is down, lynx will refuse 6 | # to run. This caused a number of helpdesk complaints when the default 7 | # lynx home page was down for a day. 8 | 9 | s|^#STARTFILE:.*$|$&\nSTARTFILE:http://web.mit.edu/|m or die; 10 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-bin-example-1.1/debian/control.in: -------------------------------------------------------------------------------- 1 | Source: debathena-bin-example 2 | Section: config 3 | Priority: optional 4 | Maintainer: Tim Abbott 5 | Rules-Requires-Root: no 6 | Build-Depends: @cdbs@ 7 | Standards-Version: 4.1.0 8 | 9 | Package: debathena-bin-example 10 | Architecture: all 11 | Multi-Arch: foreign 12 | Depends: ${misc:Depends}, less 13 | Provides: ${diverted-files} 14 | Conflicts: ${diverted-files} 15 | Description: Example config-package-dev package 16 | This is an example config-package-dev package. 17 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-bin-example-1.0/debian/control.in: -------------------------------------------------------------------------------- 1 | Source: debathena-bin-example 2 | Section: config 3 | Priority: optional 4 | Maintainer: Tim Abbott 5 | Rules-Requires-Root: no 6 | Build-Depends: @cdbs@ 7 | Standards-Version: 4.1.0 8 | 9 | Package: debathena-bin-example 10 | Architecture: all 11 | Multi-Arch: foreign 12 | Depends: ${misc:Depends}, elinks, less 13 | Provides: ${diverted-files} 14 | Conflicts: ${diverted-files} 15 | Description: Example config-package-dev package 16 | This is an example config-package-dev package. 17 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-conffile-example-1.0/debian/control.in: -------------------------------------------------------------------------------- 1 | Source: debathena-conffile-example 2 | Section: config 3 | Priority: optional 4 | Maintainer: Tim Abbott 5 | Rules-Requires-Root: no 6 | Build-Depends: @cdbs@ 7 | Standards-Version: 4.1.0 8 | 9 | Package: debathena-conffile-example 10 | Architecture: all 11 | Multi-Arch: foreign 12 | Depends: ${misc:Depends} 13 | Provides: ${diverted-files} 14 | Conflicts: ${diverted-files} 15 | Description: Example config-package-dev package 16 | This is an example config-package-dev package. 17 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-cron-example-1.0/debian/control.in: -------------------------------------------------------------------------------- 1 | Source: debathena-cron-example 2 | Section: config 3 | Priority: optional 4 | Maintainer: Tim Abbott 5 | Rules-Requires-Root: no 6 | Build-Depends: @cdbs@ 7 | Standards-Version: 4.1.0 8 | 9 | Package: debathena-cron-example 10 | Architecture: all 11 | Multi-Arch: foreign 12 | Depends: ${misc:Depends}, logcheck 13 | Provides: ${diverted-files} 14 | Conflicts: ${diverted-files} 15 | Description: Example config-package-dev package 16 | This is an example config-package-dev package. 17 | -------------------------------------------------------------------------------- /doc/DOCUMENTATION: -------------------------------------------------------------------------------- 1 | Extensive documentation is available on the web at 2 | . 3 | 4 | Several ready-to-use examples are available in 5 | /usr/share/doc/config-package-dev/examples 6 | 7 | /usr/share/cdbs/1/rules/config-package.mk and the makefile fragments 8 | that it includes also contain some basic documentation. They are 9 | fairly short, but may not be easy to ready without consulting the GNU 10 | Make Manual (http://www.gnu.org/software/make/manual/make.html) and 11 | inspecting the core CDBS rules files as well. 12 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-conffile-example-1.1/debian/control.in: -------------------------------------------------------------------------------- 1 | Source: debathena-conffile-example 2 | Section: config 3 | Priority: optional 4 | Maintainer: Jonathan Reed 5 | Rules-Requires-Root: no 6 | Build-Depends: @cdbs@ 7 | Standards-Version: 4.1.0 8 | 9 | Package: debathena-conffile-example 10 | Architecture: all 11 | Multi-Arch: foreign 12 | Depends: ${misc:Depends} 13 | Provides: ${diverted-files} 14 | Conflicts: ${diverted-files} 15 | Description: Example config-package-dev package 16 | This is an example config-package-dev package. 17 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-transform-example-1.0/debian/control.in: -------------------------------------------------------------------------------- 1 | Source: debathena-transform-example 2 | Section: config 3 | Priority: optional 4 | Maintainer: Tim Abbott 5 | Rules-Requires-Root: no 6 | Build-Depends: @cdbs@, lynx 7 | Standards-Version: 4.1.0 8 | 9 | Package: debathena-transform-example 10 | Architecture: all 11 | Multi-Arch: foreign 12 | Depends: ${misc:Depends}, lynx 13 | Provides: ${diverted-files} 14 | Conflicts: ${diverted-files} 15 | Description: Example config-package-dev package 16 | This is an example config-package-dev package. 17 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-bin-example-1.1/debian/control: -------------------------------------------------------------------------------- 1 | Source: debathena-bin-example 2 | Section: config 3 | Priority: optional 4 | Maintainer: Geoffrey Thomas 5 | Rules-Requires-Root: no 6 | Build-Depends: debhelper (>= 7.0.0~), config-package-dev (>= 4.15~) 7 | Standards-Version: 4.1.0 8 | 9 | Package: debathena-bin-example 10 | Architecture: all 11 | Multi-Arch: foreign 12 | Depends: ${misc:Depends}, less 13 | Provides: ${diverted-files} 14 | Conflicts: ${diverted-files} 15 | Description: Example config-package-dev package 16 | This is an example config-package-dev package. 17 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-cron-example-1.0/debian/control: -------------------------------------------------------------------------------- 1 | Source: debathena-cron-example 2 | Section: config 3 | Priority: optional 4 | Maintainer: Geoffrey Thomas 5 | Rules-Requires-Root: no 6 | Build-Depends: debhelper (>= 7.0.0~), config-package-dev (>= 4.15~) 7 | Standards-Version: 4.1.0 8 | 9 | Package: debathena-cron-example 10 | Architecture: all 11 | Multi-Arch: foreign 12 | Depends: ${misc:Depends}, logcheck 13 | Provides: ${diverted-files} 14 | Conflicts: ${diverted-files} 15 | Description: Example config-package-dev package 16 | This is an example config-package-dev package. 17 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-bin-example-1.0/debian/control: -------------------------------------------------------------------------------- 1 | Source: debathena-bin-example 2 | Section: config 3 | Priority: optional 4 | Maintainer: Geoffrey Thomas 5 | Rules-Requires-Root: no 6 | Build-Depends: debhelper (>= 7.0.0~), config-package-dev (>= 4.15~) 7 | Standards-Version: 4.1.0 8 | 9 | Package: debathena-bin-example 10 | Architecture: all 11 | Multi-Arch: foreign 12 | Depends: ${misc:Depends}, elinks, less 13 | Provides: ${diverted-files} 14 | Conflicts: ${diverted-files} 15 | Description: Example config-package-dev package 16 | This is an example config-package-dev package. 17 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-conffile-example-1.0/debian/control: -------------------------------------------------------------------------------- 1 | Source: debathena-conffile-example 2 | Section: config 3 | Priority: optional 4 | Maintainer: Geoffrey Thomas 5 | Rules-Requires-Root: no 6 | Build-Depends: debhelper (>= 7.0.0~), config-package-dev (>= 4.15~) 7 | Standards-Version: 4.1.0 8 | 9 | Package: debathena-conffile-example 10 | Architecture: all 11 | Multi-Arch: foreign 12 | Depends: ${misc:Depends} 13 | Provides: ${diverted-files} 14 | Conflicts: ${diverted-files} 15 | Description: Example config-package-dev package 16 | This is an example config-package-dev package. 17 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-conffile-example-1.1/debian/control: -------------------------------------------------------------------------------- 1 | Source: debathena-conffile-example 2 | Section: config 3 | Priority: optional 4 | Maintainer: Geoffrey Thomas 5 | Rules-Requires-Root: no 6 | Build-Depends: debhelper (>= 7.0.50~), config-package-dev (>= 4.15~) 7 | Standards-Version: 4.1.0 8 | 9 | Package: debathena-conffile-example 10 | Architecture: all 11 | Multi-Arch: foreign 12 | Depends: ${misc:Depends} 13 | Provides: ${diverted-files} 14 | Conflicts: ${diverted-files} 15 | Description: Example config-package-dev package 16 | This is an example config-package-dev package. 17 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-bin-example-1.1/debian/control: -------------------------------------------------------------------------------- 1 | Source: debathena-bin-example 2 | Section: config 3 | Priority: optional 4 | Maintainer: Tim Abbott 5 | Rules-Requires-Root: no 6 | Build-Depends: cdbs, 7 | debhelper, 8 | dh-buildinfo, 9 | config-package-dev (>= 4.5~) 10 | Standards-Version: 4.1.0 11 | 12 | Package: debathena-bin-example 13 | Architecture: all 14 | Multi-Arch: foreign 15 | Depends: ${misc:Depends}, less 16 | Provides: ${diverted-files} 17 | Conflicts: ${diverted-files} 18 | Description: Example config-package-dev package 19 | This is an example config-package-dev package. 20 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-bin-example-1.0/debian/control: -------------------------------------------------------------------------------- 1 | Source: debathena-bin-example 2 | Section: config 3 | Priority: optional 4 | Maintainer: Tim Abbott 5 | Rules-Requires-Root: no 6 | Build-Depends: cdbs, 7 | debhelper, 8 | dh-buildinfo, 9 | config-package-dev (>= 4.5~) 10 | Standards-Version: 4.1.0 11 | 12 | Package: debathena-bin-example 13 | Architecture: all 14 | Multi-Arch: foreign 15 | Depends: ${misc:Depends}, elinks, less 16 | Provides: ${diverted-files} 17 | Conflicts: ${diverted-files} 18 | Description: Example config-package-dev package 19 | This is an example config-package-dev package. 20 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-conffile-example-1.0/debian/control: -------------------------------------------------------------------------------- 1 | Source: debathena-conffile-example 2 | Section: config 3 | Priority: optional 4 | Maintainer: Tim Abbott 5 | Rules-Requires-Root: no 6 | Build-Depends: cdbs, 7 | debhelper, 8 | dh-buildinfo, 9 | config-package-dev (>= 4.5~) 10 | Standards-Version: 4.1.0 11 | 12 | Package: debathena-conffile-example 13 | Architecture: all 14 | Multi-Arch: foreign 15 | Depends: ${misc:Depends} 16 | Provides: ${diverted-files} 17 | Conflicts: ${diverted-files} 18 | Description: Example config-package-dev package 19 | This is an example config-package-dev package. 20 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-conffile-example-1.1/debian/control: -------------------------------------------------------------------------------- 1 | Source: debathena-conffile-example 2 | Section: config 3 | Priority: optional 4 | Maintainer: Jonathan Reed 5 | Rules-Requires-Root: no 6 | Build-Depends: cdbs, 7 | debhelper, 8 | dh-buildinfo, 9 | config-package-dev (>= 4.5~) 10 | Standards-Version: 4.1.0 11 | 12 | Package: debathena-conffile-example 13 | Architecture: all 14 | Multi-Arch: foreign 15 | Depends: ${misc:Depends} 16 | Provides: ${diverted-files} 17 | Conflicts: ${diverted-files} 18 | Description: Example config-package-dev package 19 | This is an example config-package-dev package. 20 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-cron-example-1.0/debian/control: -------------------------------------------------------------------------------- 1 | Source: debathena-cron-example 2 | Section: config 3 | Priority: optional 4 | Maintainer: Tim Abbott 5 | Rules-Requires-Root: no 6 | Build-Depends: cdbs, 7 | debhelper, 8 | dh-buildinfo, 9 | config-package-dev (>= 4.5~) 10 | Standards-Version: 4.1.0 11 | 12 | Package: debathena-cron-example 13 | Architecture: all 14 | Multi-Arch: foreign 15 | Depends: ${misc:Depends}, logcheck 16 | Provides: ${diverted-files} 17 | Conflicts: ${diverted-files} 18 | Description: Example config-package-dev package 19 | This is an example config-package-dev package. 20 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-transform-example-1.0/debian/control: -------------------------------------------------------------------------------- 1 | Source: debathena-transform-example 2 | Section: config 3 | Priority: optional 4 | Maintainer: Geoffrey Thomas 5 | Rules-Requires-Root: no 6 | Build-Depends: debhelper (>= 7.0.0~), config-package-dev (>= 4.15), lynx 7 | Standards-Version: 4.1.0 8 | 9 | Package: debathena-transform-example 10 | Architecture: all 11 | Multi-Arch: foreign 12 | Depends: ${misc:Depends}, lynx 13 | Provides: ${diverted-files} 14 | Conflicts: ${diverted-files} 15 | Description: Example config-package-dev package 16 | This is an example config-package-dev package. 17 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-transform-example-1.0/debian/control: -------------------------------------------------------------------------------- 1 | Source: debathena-transform-example 2 | Section: config 3 | Priority: optional 4 | Maintainer: Tim Abbott 5 | Rules-Requires-Root: no 6 | Build-Depends: cdbs, 7 | debhelper, 8 | dh-buildinfo, 9 | config-package-dev (>= 4.5~), lynx 10 | Standards-Version: 4.1.0 11 | 12 | Package: debathena-transform-example 13 | Architecture: all 14 | Multi-Arch: foreign 15 | Depends: ${misc:Depends}, lynx 16 | Provides: ${diverted-files} 17 | Conflicts: ${diverted-files} 18 | Description: Example config-package-dev package 19 | This is an example config-package-dev package. 20 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-conffile-example-1.1/debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | DEB_DISPLACE_EXTENSION = .debathena 4 | # Replace some base files with simple replacements. 5 | DEB_DISPLACE_FILES_debathena-conffile-example += \ 6 | /etc/issue.net.debathena 7 | # These files are installed via dh_install from the files/ directory 8 | # (see debian/debathena-conffile-example.install) 9 | 10 | ifneq ($(wildcard /etc/sysctl.d/10-ptrace.conf),) 11 | DEB_HIDE_FILES_debathena-conffile-example += \ 12 | /etc/sysctl.d/10-ptrace.conf 13 | endif 14 | 15 | include /usr/share/cdbs/1/rules/debhelper.mk 16 | include /usr/share/cdbs/1/rules/config-package.mk 17 | -------------------------------------------------------------------------------- /encode: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # Encode name of a file in a Debian package name. 3 | # 4 | # The purpose of this encoding is to cause Debian configuration 5 | # packages (potentially from different sites) that divert the same 6 | # configuration file to conflict with each other. Thus, it is 7 | # important that all sites using this Debian configuration package 8 | # system use this encoding. 9 | # 10 | # This encoding is intended to be human-readable, so that users can 11 | # determine the cause of conflicts between different configuration 12 | # packages. 13 | 14 | use strict; 15 | use warnings; 16 | use Debian::Debhelper::config_package; 17 | 18 | print encode($ARGV[0]); 19 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-cron-example-1.0/debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | DEB_DISPLACE_EXTENSION = .debathena 4 | 5 | # This will hide /etc/cron.d/logcheck 6 | DEB_HIDE_FILES_debathena-cron-example += \ 7 | /etc/cron.d/logcheck 8 | 9 | # We will install (using dh_installcron, by placing the new cron job 10 | # at debian/debathena-cron-example.cron.d) a new version that runs 11 | # every minute, rather than every 30 minutes. This will generate a 12 | # lot of mail. Note that we cannot install a new file to the path 13 | # /etc/cron.d/logcheck from which a file was hidden using 14 | # DEB_HIDE_FILES. 15 | 16 | include /usr/share/cdbs/1/rules/debhelper.mk 17 | include /usr/share/cdbs/1/rules/config-package.mk 18 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-bin-example-1.0/debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | DEB_DISPLACE_EXTENSION = .debathena 4 | # Install wrapper scripts for /usr/bin/elinks and /usr/bin/less 5 | DEB_DISPLACE_FILES_debathena-bin-example += \ 6 | /usr/bin/elinks.debathena \ 7 | /usr/bin/less.debathena 8 | 9 | # If these had materially different behavior from the original 10 | # versions, one might displace the man pages as well 11 | DEB_DISPLACE_FILES_debathena-bin-example += /usr/share/man/man1/elinks.debathena.1.gz 12 | DEB_DISPLACE_FILES_debathena-bin-example += /usr/share/man/man1/less.debathena.1.gz 13 | 14 | # This isn't config-package-dev specific, but we may want to install symlinks instead. 15 | DEB_DH_LINK_debathena-bin-example += \ 16 | /usr/share/man/man1/elinks.debathena-orig.1.gz /usr/share/man/man1/elinks.debathena.1.gz \ 17 | /usr/share/man/man1/less.debathena-orig.1.gz /usr/share/man/man1/less.debathena.1.gz 18 | 19 | include /usr/share/cdbs/1/rules/debhelper.mk 20 | include /usr/share/cdbs/1/rules/config-package.mk 21 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-bin-example-1.1/debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | DEB_DISPLACE_EXTENSION = .debathena 4 | # Install wrapper scripts for /usr/bin/elinks and /usr/bin/less 5 | DEB_DISPLACE_FILES_debathena-bin-example += \ 6 | /usr/bin/less.debathena 7 | 8 | # If these had materially different behavior from the original 9 | # versions, one might divert the man pages as well 10 | DEB_DISPLACE_FILES_debathena-bin-example += /usr/share/man/man1/less.debathena.1.gz 11 | 12 | # This isn't config-package-dev specific, but we may want to install symlinks instead. 13 | DEB_DH_LINK_debathena-bin-example += \ 14 | /usr/share/man/man1/less.debathena-orig.1.gz /usr/share/man/man1/less.debathena.1.gz 15 | 16 | # Remove elinks displacement on upgrade if it was previously in place on 17 | # the target system 18 | DEB_UNDISPLACE_FILES_debathena-bin-example += /usr/bin/elinks.debathena 19 | # and the man page 20 | DEB_UNDISPLACE_FILES_debathena-bin-example += /usr/share/man/man1/elinks.debathena.1.gz 21 | 22 | include /usr/share/cdbs/1/rules/debhelper.mk 23 | include /usr/share/cdbs/1/rules/config-package.mk 24 | -------------------------------------------------------------------------------- /lib/Debian/Debhelper/config_package.pm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | package Debian::Debhelper::config_package; 4 | 5 | use warnings; 6 | use strict; 7 | 8 | use Exporter; 9 | use vars qw(@ISA @EXPORT); 10 | @ISA=qw(Exporter); 11 | @EXPORT=qw(&encode &decode); 12 | 13 | sub encode { 14 | my $result = ""; 15 | my $input = shift; 16 | $input =~ s,^/,,; 17 | foreach (split('', $input)) { 18 | if (m/[a-z0-9.-]/) { 19 | $result .= "$_"; 20 | } elsif (m/[A-Z]/) { 21 | $result .= "+".lc($_)."+"; 22 | } elsif ($_ eq '/') { 23 | $result .= "++"; 24 | } elsif ($_ eq '_') { 25 | $result .= "+-+"; 26 | } else{ 27 | $result .= "+x".hex(ord($_))."+"; 28 | } 29 | } 30 | return $result; 31 | } 32 | 33 | sub unparse { 34 | $_ = $_[0]; 35 | return "/" unless $_; 36 | return "_" if $_ eq "-"; 37 | return uc($_) if /^[a-z]$/; 38 | s/^x//; 39 | return chr hex $_; 40 | } 41 | 42 | sub decode { 43 | my $input = shift; 44 | $input =~ s/\+([^+]*)\+/unparse($1)/eg; 45 | return $input; 46 | } 47 | 48 | 1 49 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-bin-example-1.0/debian/copyright: -------------------------------------------------------------------------------- 1 | Example config-package-dev package. 2 | 3 | Author: Tim Abbott 4 | 5 | Copyright © 2008 Tim Abbott 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining 8 | a copy of this software and associated documentation files (the 9 | "Software"), to deal in the Software without restriction, including 10 | without limitation the rights to use, copy, modify, merge, publish, 11 | distribute, sublicense, and/or sell copies of the Software, and to 12 | permit persons to whom the Software is furnished to do so, subject to 13 | the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 22 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 24 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-bin-example-1.1/debian/copyright: -------------------------------------------------------------------------------- 1 | Example config-package-dev package. 2 | 3 | Author: Tim Abbott 4 | 5 | Copyright © 2008 Tim Abbott 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining 8 | a copy of this software and associated documentation files (the 9 | "Software"), to deal in the Software without restriction, including 10 | without limitation the rights to use, copy, modify, merge, publish, 11 | distribute, sublicense, and/or sell copies of the Software, and to 12 | permit persons to whom the Software is furnished to do so, subject to 13 | the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 22 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 24 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-cron-example-1.0/debian/copyright: -------------------------------------------------------------------------------- 1 | Example config-package-dev package. 2 | 3 | Author: Tim Abbott 4 | 5 | Copyright © 2008 Tim Abbott 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining 8 | a copy of this software and associated documentation files (the 9 | "Software"), to deal in the Software without restriction, including 10 | without limitation the rights to use, copy, modify, merge, publish, 11 | distribute, sublicense, and/or sell copies of the Software, and to 12 | permit persons to whom the Software is furnished to do so, subject to 13 | the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 22 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 24 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-conffile-example-1.0/debian/copyright: -------------------------------------------------------------------------------- 1 | Example config-package-dev package. 2 | 3 | Author: Tim Abbott 4 | 5 | Copyright © 2008 Tim Abbott 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining 8 | a copy of this software and associated documentation files (the 9 | "Software"), to deal in the Software without restriction, including 10 | without limitation the rights to use, copy, modify, merge, publish, 11 | distribute, sublicense, and/or sell copies of the Software, and to 12 | permit persons to whom the Software is furnished to do so, subject to 13 | the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 22 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 24 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-conffile-example-1.1/debian/copyright: -------------------------------------------------------------------------------- 1 | Example config-package-dev package. 2 | 3 | Author: Tim Abbott 4 | 5 | Copyright © 2008 Tim Abbott 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining 8 | a copy of this software and associated documentation files (the 9 | "Software"), to deal in the Software without restriction, including 10 | without limitation the rights to use, copy, modify, merge, publish, 11 | distribute, sublicense, and/or sell copies of the Software, and to 12 | permit persons to whom the Software is furnished to do so, subject to 13 | the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 22 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 24 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /examples/cdbs/debathena-transform-example-1.0/debian/copyright: -------------------------------------------------------------------------------- 1 | Example config-package-dev package. 2 | 3 | Author: Tim Abbott 4 | 5 | Copyright © 2008 Tim Abbott 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining 8 | a copy of this software and associated documentation files (the 9 | "Software"), to deal in the Software without restriction, including 10 | without limitation the rights to use, copy, modify, merge, publish, 11 | distribute, sublicense, and/or sell copies of the Software, and to 12 | permit persons to whom the Software is furnished to do so, subject to 13 | the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 22 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 24 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-bin-example-1.0/debian/copyright: -------------------------------------------------------------------------------- 1 | Example config-package-dev package. 2 | 3 | Author: Tim Abbott 4 | 5 | Copyright © 2008 Tim Abbott 6 | Copyright © 2012 Geoffrey Thomas 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining 9 | a copy of this software and associated documentation files (the 10 | "Software"), to deal in the Software without restriction, including 11 | without limitation the rights to use, copy, modify, merge, publish, 12 | distribute, sublicense, and/or sell copies of the Software, and to 13 | permit persons to whom the Software is furnished to do so, subject to 14 | the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be 17 | included in all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 23 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 24 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 25 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-bin-example-1.1/debian/copyright: -------------------------------------------------------------------------------- 1 | Example config-package-dev package. 2 | 3 | Author: Tim Abbott 4 | 5 | Copyright © 2008 Tim Abbott 6 | Copyright © 2012 Geoffrey Thomas 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining 9 | a copy of this software and associated documentation files (the 10 | "Software"), to deal in the Software without restriction, including 11 | without limitation the rights to use, copy, modify, merge, publish, 12 | distribute, sublicense, and/or sell copies of the Software, and to 13 | permit persons to whom the Software is furnished to do so, subject to 14 | the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be 17 | included in all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 23 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 24 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 25 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-cron-example-1.0/debian/copyright: -------------------------------------------------------------------------------- 1 | Example config-package-dev package. 2 | 3 | Author: Tim Abbott 4 | 5 | Copyright © 2008 Tim Abbott 6 | Copyright © 2012 Geoffrey Thomas 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining 9 | a copy of this software and associated documentation files (the 10 | "Software"), to deal in the Software without restriction, including 11 | without limitation the rights to use, copy, modify, merge, publish, 12 | distribute, sublicense, and/or sell copies of the Software, and to 13 | permit persons to whom the Software is furnished to do so, subject to 14 | the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be 17 | included in all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 23 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 24 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 25 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-conffile-example-1.0/debian/copyright: -------------------------------------------------------------------------------- 1 | Example config-package-dev package. 2 | 3 | Author: Tim Abbott 4 | 5 | Copyright © 2008 Tim Abbott 6 | Copyright © 2012 Geoffrey Thomas 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining 9 | a copy of this software and associated documentation files (the 10 | "Software"), to deal in the Software without restriction, including 11 | without limitation the rights to use, copy, modify, merge, publish, 12 | distribute, sublicense, and/or sell copies of the Software, and to 13 | permit persons to whom the Software is furnished to do so, subject to 14 | the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be 17 | included in all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 23 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 24 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 25 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-conffile-example-1.1/debian/copyright: -------------------------------------------------------------------------------- 1 | Example config-package-dev package. 2 | 3 | Author: Tim Abbott 4 | 5 | Copyright © 2008 Tim Abbott 6 | Copyright © 2012 Geoffrey Thomas 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining 9 | a copy of this software and associated documentation files (the 10 | "Software"), to deal in the Software without restriction, including 11 | without limitation the rights to use, copy, modify, merge, publish, 12 | distribute, sublicense, and/or sell copies of the Software, and to 13 | permit persons to whom the Software is furnished to do so, subject to 14 | the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be 17 | included in all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 23 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 24 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 25 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /examples/debhelper/debathena-transform-example-1.0/debian/copyright: -------------------------------------------------------------------------------- 1 | Example config-package-dev package. 2 | 3 | Author: Tim Abbott 4 | 5 | Copyright © 2008 Tim Abbott 6 | Copyright © 2012 Geoffrey Thomas 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining 9 | a copy of this software and associated documentation files (the 10 | "Software"), to deal in the Software without restriction, including 11 | without limitation the rights to use, copy, modify, merge, publish, 12 | distribute, sublicense, and/or sell copies of the Software, and to 13 | permit persons to whom the Software is furnished to do so, subject to 14 | the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be 17 | included in all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 23 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 24 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 25 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: config-package-dev 2 | Section: devel 3 | Priority: optional 4 | Maintainer: Debathena Project 5 | Uploaders: Tim Abbott , Anders Kaseorg , Geoffrey Thomas 6 | Homepage: https://debathena.mit.edu/config-package-dev 7 | Vcs-Git: https://github.com/sipb/config-package-dev 8 | Vcs-Browser: https://github.com/sipb/config-package-dev 9 | Rules-Requires-Root: no 10 | Build-Depends: debhelper (>= 9) 11 | Standards-Version: 4.1.0 12 | 13 | Package: config-package-dev 14 | Architecture: all 15 | Depends: ${misc:Depends}, ${perl:Depends} 16 | Multi-Arch: foreign 17 | Description: Debhelper (and CDBS) modules for building configuration packages 18 | This package contains a system of modules for creating Debian 19 | configuration packages: packages that configure an existing Debian 20 | system by using dpkg-divert on configuration files. These modules 21 | attempt to make the process of creating configuration packages 22 | efficient by checking the md5sums of upstream configuration files 23 | that are to be modified and automatically generating the relevant 24 | postinst code to perform the diversions using the standard debhelper 25 | mechanism. In addition to a debhelper command and sequencer extension 26 | module, CDBS modules are also included, but future development will 27 | focus on the debhelper interface. 28 | . 29 | The config-package-dev modules are optimized for site defaults (i.e. 30 | configuration for a university or a company), though they are useful 31 | for other applications as well. 32 | -------------------------------------------------------------------------------- /debconf-hack.sh: -------------------------------------------------------------------------------- 1 | debconf_get () { 2 | perl -MDebconf::Db -MDebconf::Question -e ' 3 | Debconf::Db->load(readonly => "true"); 4 | for $label (@ARGV) { 5 | if ($q = Debconf::Question->get($label)) { 6 | print $q->owners."\t".$q->name."\t".$q->type."\t".$q->value."\t".$q->flag("seen")."\n"; 7 | } else { 8 | print "\t$label\t\t\tfalse\n"; 9 | } 10 | }' -- "$@" 11 | } 12 | 13 | debconf_set () { 14 | perl -MDebconf::Db -MDebconf::Template -MDebconf::Question -e ' 15 | Debconf::Db->load; 16 | while (<>) { 17 | chomp; 18 | ($owners, $label, $type, $value, $seen) = split("\t"); 19 | @o{split(", ", $owners)} = (); 20 | unless ($t = Debconf::Template->get($label)) { 21 | next unless ($owners); 22 | $t = Debconf::Template->new($label, $owners[0], $type); 23 | $t->description("Dummy template"); 24 | $t->extended_description("This is a fake template used to pre-seed the debconf database. If you are seeing this, something is probably wrong."); 25 | } 26 | @to{split(", ", $t->owners)} = (); 27 | map { $t->addowner($_) unless exists $to{$_}; } keys %o; 28 | map { $t->removeowner($_) unless exists $o{$_}; } keys %to; 29 | next unless ($q = Debconf::Question->get($label)); 30 | $q->value($value); 31 | $q->flag("seen", $seen); 32 | @qo{split(", ", $q->owners)} = (); 33 | map { $q->addowner($_) unless exists $qo{$_}; } keys %o; 34 | map { $q->removeowner($_) unless exists $o{$_}; } keys %qo; 35 | } 36 | Debconf::Db->save;' 37 | } 38 | -------------------------------------------------------------------------------- /examples/EXAMPLES: -------------------------------------------------------------------------------- 1 | This directory contains example packages using the config-package-dev 2 | system that you can start from in designing your own packages. 3 | 4 | debathena-conffile-example-1.0: 5 | Displaces a configuration file and provides different configuration 6 | debathena-conffile-example-1.1: 7 | Transforms a configuration file if it exists at build time 8 | debathena-bin-example-1.0: 9 | Displaces a binary and provides a wrapper script 10 | debathena-bin-example-1.1: 11 | Upgrades debathena-bin-example-1.0 undoing one of the displacements 12 | debathena-transform-example-1.0: 13 | Transforms a configuration file 14 | debathena-cron-example-1.0: 15 | Hides a cron job 16 | 17 | Both CDBS and Debhelper 7+ versions are provided, in the cdbs/ and 18 | debhelper/ directories, respectively. 19 | 20 | 21 | If you are trying to build these packages out of a config-package-dev 22 | source tree (e.g., because you are hacking on config-package-dev), note 23 | that you will need to set a few environment variables to make things 24 | work. For debuild, e.g., try the command 25 | 26 | debuild -e PERL5LIB=../../../lib -e DH_AUTOSCRIPTDIR=../../.. --prepend-path=../../.. 27 | 28 | This trick will not work for CDBS, since debian/rules hard-codes an 29 | absolute path to CDBS class and rules files. 30 | 31 | 32 | For the CDBS examples, note that if you want the control files to be 33 | regenerated from the control.in files, you need to add 34 | 35 | DEB_AUTO_UPDATE_DEBIAN_CONTROL=1 36 | 37 | to the debian/rules files (or e.g. set it in your environment). 38 | 39 | We do not include DEB_AUTO_UPDATE_DEBIAN_CONTROL=1 in these example 40 | rules files because option is banned in official Debian packages (see 41 | the CDBS section of ). 42 | 43 | 44 | config-package-dev supports older versions of debhelper, although 45 | examples are not given. You can use it in your own packages by adding 46 | dh_configpackage into the list of dh_* commands in debian/rules, before 47 | dh_link. 48 | -------------------------------------------------------------------------------- /transform-files.mk: -------------------------------------------------------------------------------- 1 | # -*- mode: makefile; coding: utf-8 -*- 2 | # Copyright © 2008 Tim Abbott and 3 | # Anders Kaseorg 4 | # 5 | # This program is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License as 7 | # published by the Free Software Foundation; either version 2, or (at 8 | # your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program; if not, write to the Free Software 17 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 18 | # 02111-1307 USA. 19 | 20 | # Don't include transform-files.mk in your rules files directly; 21 | # instead use config-package.mk. 22 | 23 | ifndef _cdbs_rules_transform_files 24 | _cdbs_rules_transform_files = 1 25 | 26 | include /usr/share/cdbs/1/rules/check-files.mk 27 | 28 | DEB_TRANSFORM_FILES = $(foreach package,$(DEB_ALL_PACKAGES),$(DEB_TRANSFORM_FILES_$(package))) 29 | 30 | DEB_TRANSFORM_FILES_TMPDIR=debian/transform_file_copies 31 | 32 | debian_transform_files = $(patsubst %,$(DEB_TRANSFORM_FILES_TMPDIR)%,$(1)) 33 | undebian_transform_files = $(patsubst $(DEB_TRANSFORM_FILES_TMPDIR)%,%,$(1)) 34 | debian_transform_script = $(if $(DEB_TRANSFORM_SCRIPT_$(cdbs_curpkg)_$(call undebian_transform_files,$(1))), \ 35 | $(DEB_TRANSFORM_SCRIPT_$(cdbs_curpkg)_$(call undebian_transform_files,$(1))), \ 36 | $(if $(DEB_TRANSFORM_SCRIPT_$(call undebian_transform_files,$(1))), \ 37 | $(DEB_TRANSFORM_SCRIPT_$(call undebian_transform_files,$(1))), \ 38 | debian/transform_$(notdir $(call undebian_transform_files,$(1))))) 39 | 40 | common-build-arch common-build-indep:: $(foreach file,$(DEB_TRANSFORM_FILES),$(call debian_transform_files,$(file))) 41 | 42 | $(call debian_transform_files,%): $(call debian_check_files,%) 43 | mkdir -p $(@D) 44 | chmod +x $(call debian_transform_script,$@) 45 | $(call debian_transform_script,$@) < $< > $@ 46 | 47 | $(patsubst %,binary-install/%,$(DEB_ALL_PACKAGES)) :: binary-install/%: 48 | set -e; \ 49 | $(foreach file,$(DEB_TRANSFORM_FILES_$(cdbs_curpkg)), \ 50 | install -d debian/$(cdbs_curpkg)/$(dir $(file)); \ 51 | cp -a $(call debian_transform_files,$(file)) \ 52 | debian/$(cdbs_curpkg)/$(dir $(file));) 53 | 54 | clean:: 55 | rm -rf $(DEB_TRANSFORM_FILES_TMPDIR) 56 | 57 | endif 58 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | config-package-dev 2 | === 3 | 4 | config-package-dev is a tool for building Debian _configuration 5 | packages_, that is, packages that configure other Debian packages 6 | already on your system. It is an alternative to configuration-management 7 | tools (e.g., Ansible, Chef, Puppet, cfengine) that integrates cleanly 8 | with the Debian packaging system: you can apply configuration by 9 | installing a configuration package, and remove it cleanly by 10 | uninstalling it. config-package-dev uses `dpkg-divert` to inform the 11 | packaging system that it is changing files owned by another package, 12 | which means that your changes remain applied even when the original 13 | package is upgraded. 14 | 15 | Configuration packages are particularly useful for sites using Debian or 16 | Ubuntu (or another dpkg-based distribution) who are already running 17 | their own internal apt repository. You can provide site defaults and 18 | configuration through your existing package-update processes, and make 19 | sure systems are up-to-date in both software and configuration by 20 | checking what versions of packages they have installed. 21 | (config-package-dev is not intended for use by packages in Debian 22 | itself.) 23 | 24 | config-package-dev is a project of [MIT SIPB](https://sipb.mit.edu/), 25 | and was originally developed for the 26 | [Debathena](https://debathena.mit.edu) project to provide functionality 27 | to access MIT computing services (e.g., Kerberos and AFS configuration) 28 | on privately owned machines. 29 | 30 | To get started, install `config-package-dev` from your package manager; 31 | we support the versions in the Debian and Ubuntu archives. Take a look 32 | at the [examples](examples/debhelper), or check out the full 33 | documentation at 34 | [https://debathena.mit.edu/config-package-dev](https://debathena.mit.edu/config-package-dev). 35 | If you're using config-package-dev, please also join the 36 | [config-package-dev@mit.edu mailing 37 | list](https://mailman.mit.edu/mailman/listinfo/config-package-dev). 38 | 39 | config-package-dev itself is [licensed under the 40 | GPLv2+](debian/copyright), but the code it 41 | adds to configuration packages is [released under the MIT 42 | license](https://github.com/sipb/config-package-dev/commit/8d36c7611f0b3f3a16447b613d0e2a6ad0b1059f#diff-e93fa5c394e60f185a53f9ff00b68eb2) 43 | and automatically includes the MIT license in the added code. 44 | 45 | Feel free to report bugs or submit patches either on GitHub or [on the Debian 46 | bug tracker](https://bugs.debian.org/src:config-package-dev). 47 | 48 | [![Build Status](https://travis-ci.org/sipb/config-package-dev.svg?branch=master)](https://travis-ci.org/sipb/config-package-dev) 49 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Source: https://github.com/sipb/config-package-dev 3 | Upstream-Contact: Debathena Project 4 | 5 | Files: * 6 | Copyright: (C) Tim Abbott 2006-2010 7 | (C) Anders Kaseorg 2006-2012 8 | (C) Geoffrey Thomas 2011-2017 9 | (C) Jonathan Reed 2013 10 | License: GPL-2+ 11 | This program is free software; you can redistribute it and/or modify 12 | it under the terms of the GNU General Public License as published by 13 | the Free Software Foundation; either version 2 of the License, or 14 | (at your option) any later version. 15 | . 16 | This program is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | GNU General Public License for more details. 20 | . 21 | On Debian systems, the complete text of the GNU General Public License 22 | can be found in the file /usr/share/common-licenses/GPL-2. 23 | 24 | Files: displace.sh.in 25 | Copyright: © 2008–2012 Tim Abbott and Anders Kaseorg 26 | License: Expat 27 | Comment: This file is copied into packages generated by 28 | config-package-dev. It includes the copyright statement and license 29 | text, so that packages using config-package-dev should not need to do 30 | anything else to comply with the license and are not required to be 31 | GPL-compatible just because they use config-package-dev. 32 | 33 | Files: examples/* 34 | Copyright: © 2008 Tim Abbott 35 | © 2012 Geoffrey Thomas 36 | License: Expat 37 | 38 | License: Expat 39 | Permission is hereby granted, free of charge, to any person 40 | obtaining a copy of this software and associated documentation files 41 | (the “Software”), to deal in the Software without restriction, 42 | including without limitation the rights to use, copy, modify, merge, 43 | publish, distribute, sublicense, and/or sell copies of the Software, 44 | and to permit persons to whom the Software is furnished to do so, 45 | subject to the following conditions: 46 | . 47 | The above copyright notice and this permission notice shall be 48 | included in all copies or substantial portions of the Software. 49 | . 50 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 51 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 52 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 53 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 54 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 55 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 56 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 57 | SOFTWARE. 58 | -------------------------------------------------------------------------------- /debconf-divert.mk: -------------------------------------------------------------------------------- 1 | # -*- mode: makefile; coding: utf-8 -*- 2 | # Copyright © 2007-2008 Anders Kaseorg and 3 | # Tim Abbott 4 | # 5 | # This program is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License as 7 | # published by the Free Software Foundation; either version 2, or (at 8 | # your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program; if not, write to the Free Software 17 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 18 | # 02111-1307 USA. 19 | 20 | ifndef _cdbs_rules_debconf_divert 21 | _cdbs_rules_debconf_divert = 1 22 | 23 | CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), config-package-dev (>= 3.2~) 24 | 25 | DEB_DEBCONF_HACK_SCRIPT = /usr/share/config-package-dev/debconf-hack.sh 26 | 27 | DEB_DEBCONF_HACK_PACKAGES += $(foreach package,$(DEB_ALL_PACKAGES), \ 28 | $(if $(wildcard debian/$(package).debconf-hack),$(package))) 29 | 30 | dh_compat_6 := $(shell if [ '$(DH_COMPAT)' -ge 6 ]; then echo y; fi) 31 | 32 | $(patsubst %,debian-debconf-hack/%,$(DEB_DEBCONF_HACK_PACKAGES)) :: debian-debconf-hack/%: 33 | set -e; \ 34 | { \ 35 | cat $(DEB_DEBCONF_HACK_SCRIPT); \ 36 | echo 'if [ ! -f /var/cache/$(cdbs_curpkg).debconf-save ]; then'; \ 37 | echo ' debconf_get $(shell cut -d' ' -f2 debian/$(cdbs_curpkg).debconf-hack) >/var/cache/$(cdbs_curpkg).debconf-save'; \ 38 | echo ' debconf_set <> $(CURDIR)/debian/$(cdbs_curpkg).preinst.debhelper 43 | set -e; \ 44 | { \ 45 | cat $(DEB_DEBCONF_HACK_SCRIPT); \ 46 | echo 'if [ -f /var/cache/$(cdbs_curpkg).debconf-save ]; then'; \ 47 | echo ' debconf_set > $(CURDIR)/debian/$(cdbs_curpkg).postinst.debhelper 51 | set -e; \ 52 | { \ 53 | $(if $(dh_compat_6),, \ 54 | if [ -e $(CURDIR)/debian/$(cdbs_curpkg).postrm.debhelper ]; then \ 55 | cat $(CURDIR)/debian/$(cdbs_curpkg).postrm.debhelper; \ 56 | fi;) \ 57 | cat $(DEB_DEBCONF_HACK_SCRIPT); \ 58 | echo 'if [ -f /var/cache/$(cdbs_curpkg).debconf-save ]; then'; \ 59 | echo ' debconf_set > $(CURDIR)/debian/$(cdbs_curpkg).postrm.debhelper.new 67 | mv $(CURDIR)/debian/$(cdbs_curpkg).postrm.debhelper.new \ 68 | $(CURDIR)/debian/$(cdbs_curpkg).postrm.debhelper 69 | 70 | $(patsubst %,binary-fixup/%,$(DEB_DEBCONF_HACK_PACKAGES)) :: binary-fixup/%: debian-debconf-hack/% 71 | 72 | endif 73 | -------------------------------------------------------------------------------- /check-files.mk: -------------------------------------------------------------------------------- 1 | # -*- mode: makefile; coding: utf-8 -*- 2 | # Copyright © 2007-2008 Anders Kaseorg and 3 | # Tim Abbott 4 | # 5 | # This program is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License as 7 | # published by the Free Software Foundation; either version 2, or (at 8 | # your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program; if not, write to the Free Software 17 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 18 | # 02111-1307 USA. 19 | 20 | # Don't include check-files.mk in your rules files directly; instead 21 | # use config-package.mk. 22 | 23 | # check-files.mk is used to verify that files on local disk have not 24 | # been modified from the upstream packaged version. Its only API 25 | # function is adding the following function as a dependency: 26 | # 27 | # $(call debian_check_files,filename) 28 | # 29 | # Returns the path to a copy of filename that is verified to be 30 | # unmodified from the version shipped by the distribution (by checking 31 | # md5sums). The function causes the package to fail to build if the 32 | # relevant configuration file has been modified on the build machine. 33 | 34 | ifndef _cdbs_rules_check_files 35 | _cdbs_rules_check_files = 1 36 | 37 | include /usr/share/cdbs/1/rules/displace.mk 38 | 39 | DEB_CHECK_FILES_TMPDIR = debian/check_file_copies 40 | 41 | debian_check_files_source = $(if $(DEB_CHECK_FILES_SOURCE_$(1)),$(DEB_CHECK_FILES_SOURCE_$(1)),$(call displace_files_replace_name,$(1))) 42 | 43 | debian_check_files = $(patsubst %,$(DEB_CHECK_FILES_TMPDIR)%,$(1)) 44 | undebian_check_files = $(patsubst $(DEB_CHECK_FILES_TMPDIR)%,%,$(1)) 45 | 46 | debian_check_files_tmp = $(patsubst %,%.tmp,$(call debian_check_files,$(1))) 47 | undebian_check_files_tmp = $(call undebian_check_files,$(patsubst %.tmp,%,$(1))) 48 | 49 | # We need a level of indirection here in order to make sure that 50 | # normal makefile targets, like "clean", are not affected by the 51 | # debian_check_files rules. 52 | $(call debian_check_files,%): $(call debian_check_files_tmp,%) 53 | mv $< $@ 54 | 55 | # We check md5sums from both /var/lib/dpkg/info/$(package).md5sums 56 | # (the md5sums database for non-conffiles) and the conffiles database 57 | # used for prompting about conffiles being changed (via dpkg-query). 58 | # 59 | # There is some wrangling here because the formats of these sources differ. 60 | $(call debian_check_files_tmp,%): target = $(call undebian_check_files_tmp,$@) 61 | $(call debian_check_files_tmp,%): name = $(call debian_check_files_source,$(target)) 62 | $(call debian_check_files_tmp,%): truename = $(if $(filter /%,$(name)),$(shell dpkg-divert --truename $(name)),$(name)) 63 | $(call debian_check_files_tmp,%): package = $(if $(filter /%,$(name)),$(shell LC_ALL=C dpkg -S $(name) | sed -n '/^diversion by /! s/: .*$$// p'),x) 64 | $(call debian_check_files_tmp,%): $(truename) 65 | [ -n "$(package)" ] 66 | mkdir -p $(@D) 67 | cp "$(truename)" $@ 68 | set -e; \ 69 | case "$(name)" in /*) ;; *) exit 0;; esac; \ 70 | md5sums="$$(dpkg-query --control-path $(package) md5sums 2>/dev/null)" || \ 71 | md5sums=/var/lib/dpkg/info/$(package).md5sums; \ 72 | md5=$$(dpkg-query --showformat='$${Conffiles}\n' --show $(package) | \ 73 | sed -n 's,^ $(name) \([0-9a-f]*\)$$,\1 $@, p'); \ 74 | if [ -n "$$md5" ]; then \ 75 | echo "$$md5" | md5sum -c; \ 76 | elif [ -e "$$md5sums" ]; then \ 77 | md5=$$(sed -n 's,^\([0-9a-f]*\) $(patsubst /%,%,$(name))$$,\1 $@, p' \ 78 | "$$md5sums"); \ 79 | [ -n "$$md5" ] && echo "$$md5" | md5sum -c; \ 80 | else \ 81 | echo "config-package-dev: warning: $(package) does not include md5sums!"; \ 82 | echo "config-package-dev: warning: md5sum for $(name) not verified."; \ 83 | fi 84 | 85 | clean:: 86 | rm -rf $(DEB_CHECK_FILES_TMPDIR) 87 | 88 | endif 89 | -------------------------------------------------------------------------------- /displace.sh.in: -------------------------------------------------------------------------------- 1 | # displace.sh.in: diversion helpers for maintainer scripts 2 | # 3 | # displace_link 4 | # 5 | # Ensures that the file is properly diverted to 6 | # .divert-orig by this package, and becomes a 7 | # symbolic link to either .divert (default) or 8 | # .divert-orig. 9 | # 10 | # undisplace_unlink 11 | # 12 | # Undoes the action of displace_link specified 13 | # above. 14 | # 15 | # Version: 4.0 16 | # 17 | # Copyright © 2008–2012 Tim Abbott and Anders 18 | # Kaseorg 19 | # 20 | # Permission is hereby granted, free of charge, to any person 21 | # obtaining a copy of this software and associated documentation files 22 | # (the “Software”), to deal in the Software without restriction, 23 | # including without limitation the rights to use, copy, modify, merge, 24 | # publish, distribute, sublicense, and/or sell copies of the Software, 25 | # and to permit persons to whom the Software is furnished to do so, 26 | # subject to the following conditions: 27 | # 28 | # The above copyright notice and this permission notice shall be 29 | # included in all copies or substantial portions of the Software. 30 | # 31 | # THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 32 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 33 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 34 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 35 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 36 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 37 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 38 | # SOFTWARE. 39 | # 40 | 41 | package=#PACKAGE# 42 | 43 | ours=#DEB_DISPLACE_EXTENSION# 44 | theirs=#DEB_DISPLACE_EXTENSION#-orig 45 | 46 | displace_link_divert() 47 | { 48 | file=$1 49 | ourfile=$2 50 | theirfile=$3 51 | if ! LC_ALL=C dpkg-divert --list "$package" | \ 52 | grep -xFq "diversion of $file to $theirfile by $package"; then 53 | dpkg-divert --divert "$theirfile" --rename --package "$package" --add "$file" 54 | fi 55 | } 56 | 57 | displace_link_symlink() 58 | { 59 | file=$1 60 | ourfile=$2 61 | theirfile=$3 62 | if [ ! -L "$file" ] && [ ! -e "$file" ]; then 63 | ln -s "$(basename "$ourfile")" "$file" 64 | elif [ ! -L "$file" ] || \ 65 | [ "$(readlink "$file")" != "$(basename "$ourfile")" -a \ 66 | "$(readlink "$file")" != "$(basename "$theirfile")" ]; then 67 | echo "*** OMINOUS WARNING ***: $file is not linked to either $(basename "$ourfile") or $(basename "$theirfile")" >&2 68 | fi 69 | } 70 | 71 | displace_link() 72 | { 73 | prefix=$1 74 | suffix=$2 75 | 76 | file=$prefix$suffix 77 | ourfile=$prefix$ours$suffix 78 | theirfile=$prefix$theirs$suffix 79 | displace_link_divert "$file" "$ourfile" "$theirfile" 80 | displace_link_symlink "$file" "$ourfile" "$theirfile" 81 | } 82 | 83 | displace_hide() 84 | { 85 | file=$1 86 | ourfile="" 87 | theirfile=$2 88 | displace_link_divert "$file" "$ourfile" "$theirfile" 89 | } 90 | 91 | undisplace_unlink_symlink() 92 | { 93 | file="$1" 94 | ourfile="$2" 95 | theirfile="$3" 96 | if [ ! -L "$file" ] || \ 97 | [ "$(readlink "$file")" != "$(basename "$ourfile")" -a \ 98 | "$(readlink "$file")" != "$(basename "$theirfile")" ]; then 99 | echo "*** OMINOUS WARNING ***: $file is not linked to either $(basename "$ourfile") or $(basename "$theirfile")" >&2 100 | else 101 | rm -f "$file" 102 | fi 103 | } 104 | 105 | undisplace_unlink_divert() 106 | { 107 | file="$1" 108 | if [ ! -L "$file" ] && [ ! -e "$file" ]; then 109 | dpkg-divert --remove --rename --package "$package" "$file" 110 | else 111 | echo "Not removing diversion of $file by $package" >&2 112 | fi 113 | } 114 | 115 | undisplace_unlink() 116 | { 117 | prefix=$1 118 | suffix=$2 119 | 120 | file=$prefix$suffix 121 | ourfile=$prefix$ours$suffix 122 | theirfile=$prefix$theirs$suffix 123 | 124 | undisplace_unlink_symlink "$file" "$ourfile" "$theirfile" 125 | undisplace_unlink_divert "$file" 126 | } 127 | 128 | undisplace_unhide() 129 | { 130 | file=$1 131 | undisplace_unlink_divert "$file" 132 | } 133 | 134 | check_undisplace_unlink() 135 | { 136 | prefix=$1 137 | suffix=$2 138 | 139 | file=$prefix$suffix 140 | ourfile=$prefix$ours$suffix 141 | theirfile=$prefix$theirs$suffix 142 | 143 | if LC_ALL=C dpkg-divert --list "$package" | \ 144 | grep -xFq "diversion of $file to $theirfile by $package"; then 145 | undisplace_unlink "$prefix" "$suffix" 146 | fi 147 | } 148 | 149 | check_undisplace_unhide() 150 | { 151 | file=$1 152 | hiddenfile=$2 153 | if LC_ALL=C dpkg-divert --list "$package" | \ 154 | grep -xFq "diversion of $file to $hiddenfile by $package"; then 155 | undisplace_unhide "$file" 156 | fi 157 | } 158 | 159 | # End of displace.sh.in 160 | -------------------------------------------------------------------------------- /config-package.mk: -------------------------------------------------------------------------------- 1 | # -*- mode: makefile; coding: utf-8 -*- 2 | # Copyright © 2007-2008 Anders Kaseorg and 3 | # Tim Abbott 4 | # 5 | # This program is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License as 7 | # published by the Free Software Foundation; either version 2, or (at 8 | # your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program; if not, write to the Free Software 17 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 18 | # 02111-1307 USA. 19 | 20 | # /usr/share/cdbs/1/rules/config-package.mk is the externally-facing 21 | # makefile fragment for config-package-dev. It should be included 22 | # after the following variables are set in debian/rules. 23 | # 24 | # 25 | # Most variables are lists, so one can 26 | # 27 | # DEB_DISPLACE_FILES_package += /path1/file1.divert \ 28 | # /path2/file2.divert \ 29 | # /path3/file3.divert 30 | # 31 | # We use += in the examples 32 | # 33 | # The config-package-dev system supports the following variables: 34 | # 35 | # DEB_DISPLACE_EXTENSION 36 | # 37 | # Extension used for all config-package-dev diversions (defaults to 38 | # .divert, which we will use in examples). This field is difficult to 39 | # change on package upgrades; we recommend picking a value to use for 40 | # all packages at your site. 41 | # 42 | # DEB_DISPLACE_FILES_package += /path/file.divert 43 | # 44 | # List of absolute paths to files to be replaced at package install 45 | # time by being diverted from /path/file to /path/file.divert-orig 46 | # (DEB_DISPLACE_EXTENSION should be part of the path, but need not 47 | # appear at the end); a symlink /path/file -> /path/file.divert will 48 | # be installed in its place. The user is responsible for installing 49 | # /path/file.divert. This is best for diverting binaries and most 50 | # configuration files. 51 | # 52 | # DEB_TRANSFORM_FILES_package += /path/file.divert 53 | # 54 | # This works like DEB_DISPLACE_FILES, but additionally the file to be 55 | # installed to /path/file.divert will be generated at package build 56 | # time as the standard output from 57 | # 58 | # $(DEB_TRANSFORM_SCRIPT_path/file.divert) < $(DEB_CHECK_FILES_SOURCE_/path/file.divert) 59 | # 60 | # These variables have the following defaults: 61 | # 62 | # DEB_TRANSFORM_SCRIPT_path/file.divert = debian/transform_file.divert 63 | # DEB_CHECK_FILES_SOURCE_/path/file.divert = /path/file 64 | # 65 | # If DEB_CHECK_FILES_SOURCE_/path/file.divert does not match the 66 | # md5sums shipped with the package containing it, the package build 67 | # will abort. DEB_TRANSFORM_FILES is targeted at making changes to a 68 | # (potentially long) configuration file that will work on several 69 | # Debian versions. We recommend using DEB_TRANSFORM_FILES in 70 | # conjunction with pbuilder, sbuild, or another tool for building 71 | # Debian packages in a clean environment. (That said, if /path/file is 72 | # diverted on the running system, DEB_CHECK_FILES_SOURCE does 73 | # reverse-resolve the diversion and default to the original version of 74 | # the file, to allow you to rebuild a package using DEB_TRANSFORM_FILES 75 | # that is currently installed, in most cases.) 76 | # 77 | # DEB_HIDE_FILES_package += /path/file 78 | # 79 | # List of absolute paths to files to be diverted to a unique path in 80 | # /usr/share/package/. No symlink or replacement file will be 81 | # installed. This system is useful for disabling files in /etc/cron.d 82 | # or similar .d directories where the normal divert-and-symlink 83 | # approach would result in (e.g.) the old cron job still being run, 84 | # and any new cron job being run twice. Note that for technical 85 | # reasons related to how dpkg unpacks files, you cannot also install a 86 | # replacement file to /etc/cron.d/file; you must install it to some 87 | # other path (which should be fine in a .d directory). If you want to 88 | # install a replacement file with the same name, you probably want 89 | # DEB_DISPLACE_FILES. 90 | # 91 | # DEB_UNDISPLACE_FILES_package += /path/file.divert 92 | # 93 | # List of absolute paths to files whose diversions caused by 94 | # DEB_DISPLACE_FILES are to be removed upon installing this package, if 95 | # the diversions have been made on the target system. This is 96 | # primarily useful for removing a now-unnecessary displacement provided by 97 | # a previous version of this package on an upgrade. 98 | # 99 | # DEB_UNHIDE_FILES_package += /path/file 100 | # 101 | # This works like DEB_UNDISPLACE_FILES_package, except that it undoes 102 | # the work of a previous DEB_HIDE_FILES. In particular, it only removes 103 | # the diversion, whereas DEB_UNDISPLACE_FILES first removes the symlink 104 | # generated by DEB_DISPLACE_FILES. 105 | 106 | ifndef _cdbs_rules_config_package 107 | _cdbs_rules_config_package = 1 108 | 109 | # transform-files.mk includes the other config-package-dev fragments. 110 | include /usr/share/cdbs/1/rules/transform-files.mk 111 | 112 | endif 113 | -------------------------------------------------------------------------------- /displace.mk: -------------------------------------------------------------------------------- 1 | # -*- mode: makefile; coding: utf-8 -*- 2 | # Copyright © 2007-2008 Anders Kaseorg and 3 | # Tim Abbott 4 | # 5 | # This program is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License as 7 | # published by the Free Software Foundation; either version 2, or (at 8 | # your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program; if not, write to the Free Software 17 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 18 | # 02111-1307 USA. 19 | 20 | # Don't include displace.mk in your rules files directly; instead use 21 | # config-package.mk. 22 | 23 | # displace.mk handles the low-level diversion logic. It includes 24 | # displace.sh.in in the postinst and prerm scripts, and adds calls to 25 | # the functions in displace.sh.in to add and remove diversions and 26 | # symlinks at the appropriate points. 27 | 28 | ifndef _cdbs_rules_displace 29 | _cdbs_rules_displace = 1 30 | 31 | include /usr/share/cdbs/1/rules/debhelper.mk 32 | 33 | CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), config-package-dev (>= 5.2~) 34 | 35 | # displace.sh.in is included in the postinst/prerm scripts of packages 36 | # installing diversions and symlinks using config-package-dev. 37 | DEB_DISPLACE_SCRIPT = /usr/share/debhelper/autoscripts/displace.sh.in 38 | # script used to encode the path of a file uniquely in a valid virtual 39 | # package name. 40 | DEB_DISPLACE_ENCODER = /usr/share/config-package-dev/encode 41 | 42 | DEB_DISPLACE_PACKAGES += $(foreach package,$(DEB_ALL_PACKAGES), \ 43 | $(if $(DEB_TRANSFORM_FILES_$(package)),$(package), \ 44 | $(if $(DEB_HIDE_FILES_$(package)),$(package), \ 45 | $(if $(DEB_UNHIDE_FILES_$(package)),$(package), \ 46 | $(if $(DEB_UNDISPLACE_FILES_$(package)),$(package), \ 47 | $(if $(DEB_DISPLACE_FILES_$(package)),$(package), \ 48 | $(if $(DEB_REMOVE_FILES_$(package)),$(package), \ 49 | $(if $(DEB_UNREMOVE_FILES_$(package)),$(package), \ 50 | $(if $(DEB_UNDIVERT_FILES_$(package)),$(package), \ 51 | $(if $(DEB_DIVERT_FILES_$(package)),$(package))))))))))) 52 | 53 | ifeq ($(DEB_DISPLACE_EXTENSION),) 54 | ifeq ($(DEB_DIVERT_EXTENSION),) 55 | DEB_DISPLACE_EXTENSION = .divert 56 | else 57 | DEB_DISPLACE_EXTENSION = $(DEB_DIVERT_EXTENSION) 58 | endif 59 | endif 60 | 61 | ifeq ($(filter .%,$(DEB_DISPLACE_EXTENSION)),) 62 | DEB_DISPLACE_EXTENSION := .$(DEB_DISPLACE_EXTENSION) 63 | endif 64 | 65 | # Replace only the last instance of DEB_DISPLACE_EXTENSION in the 66 | # filename, to make it possible to displace /path/foo.divert to 67 | # foo.divert.divert-orig 68 | displace_files_replace_name = $(shell echo $(1) | perl -pe 's/(.*)\Q$(DEB_DISPLACE_EXTENSION)\E/$$1$(2)/') 69 | 70 | # Encode a full path into the path it should be diverted to if it's 71 | # hidden 72 | hide_files_name = /usr/share/$(cdbs_curpkg)/$(shell $(DEB_DISPLACE_ENCODER) $(1)) 73 | 74 | dh_compat_6 := $(shell if [ '$(DH_COMPAT)' -ge 6 ]; then echo y; fi) 75 | 76 | reverse = $(foreach n,$(shell seq $(words $(1)) -1 1),$(word $(n),$(1))) 77 | reverse_dh_compat_6 = $(if $(dh_compat_6),$(call reverse,$(1)),$(1)) 78 | 79 | debian-displace/%: package = $(subst debian-displace/,,$@) 80 | debian-displace/%: displace_files = $(DEB_DISPLACE_FILES_$(package)) $(DEB_DIVERT_FILES_$(package)) $(DEB_TRANSFORM_FILES_$(package)) 81 | debian-displace/%: displace_hide_files = $(DEB_HIDE_FILES_$(package)) $(DEB_REMOVE_FILES_$(package)) 82 | debian-displace/%: displace_undisplace_files = $(DEB_UNDISPLACE_FILES_$(package)) $(DEB_UNDIVERT_FILES_$(package)) 83 | debian-displace/%: displace_unhide_files = $(DEB_UNHIDE_FILES_$(package)) $(DEB_UNREMOVE_FILES_$(package)) 84 | debian-displace/%: displace_files_all = $(strip $(displace_files) $(displace_hide_files) $(displace_undisplace_files) $(displace_unhide_files)) 85 | debian-displace/%: displace_files_thispkg = $(strip $(displace_files) $(displace_hide_files)) 86 | $(patsubst %,debian-displace/%,$(DEB_DISPLACE_PACKAGES)) :: debian-displace/%: 87 | # Writing shell scripts in makefiles sucks. Remember to $$ shell 88 | # variables and include \ at the end of each line. 89 | # Add code to postinst to add/remove diversions and symlinks as appropriate 90 | set -e; \ 91 | { \ 92 | sed 's/#PACKAGE#/$(cdbs_curpkg)/g; s/#DEB_DISPLACE_EXTENSION#/$(DEB_DISPLACE_EXTENSION)/g' $(DEB_DISPLACE_SCRIPT); \ 93 | $(if $(displace_files_all), \ 94 | echo 'if [ "$$1" = "configure" ]; then'; \ 95 | $(foreach file,$(displace_undisplace_files), \ 96 | echo " check_undisplace_unlink $(call displace_files_replace_name,$(file), )"; )\ 97 | $(foreach file,$(displace_unhide_files), \ 98 | echo " check_undisplace_unhide $(file) $(call hide_files_name,$(file))"; )\ 99 | $(foreach file,$(displace_files), \ 100 | echo " displace_link $(call displace_files_replace_name,$(file), )";) \ 101 | $(foreach file,$(displace_hide_files), \ 102 | mkdir -p debian/$(cdbs_curpkg)/usr/share/$(cdbs_curpkg); \ 103 | echo " displace_hide $(file) $(call hide_files_name,$(file))";) \ 104 | echo 'fi'; \ 105 | ) \ 106 | } >> $(CURDIR)/debian/$(cdbs_curpkg).postinst.debhelper 107 | # Add code to prerm script to undo diversions and symlinks when package is removed. 108 | set -e; \ 109 | { \ 110 | $(if $(dh_compat_6),, \ 111 | if [ -e $(CURDIR)/debian/$(cdbs_curpkg).prerm.debhelper ]; then \ 112 | cat $(CURDIR)/debian/$(cdbs_curpkg).prerm.debhelper; \ 113 | fi;) \ 114 | sed 's/#PACKAGE#/$(cdbs_curpkg)/g; s/#DEB_DISPLACE_EXTENSION#/$(DEB_DISPLACE_EXTENSION)/g' $(DEB_DISPLACE_SCRIPT); \ 115 | $(if $(displace_files_thispkg), \ 116 | echo 'if [ "$$1" = "remove" ] || [ "$$1" = "deconfigure" ]; then'; \ 117 | $(foreach file,$(call reverse_dh_compat_6,$(displace_files)), \ 118 | echo " undisplace_unlink $(call displace_files_replace_name,$(file), )";) \ 119 | $(foreach file,$(call reverse_dh_compat_6,$(displace_hide_files)), \ 120 | echo " undisplace_unhide $(file) $(cdbs_curpkg)";) \ 121 | echo 'fi'; \ 122 | ) \ 123 | $(if $(dh_compat_6), \ 124 | if [ -e $(CURDIR)/debian/$(cdbs_curpkg).prerm.debhelper ]; then \ 125 | cat $(CURDIR)/debian/$(cdbs_curpkg).prerm.debhelper; \ 126 | fi;) \ 127 | } >> $(CURDIR)/debian/$(cdbs_curpkg).prerm.debhelper.new 128 | mv $(CURDIR)/debian/$(cdbs_curpkg).prerm.debhelper.new \ 129 | $(CURDIR)/debian/$(cdbs_curpkg).prerm.debhelper 130 | # Add an encoding of the names of the diverted files to the Provides: 131 | # and Conflicts: lists. This prevents two packages diverting the same 132 | # file from being installed simultaneously (it cannot work, and this 133 | # produces a much less ugly error). Requires in debian/control: 134 | # Provides: ${diverted-files} 135 | # Conflicts: ${diverted-files} 136 | set -e; \ 137 | { \ 138 | echo -n "diverted-files="; \ 139 | $(foreach file,$(displace_files_thispkg),\ 140 | echo -n "diverts-"; \ 141 | ${DEB_DISPLACE_ENCODER} "$(call displace_files_replace_name,$(file))"; \ 142 | echo -n ", ";) \ 143 | echo; \ 144 | } >> $(CURDIR)/debian/$(cdbs_curpkg).substvars 145 | 146 | $(patsubst %,binary-post-install/%,$(DEB_DISPLACE_PACKAGES)) :: binary-post-install/%: debian-displace/% 147 | 148 | endif 149 | -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | config-package-dev (5.5.1) unstable; urgency=medium 2 | 3 | * Team Upload. 4 | * Add test dependency on build-essential (Closes: #1108856). 5 | 6 | -- Alexander Chernyakhovsky Sun, 06 Jul 2025 12:25:03 -0400 7 | 8 | config-package-dev (5.5) unstable; urgency=medium 9 | 10 | * Add Rules-Requires-Root: no to base package and examples, which 11 | should fix ci.debian.net tests. 12 | * Add Multi-Arch: foreign, which allows apt to resolve 13 | config-package-dev as a cross-build-dependency. Thanks to @mrksngl 14 | on GitHub for the patch. 15 | * Also add Multi-Arch: foreign to the examples, as this is right for most 16 | users of config-package-dev (just as Architecture: all is right for most 17 | users of config-package-dev). 18 | * displace.sh: Rename (un)displace_link_displace to 19 | (un)displace_link_divert (Debathena: #1362) 20 | * Switch to machine-readable debian/copyright. 21 | * Ensure installed examples are not compressed, so you can copy them 22 | and build them directly. 23 | 24 | -- Geoffrey Thomas Sat, 27 Jan 2018 18:29:36 -0500 25 | 26 | config-package-dev (5.4) unstable; urgency=medium 27 | 28 | * Add a basic autopkgtest to make sure the examples build. 29 | * Move packaging to GitHub, and add the .travis.yml from 30 | http://travis.debian.net/ to run autopkgtests on each push. 31 | * examples/*: Bump debian/compat to 9 (no changes) and 32 | Standards-Version to 4.1.0 (change priority to "optional"). 33 | 34 | -- Geoffrey Thomas Wed, 18 Oct 2017 10:14:41 -0400 35 | 36 | config-package-dev (5.3) unstable; urgency=high 37 | 38 | * Fix a regression in the change that permitted omission of leading 39 | slashes, which completely broke transforms (Closes: #873966). Thanks 40 | to Bruno Maitre for the report and the patch. 41 | * Fix the paths in the two transform examples to work with the current 42 | version of lynx. 43 | * Update Standards-Version to 4.1.0 by changing priority from "extra" 44 | to "optional". 45 | 46 | -- Geoffrey Thomas Fri, 01 Sep 2017 14:39:35 -0400 47 | 48 | config-package-dev (5.2) unstable; urgency=medium 49 | 50 | * Permit debian/$package.displace-extension to omit the leading dot 51 | (Closes: #760200). Thanks to Dima Kogan for the patch. 52 | * Allow Debhelper control files to omit leading slashes 53 | (Closes: #803962). 54 | * Allow specifying relative paths, within the Debian source package, 55 | as the source for a transformation, and do not check these files 56 | against the dpkg database (Closes: #864611). Thanks to Luca Boccassi 57 | for the patch. 58 | * Bump Standards-Version to 4.0.0 and Debhelper compat level to v9 59 | (no changes). 60 | * debian/control, debian/copyright: Use https in URLs. 61 | * debian/control: Depend on ${perl:Depends}, which gives us a 62 | dependency on perl (not just perl-base) for Digest::MD5. Thanks, 63 | dh_perl! 64 | 65 | -- Geoffrey Thomas Sat, 01 Jul 2017 11:46:18 -0400 66 | 67 | config-package-dev (5.1.2) unstable; urgency=low 68 | 69 | * Team upload. 70 | * Don't hardcode dpkg-divert's path in check-files.mk (Debathena: #1358) 71 | 72 | -- Jonathan Reed Wed, 22 May 2013 08:27:04 -0400 73 | 74 | config-package-dev (5.1.1) unstable; urgency=low 75 | 76 | * Team upload. 77 | * No-change rebuild to remove stray symlinks and build detritus from the 78 | upload (Closes: #705214) 79 | 80 | -- Jonathan Reed Fri, 12 Apr 2013 17:59:30 -0400 81 | 82 | config-package-dev (5.1) unstable; urgency=low 83 | 84 | [ Team Upload ] 85 | * Support the abort-remove invocation of postinst 86 | * Add the transformed file, not its source, to the list of files to displace 87 | 88 | -- Alexander Chernyakhovsky Mon, 08 Apr 2013 15:12:32 -0400 89 | 90 | config-package-dev (5.0) unstable; urgency=low 91 | 92 | * Add Debhelper support (Debathena: #867) (Closes: #693672). This 93 | release includes a new command, dh_configpackage, and a sequencer 94 | extension, dh --with config-package. 95 | * Use the terms "displace" and "hide" for actions of the 96 | config-package-dev system, instead of the terms "divert" and 97 | "remove", which already have existing (related) meanings in the 98 | context of Debian packages. 99 | * Move examples/* to examples/cdbs/*, and create examples/debhelper/*, 100 | with the same packages using Debhelper 7-style packaging. 101 | 102 | * Change config-package-dev's own packaging to Debhelper 7. 103 | * Bump Standards-Version to 3.9.4 (no changes required). 104 | * Update Vcs-Git and Vcs-Browser locations to new upstream. 105 | * Drop CDBS runtime dependency. CDBS users should be explicitly 106 | Build-Depending on CDBS, probably through use of the @cdbs@ macro in 107 | debian/control.in. 108 | 109 | -- Geoffrey Thomas Wed, 06 Mar 2013 17:14:42 -0800 110 | 111 | config-package-dev (4.14) unstable; urgency=low 112 | 113 | [ Anders Kaseorg ] 114 | * Reverse prerm and postrm maintainer script fragments when DH_COMPAT ≥ 115 | 6, not 5, to actually match debhelper’s behavior. 116 | 117 | [ Geoffrey Thomas ] 118 | * Update debathena-transform-example-1.0 to an example more likely to 119 | work on modern systems. 120 | * Fix a bug that would erroneously remove DEB_TRANSFORM_EXTENSION from 121 | an explicitly-specified DEB_TRANSFORM_FILES_SOURCE. 122 | * Fix some typos and misleading documentation. In particular, fix 123 | build-dependencies and runtime dependencies of the examples. 124 | * Remove an unnecessary parameter passed to undivert_unlink_divert in 125 | divert.sh (Debathena: #1061). 126 | * Undivert when a package is unconfigured, in addition to when it is 127 | removed (partially addresses Debathena #388). 128 | * Add self to uploaders, and change maintainer to the Debathena 129 | project mailing list. 130 | 131 | -- Geoffrey Thomas Tue, 25 Sep 2012 13:24:06 -0400 132 | 133 | config-package-dev (4.13) unstable; urgency=low 134 | 135 | * Fix DEB_CHECK_FILES and DEB_TRANSFORM_FILES with non-conffiles in 136 | Multi-Arch: same packages. 137 | * Fix encode script to work with Perl 5.12. While we’re at it, turn on 138 | strict and warnings. 139 | * Set LC_ALL=C when matching potentially localized dpkg output. 140 | * Bump Standards-Version to 3.9.2 (no changes required). 141 | * Add Vcs-Git, Vcs-Browser. 142 | 143 | -- Anders Kaseorg Tue, 25 Oct 2011 20:26:50 -0400 144 | 145 | config-package-dev (4.12) unstable; urgency=low 146 | 147 | [ Tim Abbott ] 148 | * Allow specifying DEB_TRANSFORM_SCRIPT_$package_$file in case you want 149 | multiple binary packages transforming the same file differently. 150 | (Thanks to Evan Broder for this patch). 151 | * Add a decode script for undoing the file to virtual package name 152 | transformation. (Thanks to Patrick Hurst for writing decode). 153 | 154 | [ Anders Kaseorg ] 155 | * Fix a quoting bug that failed to disallow transformation of generated 156 | conffiles. (Patch from Evan Broder.) 157 | * Remove DEB_UNDIVERT_VERSION_file and DEB_UNREMOVE_VERSION_file, and 158 | instead test for the undiverted file in the postinst. (Patch from 159 | Evan Broder.) 160 | * Write the prerm and postrm maintainer script fragments in reverse 161 | order when DH_COMPAT ≥ 5, to match debhelper’s behavior. 162 | * Bump debhelper compatibility level to 6. 163 | * Bump Standards-Version to 3.9.1 (no changes required). 164 | 165 | -- Anders Kaseorg Sat, 05 Feb 2011 21:37:05 -0500 166 | 167 | config-package-dev (4.11) unstable; urgency=low 168 | 169 | * Fix marking transform scripts as executable when 170 | DEB_TRANSFORM_SCRIPT_package is used. 171 | 172 | -- Tim Abbott Sat, 05 Sep 2009 11:46:54 -0400 173 | 174 | config-package-dev (4.10) unstable; urgency=low 175 | 176 | * Mark transform scripts as executable before attempting to execute them 177 | (Closes: #528995). 178 | 179 | -- Tim Abbott Sun, 02 Aug 2009 19:48:33 -0400 180 | 181 | config-package-dev (4.9) unstable; urgency=low 182 | 183 | [ Tim Abbott ] 184 | * Fix destdir handling for multiple binary packages in 185 | DEB_TRANSFORM_FILES (Closes: #510355). 186 | * Add Anders Kaseorg to Uploaders. 187 | 188 | [ Anders Kaseorg ] 189 | * Use set -e in multi-statement Makefile commands. 190 | 191 | -- Tim Abbott Wed, 31 Dec 2008 16:39:44 -0500 192 | 193 | config-package-dev (4.8) unstable; urgency=low 194 | 195 | * Add additional documentation to the makefile fragments 196 | * Add doc/ directory with pointer to online documentation 197 | * Add examples/ directory (Closes: #486130). 198 | * Rename configures- to diverts- as the prefix for the virtual packages 199 | that cause packages diverting the same file to conflict, since that is 200 | clearer. 201 | 202 | -- Tim Abbott Sun, 13 Jul 2008 01:54:48 -0400 203 | 204 | config-package-dev (4.7) unstable; urgency=low 205 | 206 | * Move homepage field to source package section, so it works. 207 | * Make DEB_TRANSFROM_FILES targets depend on common-build-arch and 208 | common-build-indep, so it works with architecture-dependent packages. 209 | * Remove useless clean code from transform-files.mk. 210 | * Move divert.mk from binary-fixup to binary-post-install. 211 | * Add debhelper.mk to divert.mk, since we use its 212 | binary-post-install/package target. 213 | * Change maintainer to me, rather than debathena@mit.edu, since I'll be 214 | maintaining config-package-dev in Debian. 215 | * Upload to Debian (Closes: #469107) 216 | 217 | -- Tim Abbott Sat, 03 May 2008 13:37:12 -0400 218 | 219 | config-package-dev (4.6) unstable; urgency=low 220 | 221 | * Remove DEB_AUTO_UPDATE_DEBIAN_CONTROL so it can be uploaded to Debian. 222 | * Add me as uploader. 223 | * move homepage to homepage field. 224 | 225 | -- Tim Abbott Wed, 23 Apr 2008 17:08:15 -0400 226 | 227 | config-package-dev (4.5) unstable; urgency=low 228 | 229 | * Rename DEB_REPLACE_FILES to DEB_TRANSFORM_FILES 230 | * Create new config-package.mk as the outward-facing makefile fragment. 231 | * Replace DEB_{UNREMOVE,UNDIVERT}_FILES_VERSION_file with 232 | DEB_$1_VERSION_file 233 | 234 | -- Tim Abbott Mon, 21 Apr 2008 18:39:40 -0400 235 | 236 | config-package-dev (4.4.1) unstable; urgency=low 237 | 238 | * Version bump, since 4.4~ << 4.4 causes build failures on Debathena. 239 | 240 | -- Tim Abbott Mon, 21 Apr 2008 17:51:02 -0400 241 | 242 | config-package-dev (4.4) unstable; urgency=low 243 | 244 | * Add new DEB_REMOVE_FILES_$package variable designed for removing 245 | files in .d directories. 246 | * Move the "configure-" in the filename encoding from the encode script 247 | to divert.mk, so that we can re-use the encoder for DEB_REMOVE_FILES. 248 | * Add new DEB_UNDIVERT_FILES_package and DEB_UNREMOVE_FILES_package 249 | API variables for having a new version of the package stop diverting a 250 | file. 251 | * Correct check for not generating an empty if clause when no files are 252 | being diverted. 253 | * Remove only the last DEB_DIVERT_EXTENSION from filenames. 254 | 255 | -- Tim Abbott Sat, 19 Apr 2008 21:03:02 -0400 256 | 257 | config-package-dev (4.3) unstable; urgency=low 258 | 259 | * Fix bug where DEB_DIVERT code gets added twice if a package uses both 260 | DEB_DIVERT_FILES and DEB_REPLACE_FILES. 261 | 262 | -- Tim Abbott Sun, 6 Apr 2008 19:41:45 -0400 263 | 264 | config-package-dev (4.2) unstable; urgency=low 265 | 266 | * Rename DEB_REPLACE_FILES_SOURCE to DEB_CHECK_FILES_SOURCE, and 267 | move it to check-files.mk, since it really is a check-files.mk 268 | feature. 269 | * Make check-files.mk include divert.mk. 270 | * Don't directly include divert.mk in replace-files.mk. 271 | 272 | -- Tim Abbott Sun, 17 Feb 2008 23:01:08 -0500 273 | 274 | config-package-dev (4.1) unstable; urgency=low 275 | 276 | * Rename various API variables to make interface cleaner. 277 | * Rename variables involving DEBIAN to DEB in variable names. 278 | * Rename CONFFILES to FILES in variable names. 279 | * Rename divert:Diverted to divert:Files 280 | * Replace DEB_CONFFILE_DEST with DEB_REPLACE_FILES_SOURCE, changing the 281 | source rather than the destination. 282 | * Rename replace-conffiles.mk and check-conffiles.mk to *-files.mk. 283 | * Add support for multiple files with same basename to replace_files.mk 284 | via the DEB_TRANSFORM_SCRIPT variable. 285 | * Remove deprecated check-files interface. 286 | * Rename DEB_DIVERT_SUFFIX to DEB_DIVERT_EXTENSION. 287 | 288 | -- Tim Abbott Mon, 4 Feb 2008 02:07:16 -0500 289 | 290 | config-package-dev (4.0) unstable; urgency=low 291 | 292 | * Rename variables to be appropriate for non-MIT sites. 293 | 294 | -- Tim Abbott Thu, 31 Jan 2008 15:15:20 -0500 295 | 296 | debathena-config-build-common (3.6) unstable; urgency=low 297 | 298 | * Add new debathena-replace-conffiles.mk, a more user-friendly wrapper 299 | for debathena-check-conffiles.mk and debathena-divert.mk. 300 | * Change debathena-check-conffiles.mk to allow checking md5sums of 301 | packaged files which are not marked as configuration files 302 | (e.g. /etc/adduser/adduser.conf). 303 | * Change debathena-divert.mk to not set DEBATHENA_DIVERT_SUFFIX unless 304 | it is not already set. 305 | * Change debathena-divert.mk to support adding Provides: and Conflicts: 306 | lines for each diverted configuration file. 307 | * Change debathena-divert.mk to divert everything in 308 | DEBATHENA_REPLACE_CONFFILES. 309 | 310 | -- Tim Abbott Wed, 30 Jan 2008 20:03:36 -0500 311 | 312 | debathena-config-build-common (3.5) unstable; urgency=low 313 | 314 | * Change check-conffiles interface to make it work properly with 315 | dpkg-diverted files. 316 | 317 | -- Anders Kaseorg Mon, 13 Aug 2007 17:59:43 -0400 318 | 319 | debathena-config-build-common (3.4) unstable; urgency=low 320 | 321 | * Need [ -e ] || [ -L ] to check for existence, instead of just [ -e ]. 322 | 323 | -- Anders Kaseorg Mon, 06 Aug 2007 06:57:18 -0400 324 | 325 | debathena-config-build-common (3.3) unstable; urgency=low 326 | 327 | * Add check-conffiles script. 328 | 329 | -- Anders Kaseorg Fri, 03 Aug 2007 17:50:20 -0400 330 | 331 | debathena-config-build-common (3.2) unstable; urgency=low 332 | 333 | * Add debconf-hack script. 334 | 335 | -- Anders Kaseorg Tue, 24 Jul 2007 20:41:13 -0400 336 | 337 | debathena-config-build-common (3.1) unstable; urgency=low 338 | 339 | * Divert with the current package name, not the empty string. 340 | * Add this package as an automatic build dependency of anything that 341 | uses it. 342 | 343 | -- Anders Kaseorg Wed, 18 Jul 2007 01:13:40 -0400 344 | 345 | debathena-config-build-common (3.0debathena1) unstable; urgency=low 346 | 347 | * Fix divert script version. 348 | 349 | -- Anders Kaseorg Fri, 13 Jul 2007 15:57:19 -0400 350 | 351 | debathena-config-build-common (3.0) unstable; urgency=low 352 | 353 | * Initial release. 354 | 355 | -- Anders Kaseorg Fri, 06 Jul 2007 19:30:41 -0400 356 | -------------------------------------------------------------------------------- /dh_configpackage: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | # Copyright © 2007-2008 Anders Kaseorg and 3 | # Tim Abbott 4 | # Copyright © 2011-2012 Geoffrey Thomas 5 | # 6 | # This program is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2, or (at 9 | # your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, write to the Free Software 18 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 19 | # 02111-1307 USA. 20 | 21 | 22 | =head1 NAME 23 | 24 | dh_configpackage - add maintainer script rules to displace, hide, or transform files 25 | 26 | =cut 27 | 28 | use strict; 29 | use Debian::Debhelper::Dh_Lib; 30 | use Debian::Debhelper::config_package; 31 | use Digest::MD5; 32 | use IPC::Open3; 33 | 34 | 35 | =head1 SYNOPSIS 36 | 37 | B [B<--displace> I] [B<--hide> I] [B<--undisplace> I] [B<--unhide> I] [B<--transform> I] [S>] [B<-n>] 38 | 39 | =head1 DESCRIPTION 40 | 41 | B is a debhelper program to create "configuration 42 | packages". These packages provide an ideal way to distribute 43 | configurations to target systems while still affording local system 44 | administrators a degree of control over their workstations. The 45 | motivation and philosophy behind this style of packaging is described 46 | in detail on the config-package-dev website. Configuration packages 47 | make use of dpkg diversions and maintainer script snippets to provide 48 | three primary operations: displacing, hiding, and transforming files. 49 | 50 | The I operation consists of replacing a file on the target 51 | system. The original file is renamed out of the way and diverted in the 52 | dpkg database. The replacement file is then installed by the package, 53 | and the config-package-dev maintainer script snippets create a symlink 54 | from the original name. A common use of this is to install a wrapper 55 | script for an executable. 56 | 57 | The I operation is a special case of the displace operation. 58 | At build time, a "transform script" is applied to the original source, 59 | and the result is used as the replacement in the displace operation. A 60 | common use of this is to change one value in a config file without 61 | needing to re-type the entire config file (and risk bit-rot). 62 | 63 | The I operation is yet another special case of the displace 64 | operation, namely that there is no replacement or symlink. Instead, the 65 | file is diverted to a unique path on the target system, thus preserving 66 | its contents. A common use of this is to suppress a snippet file in a 67 | configuration directory (e.g. /etc/foo.d), thus disabling a specific 68 | operation or configuration. 69 | 70 | The I is a suffix appended to the diverted versions 71 | of files, and this suffix plus the string "-orig" is appended to the 72 | original versions of the files. The default value is the first word of 73 | the package name. For example, the extension for debathena-bin-example 74 | would be ".debathena". So if debathena-bin-example displaced /bin/true, 75 | dh_configpackage would create a diversion from /bin/true to 76 | /bin/true.debathena.orig, and create a symbolic link from /bin/true to 77 | /bin/true.debathena. The package should then install its modified 78 | version at /bin/true.debathena, using e.g. B. 79 | (For the remainder of this documentation, ".debathena" will be used as 80 | the displace extension.) 81 | 82 | =head1 FILES 83 | 84 | =over 4 85 | 86 | =item debian/I.displace 87 | 88 | List the files to displace, one per line, including the full path and 89 | displace extension. For example, to displace /usr/bin/true to 90 | /usr/bin/true.debathena, you would list "/usr/bin/true.debathena" in 91 | the file. (As with other Debhelper commands, you can omit the initial 92 | leading slash in pathnames in the package, but these examples retain 93 | it.) 94 | 95 | =item debian/I.hide 96 | 97 | List the files to hide, one per line, including the full path and 98 | displace extension. As noted above, these files won't actually be 99 | removed, but merely diverted and renamed to a unique path below 100 | /usr/share/I. 101 | 102 | =item debian/I.undisplace 103 | 104 | List the files to undisplace, one per line, including the full path and 105 | displace extension. B This is only needed when a new version of 106 | the package no longer needs to displace a file (for example, if an 107 | upstream bug was fixed). Packages automatically undo all operations 108 | upon removal or deconfiguration. 109 | 110 | =item debian/I.unhide 111 | 112 | List the files to unhide, one per line, including the full path 113 | and displace extension. B As with undisplace, this is only needed 114 | when a new version of the package no longer needs to hide a file. 115 | 116 | =item debian/I.transform 117 | 118 | Each line in the file specifies a transformation. A transformation 119 | consists of two space-separated fields: the full path of the 120 | target file including the displace extension and the transformation 121 | command itself. The transformation can either be a single shell 122 | command, or an executable file in the debian directory. The 123 | transformation takes the original source of the file on stdin and prints 124 | its transformation on stdout. Transformations are typically performed 125 | by perl, sed, or awk, but there is no limitation on what can be used as 126 | a transformation. 127 | 128 | For example, to transform /etc/school.conf by replacing all 129 | occurrences of the word 'Harvard' with the word 'MIT', you might 130 | specify the following line: 131 | 132 | /etc/school.conf.debathena sed -e 's/Harvard/MIT/g' 133 | 134 | Or, storing the command in a separate script: 135 | 136 | /etc/school.conf.debathena debian/transform_school.conf.pl 137 | 138 | If the transformation script fails, the package build fails. You can use 139 | this with e.g. Perl's C syntax to make sure that the source 140 | file of the transformation has not changed from what you expected. 141 | 142 | I: Under normal operation, the source (passed 143 | on stdin) for the transformation is the name of the target file without 144 | the displace extension. B will check to make sure that 145 | the source file is owned by a Debian package and has not been modified 146 | locally, in order to ensure that unwanted changes do not show up in the 147 | result of the transformation. (If the file is already displaced or 148 | transformed by a config-package-dev package, it will check the original 149 | version of the file and use that as the transformation source, allowing 150 | a config-package-dev package to be built correctly on a running system 151 | where a previous version of the same package was already installed.) 152 | 153 | In some cases, you may wish to use a different 154 | source (e.g. a sample configuration file in /usr/share/doc). You can 155 | specify this source as an optional field between the diversion 156 | filename and the transformation. This field must begin with a '<' 157 | immediately followed by the full path to the source. Taking the 158 | example above, we might alter it as follows: 159 | 160 | /etc/school.conf.debathena There is no "untransform" operation. Because a transform 169 | operation is a special case of a displace operation, the "undisplace" 170 | operation is the correct way of removing a no-longer-needed 171 | transformation in future versions of the package. 172 | 173 | =item debian/I.displace-extension 174 | 175 | This file is used to specify the displace extension for any files 176 | diverted by this package, if you do not want to accept the default of 177 | the first word in the package name. It will not normally be present. 178 | (See L<"CAVEATS">.) 179 | 180 | =back 181 | 182 | =head1 OPTIONS 183 | 184 | =over 4 185 | 186 | =item B<-n>, B<--noscripts> 187 | 188 | Do not modify maintainer scripts. This is a standard debhelper 189 | option, though you are strongly discouraged from using it except for 190 | debugging, as these operations rely heavily on the maintainer scripts. 191 | 192 | =item B<--displace> I 193 | 194 | =item B<--hide> I 195 | 196 | =item B<--undisplace> I 197 | 198 | =item B<--unhide> I 199 | 200 | =item B<--transform> I 201 | 202 | These options allow for specifying an operation on the command line. 203 | The argument to the option is the same as a single line of the 204 | corresponding file, as described above. You may specify multiple 205 | occurrences of B<--displace>, or you may invoke B 206 | repeatedly with different invocations. The most common use of this 207 | format is in a rules file when performing conditional operations, in an 208 | C target in the C file. See the 209 | debathena-conffile-example-1.1 package in 210 | /usr/share/doc/config-package-dev/EXAMPLES for one such use. 211 | 212 | =back 213 | 214 | =cut 215 | 216 | my (@arg_displace, @arg_hide, @arg_undisplace, @arg_unhide, @arg_transform); 217 | my $args_present = 0; 218 | 219 | init(options => { 220 | "displace=s" => \@arg_displace, 221 | "hide=s" => \@arg_hide, 222 | "undisplace=s" => \@arg_undisplace, 223 | "unhide=s" => \@arg_unhide, 224 | "transform=s" => \@arg_transform, 225 | }); 226 | 227 | if (@arg_displace or @arg_hide or @arg_undisplace or @arg_unhide or @arg_transform) { 228 | $args_present = 1; 229 | } 230 | 231 | # We default the displace extension to a period followed by the first 232 | # word of the package name, on the assumption that it is probably the 233 | # site name (e.g., "debathena-kerberos-config" displaces to 234 | # ".debathena"). You can set this extension explicitly in 235 | # debian/$package.displace-extension or debian/displace-extension. 236 | sub displace_extension { 237 | my $package = shift; 238 | my $file = pkgfile($package, "displace-extension"); 239 | if ($file) { 240 | open(my $fh, $file); 241 | my $ret = <$fh>; 242 | close $fh; 243 | 244 | chomp $ret; 245 | $ret = ".$ret" unless $ret =~ /^\./; # must start with . 246 | return $ret; 247 | } 248 | $package =~ s/-.*//; 249 | return ".$package"; 250 | } 251 | 252 | # Replace only the last instance of the displace extension in the 253 | # filename, to make it possible to displace /path/foo.divert to 254 | # foo.divert.divert-orig 255 | sub displace_files_replace_name { 256 | my ($package, $filename, $replacement) = @_; 257 | my $extension = displace_extension($package); 258 | $filename =~ s/(.*)\Q$extension\E/$1$replacement/; 259 | return $filename; 260 | } 261 | 262 | # Encode a full path into the path it should be diverted to if it's 263 | # hidden 264 | sub hide_files_name { 265 | my ($filename, $package) = @_; 266 | return "/usr/share/$package/" . encode($filename); 267 | } 268 | 269 | # At compatibility levels 6 and above, prerms take effect in the 270 | # opposite order from postinsts 271 | sub reverse_if_6 { 272 | if (compat(5)) { 273 | return @_; 274 | } else { 275 | return reverse @_; 276 | } 277 | } 278 | 279 | 280 | # check_file is used to verify that files on local disk have not 281 | # been modified from the upstream packaged version. 282 | # 283 | # We check md5sums from both /var/lib/dpkg/info/$(package).md5sums 284 | # (the md5sums database for non-conffiles) and the conffiles database 285 | # used for prompting about conffiles being changed (via dpkg-query). 286 | # 287 | # There is some wrangling here because the formats of these sources differ. 288 | 289 | sub check_file { 290 | my $name = shift; 291 | my $truename = `dpkg-divert --truename $name`; 292 | chomp $truename; 293 | die "$truename missing\n" unless (-e $truename); 294 | my $package = `LC_ALL=C dpkg -S $name | sed -n '/^diversion by /! s/: .*\$// p'`; 295 | chomp $package; 296 | die "$truename is not owned by any package\n" unless ($package); 297 | 298 | my $ctx = Digest::MD5->new; 299 | open(my $fh, $truename); 300 | binmode $fh; 301 | $ctx->addfile($fh); 302 | my $digest = $ctx->hexdigest; 303 | close $fh; 304 | 305 | my $hassums = 0; 306 | 307 | FINDMD5: { 308 | open($fh, "-|", qw(dpkg-query --showformat=${Conffiles}\n --show), $package); 309 | while (<$fh>) { 310 | next unless /^ \Q$name\E ([0-9a-f]{32})$/; 311 | $hassums = 1; 312 | if ($1 eq $digest) { 313 | last FINDMD5; 314 | } else { 315 | die "md5sum mismatch on $name\n"; 316 | } 317 | } 318 | close $fh; 319 | 320 | open(my $devnull, ">/dev/null"); 321 | my $pid = open3(undef, my $dpkg_query, $devnull, qw(dpkg-query --control-path), $package, "md5sums"); 322 | my $md5sums = <$dpkg_query>; 323 | chomp $md5sums; 324 | close $dpkg_query; 325 | close $devnull; 326 | waitpid $pid, 0; 327 | 328 | $md5sums ||= "/var/lib/dpkg/info/$package.md5sums"; 329 | 330 | if (-e $md5sums) { 331 | $hassums = 1; 332 | open($fh, $md5sums); 333 | my $relname = $name; 334 | $relname =~ s|^/||; 335 | while (<$fh>) { 336 | next unless /^([0-9a-f]{32}) \Q$relname\E$/; 337 | if ($1 eq $digest) { 338 | last FINDMD5; 339 | } else { 340 | die "md5sum mismatch on $name\n"; 341 | } 342 | } 343 | close $fh; 344 | } 345 | 346 | if ($hassums) { 347 | die "$package contains no md5sums for $name. Is it a generated file?\n"; 348 | } else { 349 | print "config-package-dev: warning: $package does not include md5sums!\n"; 350 | print "config-package-dev: warning: md5sum for $name not verified.\n"; 351 | } 352 | } 353 | 354 | return $truename; 355 | } 356 | 357 | foreach my $package (@{$dh{DOPACKAGES}}) { 358 | my (@displacefiles, @hidefiles, @undisplacefiles, @unhidefiles, @transformfiles); 359 | 360 | if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && $args_present) { 361 | @displacefiles = @arg_displace; 362 | @hidefiles = @arg_hide; 363 | @undisplacefiles = @arg_undisplace; 364 | @unhidefiles = @arg_unhide; 365 | @transformfiles = map {[split]} @arg_transform; 366 | } else { 367 | my $displacefile = pkgfile($package, "displace"); 368 | @displacefiles = filearray($displacefile) if $displacefile; 369 | my $hidefile = pkgfile($package, "hide"); 370 | @hidefiles = filearray($hidefile) if $hidefile; 371 | my $undisplacefile = pkgfile($package, "undisplace"); 372 | @undisplacefiles = filearray($undisplacefile) if $undisplacefile; 373 | my $unhidefile = pkgfile($package, "unhide"); 374 | @unhidefiles = filearray($unhidefile) if $unhidefile; 375 | my $transformfile = pkgfile($package, "transform"); 376 | @transformfiles = filedoublearray($transformfile) if $transformfile; 377 | } 378 | 379 | foreach my $listref (\@displacefiles, \@hidefiles, \@undisplacefiles, \@unhidefiles) { 380 | foreach my $file (@$listref) { 381 | $file =~ s|^/?|/|; 382 | } 383 | } 384 | 385 | 386 | my $tmp = tmpdir($package); 387 | my $extension = displace_extension($package); 388 | 389 | if (! $dh{ONLYSCRIPTS} && @hidefiles) { 390 | doit("install", "-d", "$tmp/usr/share/$package"); 391 | } 392 | 393 | foreach my $line (@transformfiles) { 394 | my $file = shift @$line; 395 | $file =~ s|^/?|/|; 396 | my $source; 397 | my $source_is_local = 0; 398 | if (@$line[0] =~ /^", "$tmp/$file"); 427 | push @displacefiles, $file; 428 | } 429 | 430 | # Add code to postinst to add/remove diversions as appropriate 431 | if (! $dh{NOSCRIPTS}) { 432 | if (@undisplacefiles || @unhidefiles || @displacefiles || @hidefiles) { 433 | my $postinst = escape_shell(join "\\n", ( 434 | 'if [ "$1" = "configure" ] || [ "$1" = "abort-remove" ]; then', 435 | (map {" check_undisplace_unlink " . displace_files_replace_name($package, $_, " ")} @undisplacefiles), 436 | (map {" check_undisplace_unhide $_ " . hide_files_name($_, $package)} @unhidefiles), 437 | (map {" displace_link " . displace_files_replace_name($package, $_, " ")} @displacefiles), 438 | (map {" displace_hide $_ " . hide_files_name($_, $package)} @hidefiles), 439 | 'fi' 440 | )); 441 | autoscript($package, "postinst", "displace.sh.in", 442 | "s/#PACKAGE#/$package/g; s/#DEB_DISPLACE_EXTENSION#/$extension/g; \\\$a\"$postinst\""); 443 | } 444 | if (@displacefiles || @hidefiles) { 445 | my $prerm = escape_shell(join "\\n", ( 446 | 'if [ "$1" = "remove" ] || [ "$1" = "deconfigure" ]; then', 447 | (map {" undisplace_unlink " . displace_files_replace_name($package, $_, " ")} reverse_if_6 (@displacefiles)), 448 | (map {" undisplace_unhide $_ $package"} reverse_if_6 (@hidefiles)), 449 | 'fi' 450 | )); 451 | autoscript($package, "prerm", "displace.sh.in", 452 | "s/#PACKAGE#/$package/g; s/#DEB_DISPLACE_EXTENSION#/$extension/g; \\\$a\"$prerm\""); 453 | } 454 | } 455 | 456 | # Add an encoding of the names of the diverted files to the Provides: 457 | # and Conflicts: lists. This prevents two packages diverting the same 458 | # file from being installed simultaneously (it cannot work, and this 459 | # produces a much less ugly error). Requires in debian/control: 460 | # Provides: ${diverted-files} 461 | # Conflicts: ${diverted-files} 462 | foreach my $file (@displacefiles, @hidefiles) { 463 | my $encodedfile = encode(displace_files_replace_name($package, $file, "")); 464 | addsubstvar($package, "diverted-files", "diverts-$encodedfile"); 465 | } 466 | } 467 | 468 | =head1 CAVEATS 469 | 470 | Because the displace extension is automatically generated from the 471 | package name, renaming the package can have unintended consequences. 472 | If you must rename a package such that the first component of the name 473 | changes, specify the old extension using the C file 474 | (see above). 475 | 476 | =head1 SEE ALSO 477 | 478 | L, L 480 | 481 | This program is a part of config-package-dev. 482 | 483 | =head1 AUTHOR 484 | 485 | config-package-dev was written by Anders Kaseorg and 486 | Tim Abbott . The debhelper port is by Geoffrey Thomas 487 | . Documentation by Jonathan Reed . 488 | 489 | =cut 490 | --------------------------------------------------------------------------------