lsb (9.20161101) unstable; urgency=medium
authorDidier Raboud <odyx@debian.org>
Tue, 1 Nov 2016 21:00:00 +0000 (21:00 +0000)
committerDidier Raboud <odyx@debian.org>
Tue, 1 Nov 2016 21:00:00 +0000 (21:00 +0000)
  [ Helmut Grohne ]
  * Fix FTCBFS: Annotate Build-Depends: python3-all with :any (Closes: #841679)
  * Add support for DEB_BUILD_OPTIONS=nocheck

[dgit import package lsb 9.20161101]

48 files changed:
debian/README.Debian [new file with mode: 0644]
debian/changelog [new file with mode: 0644]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/copyright [new file with mode: 0644]
debian/gbp.conf [new file with mode: 0644]
debian/lsb-base.NEWS [new file with mode: 0644]
debian/lsb-base.README.Debian [new file with mode: 0644]
debian/lsb-base.dirs [new file with mode: 0644]
debian/lsb-base.install [new file with mode: 0644]
debian/lsb-base.maintscript.Ubuntu [new file with mode: 0644]
debian/lsb-compat.dirs [new file with mode: 0644]
debian/lsb-compat.install [new file with mode: 0644]
debian/lsb-compat.lintian-overrides [new file with mode: 0644]
debian/lsb-compat.manpages [new file with mode: 0644]
debian/lsb-compat.postinst [new file with mode: 0755]
debian/lsb-compat.prerm [new file with mode: 0644]
debian/lsb-release.README.Debian [new file with mode: 0644]
debian/lsb-release.bug-script [new file with mode: 0755]
debian/lsb-release.install [new file with mode: 0644]
debian/lsb-release.links [new file with mode: 0644]
debian/lsb-release.manpages [new file with mode: 0644]
debian/lsb-release.postinst [new file with mode: 0644]
debian/lsb-release.postrm [new file with mode: 0644]
debian/rules [new file with mode: 0755]
debian/source/format [new file with mode: 0644]
debian/source/options [new file with mode: 0644]
init-functions [new file with mode: 0644]
init-functions.d/20-left-info-blocks [new file with mode: 0644]
init-functions.d/50-ubuntu-logging [new file with mode: 0644]
initdutils.py [new file with mode: 0644]
install_initd [new file with mode: 0755]
lsb.8 [new file with mode: 0644]
lsb_release [new file with mode: 0755]
lsb_release.1 [new file with mode: 0644]
lsb_release.py [new file with mode: 0644]
lsbinstall [new file with mode: 0755]
remove_initd [new file with mode: 0755]
sendmail [new file with mode: 0644]
test/apt-cache [new file with mode: 0755]
test/dpkg-query [new file with mode: 0755]
test/init-skeleton [new file with mode: 0644]
test/lsb-release [new file with mode: 0644]
test/lsb-test.sh [new file with mode: 0644]
test/minid.initd [new file with mode: 0755]
test/minid.pl [new file with mode: 0755]
test/test_initdutils.py [new file with mode: 0644]
test/test_lsb_release.py [new file with mode: 0644]

diff --git a/debian/README.Debian b/debian/README.Debian
new file mode 100644 (file)
index 0000000..429308a
--- /dev/null
@@ -0,0 +1,18 @@
+lsb for Debian
+--------------
+
+This package used to provide the Linux Standard Base on Debian systems.
+The LSB is a specification for allowing the same binary package to be used
+on multiple distributions.
+
+Since version 9.20150826, this package stopped providing the compatibility
+LSB packages and only provides two otherwise important packages:
+
+* The "lsb-base" package includes a number of functions used by init.d
+  scripts in some LSB packages.
+
+  For documentation of those functions (and those added for Debian's use),
+  please see the README.Debian file in that package.
+
+* The "lsb-release" package includes the lsb_release command, which provides
+  information about the installed LSB modules and the underlying distribution.
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..19a8bb4
--- /dev/null
@@ -0,0 +1,1481 @@
+lsb (9.20161101) unstable; urgency=medium
+
+  [ Helmut Grohne ]
+  * Fix FTCBFS: Annotate Build-Depends: python3-all with :any (Closes: #841679)
+  * Add support for DEB_BUILD_OPTIONS=nocheck
+
+ -- Didier Raboud <odyx@debian.org>  Tue, 01 Nov 2016 22:00:00 +0100
+
+lsb (9.20161016) unstable; urgency=medium
+
+  * Introduce the new lsb-compat package, providing a limited compatibility
+    layer for some selected LSB packages
+    - Provides, and replaces lsb & lsb-core
+    - Should be sufficient to install and run:
+      - Epson printer drivers (LP: #1536353)
+      - Google Earth (Closes: #830481)
+
+ -- Didier Raboud <odyx@debian.org>  Sun, 16 Oct 2016 15:55:46 +0200
+
+lsb (9.20160629) unstable; urgency=medium
+
+  [ Helge Deller ]
+  * Update lsb_release.py to cope with the new Debian Ports' release label
+    (Closes: #827137)
+
+ -- Didier Raboud <odyx@debian.org>  Wed, 29 Jun 2016 18:13:15 +0200
+
+lsb (9.20160601) unstable; urgency=medium
+
+  * Revert "Add 01-upstart-lsb from the upstart package, and make executing
+    rc.d scripts no-op if there is an upstart job for that script"
+    (Closes: #825946)
+  * Bump Standards-Version to 3.9.8 without changes needed
+
+ -- Didier Raboud <odyx@debian.org>  Wed, 01 Jun 2016 08:46:56 +0200
+
+lsb (9.20160110) unstable; urgency=medium
+
+  * Merge the last Ubuntu diff
+
+  [ Stéphane Graber & Dimitri John Ledkov ]
+  * Add 01-upstart-lsb from the upstart package, and make executing rc.d
+    scripts no-op if there is an upstart job for that script
+
+ -- Didier Raboud <odyx@debian.org>  Sun, 10 Jan 2016 12:32:59 +0100
+
+lsb (9.20150917) unstable; urgency=medium
+
+  * Demote Build-Depends from python3-all-dev to python3-all (Closes: #799210)
+
+ -- Didier Raboud <odyx@debian.org>  Thu, 17 Sep 2015 10:10:29 +0200
+
+lsb (9.20150826) unstable; urgency=low
+
+  * Drop all the LSB compatibility packages besides lsb-release and lsb-base
+    - Drop packages-availability checking in lsb-release
+    - Truncate README.Debian to a minimum
+    - Document this in lsb-base.NEWS.Debian
+  * Change the versioning number to avoid any ambiguity; use joeyh's
+    version.date, with version being Debian next stable's
+
+ -- Didier Raboud <odyx@debian.org>  Wed, 26 Aug 2015 12:00:00 +0200
+
+lsb (4.1+Debian14) unstable; urgency=low
+
+  [ Alexandre Detiste ]
+  * Convert packaging to Debhelper 9
+  * Port to python3, keep compatibility symlink for lsb_release.py
+    (Closes: #719063)
+
+  [ Mert Dirik ]
+  * Add Turkish translation of lsb debconf messages (Closes: #757509)
+
+  [ Didier Raboud ]
+  * Add gbp.conf
+  * Rework the releases codename handling:
+    - Depend and Build-Depend on distro-info-data, and populate the
+      RELEASES_CODENAME_LOOKUP from that reference
+    - Drop meaningless tests trying to compare random release names
+  * Make sure '-proposed-updates' don't sort before unstable
+  * Actuall ignore suites when guessing the release from apt
+  * Fix comparison of testing codename (Closes: #691744)
+  * Bump Standards-Version to 3.9.6 without changes needed
+
+ -- Didier Raboud <odyx@debian.org>  Wed, 12 Aug 2015 17:09:55 +0200
+
+lsb (4.1+Debian13+nmu1) unstable; urgency=medium
+
+  [ Ondřej Surý]
+  * Non-maintainer upload with maintainer agreement
+  * Change libjpeg62 dependency to libjpeg62-turbo (Closes: #766023)
+
+ -- Ondřej Surý <ondrej@debian.org>  Mon, 20 Oct 2014 11:37:56 +0200
+
+lsb (4.1+Debian13) unstable; urgency=medium
+
+  [ Steve Langasek ]
+  * test/test_lsb_release.py: also, make lsb_release ignore dpkg origins for
+    the test, otherwise the test fails on derivatives.
+
+  [ Colin Watson ]
+  * Use open() rather than file() in initdutils.py, for Python 3 compatibility
+    (see LP #1035136)
+  * Test fileob and strob against None in RFC822Parser.__init__ rather than
+    testing their truth value, to avoid a misleading error in the case of a
+    file with no LSB headers
+
+  [ Adam Conrad ]
+  * Allow lsb-printing to depend on cups-filters | ghostscript-cups
+
+  [ Didier Raboud ]
+  * Revert "Fix the remaining problems of initdutils.py python3 compatibility"
+    (Closes: #743903)
+  * Allow multiarch alternatives of libc6-i386 and lib32z1.
+    Thanks to Michael Biebl (Closes: #748426)
+
+  [ Marcel Partap ]
+  * In lsb_release, don't forget CODENAME when it's testing; therefore stop
+  * calling apt-cache policy again (Closes: #747413)
+
+ -- Didier Raboud <odyx@debian.org>  Mon, 09 Jun 2014 08:07:23 +0200
+
+lsb (4.1+Debian12) unstable; urgency=low
+
+  [ Colin Watson ]
+  * Depend directly on libnss3 and libnspr4 rather than via the
+    transitional packages libnss3-1d and libnspr4-0d.
+
+  [ Didier Raboud ]
+  * Drop one more unnecessary use of /bin/echo -n.
+  * Fix lsb_release to correctly work with stable release updates
+    incrementing the second digit from Wheezy on. (Closes: #711174)
+
+ -- Didier Raboud <odyx@debian.org>  Wed, 05 Jun 2013 12:30:53 +0200
+
+lsb (4.1+Debian11) unstable; urgency=low
+
+  [ Steve Langasek ]
+  * add -Es to the lsb_release python shebang, as discussed in
+    <https://lists.debian.org/debian-python/2012/10/msg00021.html>.
+  * Fix debian/copyright to list the correct Canonical copyright for the
+    Ubuntu logging functions.
+  * Correct duplicate reference to log_action_end_msg_post in
+    debian/lsb-base.README.Debian.
+  * debian/rules: fix the build on Ubuntu derivatives when building only the
+    arch-dependent packages.
+
+  [ Didier Raboud ]
+  * Add jessie to the release codenames lookup table
+  * Get Distributor ID from /etc/dpkg/origins/default if existant
+    (Closes: #703677)
+  * Bump Standards-Version to 3.9.4 without changes needed
+  * Correct lsb-desktop.NEWS syntax errors
+
+ -- Didier Raboud <odyx@debian.org>  Wed, 15 May 2013 22:15:05 +0200
+
+lsb (4.1+Debian10) unstable; urgency=low
+
+  [ Steve Langasek ]
+  * Fix the remaining problems of initdutils.py python3 compatibility
+    (Closes: #673586)
+  * Revert unnecessary use of /bin/echo -n (Closes: #708337)
+
+  [ Didier Raboud ]
+  * Compress source with xz
+
+ -- Didier Raboud <odyx@debian.org>  Wed, 15 May 2013 11:06:44 +0200
+
+lsb (4.1+Debian9) unstable; urgency=low
+
+  [ Jeff Licquia ]
+  * Sanity-check pidofproc parameters. (Closes: #691422)
+
+ -- Didier Raboud <odyx@debian.org>  Mon, 12 Nov 2012 08:58:04 +0100
+
+lsb (4.1+Debian8) unstable; urgency=low
+
+  * Fix libqt3-mt missing epoch.
+  * Hide the stderr output of $(initctl version) in init_is_upstart.
+    (Closes: #682032)
+
+ -- Didier Raboud <odyx@debian.org>  Mon, 05 Nov 2012 12:03:33 +0100
+
+lsb (4.1+Debian7) unstable; urgency=low
+
+  * lsb-desktop: Demote Qt3 dependency to a Recommends. Closes: #604360
+    - Add a README.Debian to lsb-desktop to document the possibility to
+      install Qt3 from snapshot.debian.org;
+    - Add a NEWS.Debian to lsb-desktop to document the derogation to the
+      LSB 4.1 specification.
+
+  * Accept utf-8 in `apt-cache policy` and `dpkg-query` outputs; add
+    test-case. (Closes: #675618)
+
+ -- Didier Raboud <odyx@debian.org>  Sun, 10 Jun 2012 23:18:07 +0200
+
+lsb (4.1+Debian6) unstable; urgency=low
+
+  * Revert "Allow FANCYTTY to be sourced from /etc/default/rcS." This
+    avoids one ugly `set +u` in the $() subshell and avoids the hijack
+    of /etc/default/rcS. (Reopens: #673207, Closes: #675162, #675197)
+
+ -- Didier Raboud <odyx@debian.org>  Wed, 30 May 2012 19:27:22 +0200
+
+lsb (4.1+Debian5) unstable; urgency=low
+
+  * lsb-base; init-functions:
+    - Correct comment about hooks.
+    - Enhance doc about files sourced from init-functions
+    - Allow FANCYTTY to be sourced from /etc/default/rcS. (Closes: #673207)
+    - Safe-guard calls to echo with `|| true`; this helps towards making
+      sure init.d scripts called with `set -e` continue to work, see
+      #661002.
+
+  * lsb-release; python code:
+    - In guess_debian_release(), avoid calling guess_release_from_apt()
+      and hence the slow `apt-cache policy` if a codename is already
+      provided. Patch by Francois Gouget. (Closes: #674143)
+    - Add unittests for all lsb_release.py functions.
+    - Upgrade to python3-compatible syntax.
+    - Deprecate the lsb_release.compare_releases() function.
+
+  * lsb-invalid-mta;
+    -  Add the /usr/lib/sendmail symlink to /usr/sbin/sendmail.
+       (LP: #580914)
+
+ -- Didier Raboud <odyx@debian.org>  Tue, 29 May 2012 09:33:04 +0200
+
+lsb (4.1+Debian4) unstable; urgency=low
+
+  * In init-functions, include hooks from /lib/lsb/init-functions.d
+    - Source any file in there.
+    - Document that in lsb-base.README.
+    - Put the Ubuntu logging functions in there; remove the now-obsolete
+      configuration file with dpkg-maintscript-helper.
+    - Move the "Fancy output left info blocks" in there.
+
+  * Python code: Add an initial (but incomplete) unittest framework for python
+    2.7 and 3.2.
+
+  * Properly document the first version with init_is_upstart.
+  * Avoid writing the now useless lsb-qt4.substvars file.
+
+ -- Didier Raboud <odyx@debian.org>  Fri, 18 May 2012 22:06:07 +0200
+
+lsb (4.1+Debian3) unstable; urgency=low
+
+  [ Didier Raboud ]
+  * Compress the orig source tarball with bzip2.
+  * Update LSB and packages versions in README.Debian.
+  * Fix typo in lsb-invalid-mta's Description.
+  * Drop empty directory in lsb-base.
+    Instead of moving lsb-base-logging.sh to /etc/lsb/, drop the empty /etc/lsb.
+    (Closes: #671730)
+
+  [ Steve Langasek ]
+  * Add a new helper function: init_is_upstart().
+    init_is_upstart() is to be used by init scripts of upstart-aware packages to
+    render the init script inert when upstart is present.
+    Signed-off-by: Didier Raboud <odyx@debian.org> (Closes: #661109)
+
+ -- Didier Raboud <odyx@debian.org>  Mon, 07 May 2012 19:21:36 +0200
+
+lsb (4.1+Debian2) unstable; urgency=low
+
+  * Fancy output:
+    - Avoid two superfluous calls to /bin/echo.
+    - Make the cursor invisible when printing the status block.
+  * Make sure OPTIND is marked local for each use. (Closes: #669909)
+
+ -- Didier Raboud <odyx@debian.org>  Tue, 24 Apr 2012 21:33:39 +0200
+
+lsb (4.1+Debian1) unstable; urgency=low
+
+  * lsb-base: Upload the new "Fancy output" to unstable:
+    - Move information from NEWS.Debian to README.Debian, enhance it.
+
+  * pidofproc(): Make sure to try /bin/pidof when no pidfile is
+    specified. (Closes: #668958)
+  * In killproc(), make sure to exit 0 when the program is not running
+    and when no signal was specified. (Closes: #668416)
+
+ -- Didier Raboud <odyx@debian.org>  Thu, 19 Apr 2012 11:25:01 +0200
+
+lsb (4.1+Debian0+fancy1) experimental; urgency=low
+
+  * Fancy output: prepend [info] blocks to log_action_msg calls.
+
+ -- Didier Raboud <odyx@debian.org>  Thu, 12 Apr 2012 21:20:09 +0200
+
+lsb (4.1+Debian0+fancy0) experimental; urgency=low
+
+  * Make the init.d scripts messages fancier by prepending them a [....]
+    block that becomes [ ok ], [warn] or [FAIL] depending on the daemons
+    exit statuses (Closes: #416485).
+    - Update lsb-base' README.Debian and NEWS.
+
+ -- Didier Raboud <odyx@debian.org>  Sat, 31 Mar 2012 18:49:23 +0200
+
+lsb (4.1+Debian0) unstable; urgency=low
+
+  * Upload LSB 4.1 support to unstable.
+  * Add lsb-languages to lsb Depends.
+  * Drop lsb suggests, obsoleted by dependencies changes.
+  * Make init-functions' status_of_proc return the LSB-documented 3 on
+    inexistant pidfiles. (Closes: #664621)
+
+ -- Didier Raboud <odyx@debian.org>  Mon, 26 Mar 2012 22:54:40 +0200
+
+lsb (4.1+Debian0~exp2) experimental; urgency=low
+
+   * lsb-base.README.Debian: Document status_of_proc. (Closes: #565631)
+   * Tighten more dependencies between lsb packages.
+   * Update package relationships to match LSB 4.1:
+     - Add lsb-security to lsb-core Depends.
+     - Add lsb-multimedia to lsb-desktop Depends.
+     - Add libpod-plainer-perl to lsb-languages depends.
+   * Rewrite debian/copyright using the copyright-format 1.0.
+   * Bump Standards-Version to 3.9.3 without changes needed.
+
+ -- Didier Raboud <odyx@debian.org>  Thu, 15 Mar 2012 11:02:19 +0100
+
+lsb (4.1+Debian0~exp1) experimental; urgency=low
+
+  * Merge the lsb 3.2+Debian31 Debian release.
+  * Tighten dependencies between lsb-* packages.
+  * In killproc(), re-add a '--retry 5' to s-s-d when no signal is
+    specified. (Closes: #650584)
+
+ -- Didier Raboud <odyx@debian.org>  Sun, 11 Mar 2012 17:34:53 +0100
+
+lsb (4.1+Debian0~exp0) experimental; urgency=low
+
+  [ Till Kamppeter ]
+  * Add the "lsb-invalid-mta" package, with a fake sendmail. This allows
+    the installation of LSB packages to not pull in an MTA any more,
+    which once adds awkward configuration questions to the installation
+    process and second adds an often unnneeded daemon to the system.
+    (LP: #141641)
+
+  [ Didier Raboud ]
+  * Upgrade to support LSB 4.1. (Closes: #586191, LP: #385606, #386128)
+    LSB changes:
+     - Bump Depends:
+       - on libglib2.0-0  to >= 2.12.13;
+       - on fontconfig    to >= 2.6.0;
+       - on libglib2.0-0  to >= 2.12.13;
+       - on libatk1.0-0   to >= 1.10.3;
+       - on libpango1.0-0 to >= 1.10.4;
+       - on libgtk2.0-0   to >= 2.10.14;
+     - Add Depends:
+       - on libglu1;
+       - on libcairo2     to >= 1.2.0;
+       - on libxtst6;
+       - on ghostscript-cups;
+     - In lsb, bump lsb-printing from Suggests to Depends.
+     - Add the lsb-security package.
+     - Drop the now-obsolete lsb-qt4 package.
+    Debian changes:
+     - libgl1-mesa-glx is the first alternative for libgl1;
+     - Make sure all packages have ${misc:Depends}.
+
+ -- Didier Raboud <odyx@debian.org>  Mon, 05 Mar 2012 22:42:21 +0100
+
+lsb (3.2+Debian31) unstable; urgency=low
+
+  [ Didier Raboud ]
+  * Correct a bug number in the 3.2+Debian30 upload.
+  * Promote lsb-release to Priority: optional.
+  * Fix both unused and undeclared local variables in pidofproc.
+    (Closes: #663351)
+
+  [ Peter Eisentraut ]
+  * Handle non-world-readable pid files. (Closes: #653598)
+
+ -- Didier Raboud <odyx@debian.org>  Sun, 11 Mar 2012 15:04:47 +0100
+
+lsb (3.2+Debian30) unstable; urgency=low
+
+  * Drop Depends on essentials sed & ncurses-bin. (Closes: #488237)
+  * Don't display Debian revision in lsb_release modules version output.
+  * Update Qt4 relationships to current packaging. (Closes: #661888)
+  * Remove /lib/ld-lsb-x86-64.so.* only on upgrade. (Closes: #642076)
+
+ -- Didier Raboud <odyx@debian.org>  Mon, 05 Mar 2012 20:15:43 +0100
+
+lsb (3.2+Debian29) unstable; urgency=low
+
+  [ Didier Raboud ]
+  * Wrap debian/control package relationship lines.
+  * Put under explicit debian-lsb@l.d.o team maintenance.
+    (Closes: #616131)
+  * Add myself as uploader.
+  * Drop Chris Lawrence from Uploaders with great thanks for his past
+    work. (Closes: #616131)
+  * Define source format as '3.0 (native)'.
+  * Reduce debian/rules using tiny dh7 style.
+  * Add initial lintian overrides files.
+  * Add explicit `set -e` to maintainer scripts.
+  * Drop Conflicts/Replaces for old package versions.
+  * Install lsb-base-logging.sh on Ubuntu.
+  * Update the Homepage field to point to the public URL.
+    (Closes: #653917)
+  * Depend on cron-daemon, with cron as first alternative.
+    (Closes: #638004)
+  * Add Vcs-* fields as this will now be maintained on collab-maint's
+    Git.
+  * Correct URLs to refspecs.{freestandards,linuxbase}.org.
+  * Recognise Debian Ports as `sid` too. (Closes: #624769)
+
+  [ Michael Vogt ]
+  * Switch from python-central to dh_python2. (Closes: #606354)
+
+  [ Colin Watson ]
+  * Ensure that files are closed promptly in lsb_release.py
+  * Mark lsb-base Multi-Arch: foreign. (LP: #904013)
+
+  [ Steve Langasek ]
+  * Don't run apt-cache if /etc/lsb-release exists.
+  * Mark lsb-release Multi-Arch: foreign.
+  * Use $DPKG_MAINTSCRIPT_ARCH in maintainer scripts
+
+  [ Simone Rossetto ]
+  * Fix for unsupported negative value in pin priorities.
+    (Closes: #540208)
+
+  [ Michał Kułach ]
+  * Add the Debconf Polish translation. (Closes: #661251)
+
+  [ Jeff Licquia ]
+  * Add me to Uploaders.
+
+ -- Didier Raboud <odyx@debian.org>  Thu, 01 Mar 2012 22:04:11 +0100
+
+lsb (3.2-28.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Fix pending l10n issues. Debconf translations:
+    - Korean (강민지).  Closes: #632010,#632018
+    - Catalan; (Innocent De Marchi).  Closes: #641828
+
+ -- Christian Perrier <bubulle@debian.org>  Mon, 16 Jan 2012 07:21:11 +0100
+
+lsb (3.2-28) unstable; urgency=low
+
+  * Fix symlinks for AMD64.  (Closes: #638450)
+  * Please note the RFA/ITA for this package (#616131).
+
+ -- Chris Lawrence <lawrencc@debian.org>  Fri, 26 Aug 2011 16:25:30 -0400
+
+lsb (3.2-27) unstable; urgency=low
+
+  * Track down another use of dpkg --print-installation-architecture.
+    (Closes: #610049)
+  * Various cleanups to init-functions, courtesy of Jari Aalto:
+    + Use /bin/echo when using options throughout.  (Closes: #602038)
+    + Use $() command substitution.  (Closes: #602035)
+    + Use && and || instead of -a and -o.  (Closes: #602037)
+    + Break long lines.  (Closes: #602039)
+    + Cleanup use of local.  (Closes: #602042)
+    + Use single-line statements.  (Closes: #602044)
+    + Use self-documenting values of variables.  (Closes: #602048)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Mon, 17 Jan 2011 14:24:35 -0600
+
+lsb (3.2-26) unstable; urgency=low
+
+  * Fix reversed assignment in compare_release.  (Closes: #540208)
+  * Move lsb(8) to lsb-core package.  (Closes: #589101)
+  * Update da translation of debconf templates; thanks to Joe Dalton.
+    (Closes: #599461)
+  
+ -- Chris Lawrence <lawrencc@debian.org>  Wed, 06 Oct 2010 20:35:30 -0500
+
+lsb (3.2-25) unstable; urgency=low
+
+  * Improve release comparison function when 'suite' is missing from
+    sources.list.  (Closes: #597667)
+  * return 3 in pidofproc() if we can't track down a running copy of
+    the process and the pidfile is missing.  (Closes: #597628)
+  * Correct location of README.Debian.gz in lsb(8).  (Closes: #589100)
+  * Add link to LSB specification in lsb(8).  (Closes: #589102)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Mon, 27 Sep 2010 01:15:49 -0500
+
+lsb (3.2-24) unstable; urgency=low
+
+  * Improve detection of Debian version when there is a "tie" in
+    APT's sources.list.  Patch by Giovanni Mascellani.  (Closes: #540208)
+  * Fix test for PID file in init-functions.  Patch by Keith O'Brien.
+    (Closes: #545896)
+  * Fix reporting for more recent versions of Debian GNU/kFreeBSD.  Patch
+    by Gonéri Le Bouder.  (Closes: #595159)
+  * Use --print-architecture instead of --print-installation-architecture
+    in lsb-core postinst.  (Closes: #542610)
+  * Fix formatting error in lsb_release(1).  Patch by Adam Guthrie.
+    (Closes: #586575)
+  * Update pt_BR translation for debconf messages, thanks to Flamarion Jorge.
+    (Closes: #596438)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Sat, 18 Sep 2010 17:08:17 -0500
+
+lsb (3.2-23.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Fix dependencies of lsb-core on kfreebsd-* and hurd-* to make the
+    package installable. Thanks to Aurelien Jarno for the patch and the
+    bugreport.  (Closes: #539284)
+  * Set XS-Python-Version to all to make lsb-release available for all
+    supported Python versions. Thanks to Sandro Tosi for the bug report.
+    (Closes: #570586)
+  * Don't make lsb-core conflict with python (>= 2.6).
+
+ -- Jakub Wilk <jwilk@debian.org>  Sun, 21 Mar 2010 15:39:47 +0100
+
+lsb (3.2-23) unstable; urgency=low
+
+  * Fix tests for $TERM in log_use_fancy_output().  (Closes: #537112, #536190)
+  * Add libnss3-1d and libqt4-sql-sqlite to lsb-desktop dependencies.
+    (Closes: #534277, #534452)
+  * Properly trap open() failures in lsb_release.  (Closes: #521462)
+  * Ignore empty arguments in /etc/lsb-release.  (Closes: #485565)
+    May also fix #514041.
+  * Better test for existant but unreadable PID file.  (Closes: #527890)
+  * Add some punctuation to log_{warning,failure}_msg.  (Closes: #525684)
+  * lsb-core depends on cups-bsd | lpr, since it is more likely that
+    someone in 2009 will have CUPS installed already than want to use lpr
+    instead.  (Closes: #512098)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Tue, 21 Jul 2009 04:03:41 -0500
+
+lsb (3.2-22) unstable; urgency=low
+
+  * Fix quoting of $PWD in start-stop-daemon call.  (Closes: #520499)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Fri, 20 Mar 2009 11:40:50 -0500
+
+lsb (3.2-21) unstable; urgency=low
+
+  * Provide lsb_release module for Python applications.  (Closes: #486262)
+  * Change working directory to $PWD in start-stop-daemon, for better
+    compatibility with LSB applications.  (Closes: #519817)
+  * return 3 rather than 4 in pidofproc if a PID file is specified and
+    the daemon is not found.  (Closes: #494623)
+  * Improve handling of future testing versions unknown to lsb-release.
+    Patch by Jan Muszynski (Closes: #517594).
+  * Fix DeprecationWarning with Python 2.6; patch from Colin Watson and
+    Anders Kaseorg.  (Closes: #517819)
+  * Bypass guess_debian_release() if /etc/lsb-release is complete.
+    Patch from Scott James Remnant.  (Closes: #511952)
+  * 'time' was missing from lsb-core dependencies.  (Closes: #510488)
+  * Demote lsb to a suggestion by lsb-release.  (Closes: #509611)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Thu, 19 Mar 2009 16:29:25 -0500
+
+lsb (3.2-20) unstable; urgency=low
+
+  * Revert change in 3.2-16 that broke killproc due to my misunderstanding
+    of the spec.  (Closes: #495587)
+  * pidofproc now also checks for /var/run/$base.pid if -p is not specified,
+    fixing conformance with the spec.
+
+ -- Chris Lawrence <lawrencc@debian.org>  Mon, 18 Aug 2008 16:34:24 -0500
+
+lsb (3.2-19) unstable; urgency=low
+
+  * Return 0 in log_failure_msg too.
+  
+ -- Chris Lawrence <lawrencc@debian.org>  Mon, 04 Aug 2008 20:29:54 -0500
+
+lsb (3.2-18) unstable; urgency=low
+
+  * Also fix case where stdout isn't color-capable.  (Closes: #493505, again)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Mon, 04 Aug 2008 02:31:03 -0500
+
+lsb (3.2-17) unstable; urgency=low
+
+  * log_{success,failure,warning}_msg suck, please don't use them for
+    Debian scripts.  Nonetheless, breakage fixed.  (Closes: #493505)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Sun, 03 Aug 2008 10:15:45 -0500
+
+lsb (3.2-16) unstable; urgency=low
+
+  * Add a bugscript to lsb-release to help figure out why people keep
+    getting very strange results.
+  * Lenny will be Debian 5.0, not Debian 4.1; fix accordingly.
+  * Improve output of lsb-specified logging functions; deal with
+    in-the-wild variations that omit messages.
+  * No longer use --retry in start-stop-daemon calls.  (Closes: #451529)
+  * Fix behavior of killproc and pidofproc when no pidfile is passed in.
+  * Call pidof with -x to include scripts that may be daemonized.
+  * Change dependencies *cupsys* -> *cups*.  (Closes: #490381)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Fri, 01 Aug 2008 16:39:43 -0500
+
+lsb (3.2-15) unstable; urgency=low
+
+  * Add Basque [eu] translation.  (Closes: #491005)
+  * Fix log_action_end_msg_pre function definition (_post was defined twice).
+    (Closes: #491087)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Wed, 16 Jul 2008 14:24:44 -0500
+
+lsb (3.2-14) unstable; urgency=low
+
+  * Update pidofproc(), status_of_proc() to sync with Ubuntu.
+    Thanks to Dustin Kirkland.  (Closes: #490095)
+  * Add hooks to init-functions, thanks to Miroslav Jezbera.
+    These are documented in README.Debian in lsb-base.
+    (Closes: #490408)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Mon, 14 Jul 2008 11:30:52 -0500
+
+lsb (3.2-13) unstable; urgency=low
+
+  * Include status_of_proc() function from Ubuntu's lsb-base.
+    Thanks to Dustin Kirkland.  (Closes: #483285)
+  * This patch also allows pidofproc to work on other users' processes.
+    (Closes: #452992)
+  * Fix output of lsb_release -h to properly describe what -s does.
+    (Closes: #479542)
+  * Add Slovak translation.  (Closes: #489265)
+  * Fix dependencies to not use >>.  (Closes: #461340)
+  * Document init-functions license in debian/copyright.
+    (Closes: #481281)
+  * Also fix text of init-functions license to remove the reference to
+    "the Regents," who didn't author any of init-functions.
+
+ -- Chris Lawrence <lawrencc@debian.org>  Tue, 08 Jul 2008 22:03:10 -0500
+
+lsb (3.2-12) unstable; urgency=medium
+
+  * Fix reversed test in killproc().  (Closes: #478871)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Thu, 01 May 2008 10:08:49 -0500
+
+lsb (3.2-11) unstable; urgency=low
+
+  * Depend on gs | ghostscript to help with Python transition.
+
+ -- Chris Lawrence <lawrencc@debian.org>  Sat, 26 Apr 2008 15:47:00 -0500
+
+lsb (3.2-10) unstable; urgency=low
+
+  * Fix typo in lsb_release.  (Closes: #476969)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Sun, 20 Apr 2008 09:28:20 -0500
+
+lsb (3.2-9) unstable; urgency=low
+
+  * Fix lsb_release detection when apt-cache policy identifies no Debian
+    sources.  (Closes: #476288)
+  * Only use fancy TTY output if TERM is set and FD 1 is a terminal.
+    (Closes: #470993)
+  * Do not use eval in start_daemon().  (Closes: #406059)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Thu, 17 Apr 2008 20:38:23 -0500
+
+lsb (3.2-8) unstable; urgency=medium
+
+  * Bump conflicts to python < 2.6.  (Closes: #475953)
+  * init-functions: In killproc(), return 0 if program is not running
+    (instead of 3).  (Closes: #475258)
+  * lsb_release: Due to popular demand, report pinned release rather than
+    "unstable" on systems with multiple releases in sources.list.
+    (Closes: #459257)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Mon, 14 Apr 2008 01:00:50 -0500
+
+lsb (3.2-7) unstable; urgency=low
+
+  * Remove libstdc++5 dependency on all architectures, since it's only
+    needed before LSB 3.0.
+  * Revoke provision of lsb-cxx < 3.0 according to lsb_release.
+
+ -- Chris Lawrence <lawrencc@debian.org>  Sat, 05 Apr 2008 16:32:13 -0500
+
+lsb (3.2-6) unstable; urgency=low
+
+  * Kill old versions of /etc/lsb-release deader.  (Closes: #467219)
+  * Fix debian/rules:
+    + Change DEB_BUILD_ARCH_CPU -> DEB_HOST_ARCH_CPU
+      ("host" is what we're building for)
+    + Detect armel using DEB_HOST_GNU_CPU_TYPE=arm-linux-gnueabi
+  * Remove duplicate LSB modules from lsb_release -v output.
+
+ -- Chris Lawrence <lawrencc@debian.org>  Sun, 30 Mar 2008 17:36:18 -0500
+
+lsb (3.2-5) unstable; urgency=low
+
+  * Fix init-functions with set -e.  (Closes: #472794)
+    Patch from Matthias Klose.
+  * Downgrade optional LSB modules to suggestions from main "lsb" package
+    (core LSB dependency for LSB 1.x); remove obsolete lsb-qt4 from its
+    dependencies.
+  * lsb-desktop now provides lsb-qt4*, essentially making lsb-qt4 a dummy
+    package.
+  * lsb-cxx: Don't depend on libstdc++5 on armel.
+
+ -- Chris Lawrence <lawrencc@debian.org>  Wed, 26 Mar 2008 10:26:53 -0500
+
+lsb (3.2-4) unstable; urgency=high
+
+  * Reverse test in killproc().  (Closes: #469404)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Wed, 05 Mar 2008 13:01:08 -0600
+
+lsb (3.2-3) unstable; urgency=medium
+
+  * Handle missing $sig in killproc() properly.  (Closes: #469167)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Mon, 03 Mar 2008 09:01:07 -0600
+
+lsb (3.2-2) unstable; urgency=low
+
+  * lsb_release -v now detects the lsb-qt4 version(s) installed correctly.
+
+ -- Chris Lawrence <lawrencc@debian.org>  Sun, 02 Mar 2008 18:22:22 -0600
+
+lsb (3.2-1) unstable; urgency=low
+
+  * New LSB version.
+    + Add libpam0g, libncurses5 to lsb-base.
+    + Add libqt4-gui, libfreetype6, libxrender1, libxft2 to lsb-desktop.
+    + lsb-qt4 appears to be deprecated by the new lsb-desktop requirements.
+    + Add new printing, multimedia, and languages modules.
+  * More killproc() fixes.  (Closes: #453636)
+  * Use /etc/debian_version in preference to apt autodetection.
+    (Closes: #427221)
+  * Handle non-zero status from start-stop-daemon better.  (Closes: #451532)
+  * All fancy output uses /bin/echo -e now.  (Closes: #463082)
+  * Add/update translations:
+      fi (Closes: #447184)
+      ro (Closes: #468670)
+      ja (Closes: #462757)
+      pt (Closes: #439402)
+  * Ignore invalid lines in /etc/lsb-release.  (Closes: #454352)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Sun, 02 Mar 2008 02:13:58 -0600
+
+lsb (3.1-24) unstable; urgency=low
+
+  * Acknowledge NMU by Christian Perrier.
+  * Apply patch from Javier Fernández-Sanguino Peña to improve release
+    detection.  (Closes: #425627, #405993)
+  * lsb-release no longer recommends lsb.  (Closes: #426807)
+  * Update debconf templates per Smith project.  (Closes: #422973)
+  * Add/update translations:
+    Vietnamese (Closes: #426834)
+    Galician (Closes: #423685)
+    Swedish (Closes: #423904)
+    Czech (Closes: #425154)
+    Italian (Closes: #425258)
+    Dutch (Closes: #425710)
+    French (Closes: #426105)
+    Malay (Closes: #426237)
+    German (Closes: #426599)
+    Russian (Closes: #426741)
+    Arabic (Closes: #423616)
+    Spanish (Closes: #423815)
+  * Don't remove the pidfile in killproc if a signal is specified; the
+    specification does not specify this behavior, and it can cause
+    problems with signals like HUP.  (Closes: #416559)
+  * And then, only remove the pidfile if the process is actually dead.
+    (Closes: #410622)
+  * Update codename for testing.  (Closes: #425646)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Wed, 25 Jul 2007 08:56:44 -0500
+
+lsb (3.1-23.1) unstable; urgency=low
+
+  * Non-maintainer upload to fix pending l10n issues.
+  * Debconf translations:
+    - Portuguese. Closes: #408177
+    - Convert PO files to UTF-8, except Japanese
+
+ -- Christian Perrier <bubulle@debian.org>  Sat,  3 Mar 2007 13:12:58 +0100
+
+lsb (3.1-23) unstable; urgency=low
+
+  * Remove the pidfile in killproc() if successful.  (Closes: #400261)
+  * Recommend apt in lsb-release; lsb-release can work without it, so
+    no need to make it a hard dependency.  (Closes: #399991)
+  * Fix missing paragraph break in lsb_release(1).  (Closes: #399989)
+    Above two fixes courtesy of Julian Gibney.
+  * Add Romanian and Spanish translations of debconf templates.
+    (Closes: #403421, #403527)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Sat, 20 Jan 2007 21:58:36 -0600
+
+lsb (3.1-22) unstable; urgency=low
+
+  * Fix crash when the Debian release is identified from
+    /etc/debian_version and there is no corresponding codename (reported
+    by Riku Voipio as a result of buildd failures).
+  * log_use_fancy_output() had unintended behavior under set -e.
+    (Thanks to Steve Langesek for the heads-up.)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Sun, 19 Nov 2006 20:27:59 -0600
+
+lsb (3.1-21) unstable; urgency=low
+
+  * lsb_release changes: Improve parsing of apt-cache policy output to be
+    more flexible; deal with stable revisions in the codename lookup.
+
+ -- Chris Lawrence <lawrencc@debian.org>  Sun, 19 Nov 2006 02:12:34 -0600
+
+lsb (3.1-20) unstable; urgency=low
+
+  * The "hopefully we can push this into testing now that the bugs are all
+    shaken out, maybe" release.
+  * Don't use --name in killproc() when a pidfile is provided; thanks to
+    Timo Reimann for the patch.  (Closes: #397977)
+  * Give lsb_release's heuristics priority over whatever is in
+    /etc/debian_version; note that /etc/lsb-release will override both and
+    should be supplied by derived distributions.  (Closes: #396853)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Wed, 15 Nov 2006 18:09:02 -0600
+
+lsb (3.1-19) unstable; urgency=low
+
+  * Now try the eval hack in start-stop-daemon, since nothing else seems
+    to work.  (Closes: #388836)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Mon, 30 Oct 2006 19:08:26 -0600
+
+lsb (3.1-18) unstable; urgency=low
+
+  * etch will be Debian 4.0, not Debian 3.2.  (Closes: #395004)
+  * Don't quote $@ in start-stop-daemon calls, which should resolve issues
+    with multiple/quoted arguments to the daemon in start_daemon().
+    (Closes: #388836)
+  * Revert to testing for a fancy TTY before trying to call tput and friends,
+    to avoid crap spewage on shutdown.  (Closes: #390363, #391981)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Fri, 27 Oct 2006 01:18:56 -0500
+
+lsb (3.1-17) unstable; urgency=low
+
+  * Set FANCYTTY to a null string to cope with init scripts that for some
+    reason seem to use set -u.  (Closes: #390085)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Fri, 29 Sep 2006 01:50:51 -0500
+
+lsb (3.1-16) unstable; urgency=low
+
+  * Improve documentation of killproc().  (Closes: #384814)
+  * Also improve documentation of pidofproc() in the same vein.
+  * Move lsb_release to /usr.  (Closes: #389380)
+  * Modify log_use_fancy_output() to only test once for a fancy TTY; patch
+    by Brendan O'Dea.  (Closes: #389497)
+  * Fix semantics of killproc() to behave properly when $sig is specified.
+    (Closes: #389403)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Wed, 27 Sep 2006 18:10:12 -0500
+
+lsb (3.1-15) unstable; urgency=low
+
+  * Fix assignment to $opt in pidofproc().  (Closes: #384540)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Thu, 24 Aug 2006 19:08:02 -0500
+
+lsb (3.1-14) unstable; urgency=low
+
+  * Document LSB init functions more thoroughly in lsb-base's README.Debian.
+    (Closes: #382597)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Fri, 11 Aug 2006 23:41:53 -0500
+
+lsb (3.1-13) unstable; urgency=low
+
+  * More tweaks to the getopts calls, to ensure that OPTIND is reset on
+    each call.  (See #381822)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Wed,  9 Aug 2006 22:09:42 -0500
+
+lsb (3.1-12) unstable; urgency=low
+
+  * Revert log_end_msg() change.  (Closes: #381814)
+  * killproc() returns 0 if a signal is not specified and the program
+    is not running.  (Closes: #379387)
+  * Divert output in pidofproc test to /dev/null.  (Closes: #381821)
+  * Test tput setaf 1 in log_use_fancy_output().  (Closes: #375644)
+  * Fix call to getopts in start_daemon to properly work with command
+    options.  (Closes: #381822)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Mon,  7 Aug 2006 13:17:40 -0500
+
+lsb (3.1-11) unstable; urgency=low
+
+  * Patch for other architectures from Martin Habets
+    <mhabets@mph.eclipse.co.uk> (closes: #375457)
+  * Stop using basename: patch from Tore Anderson <tore@debian.org>
+    (closes: #354028)
+  * Move return code evaluation out of if $specified block in killproc, so
+    that evaluation is dependant on whether or not process is running, not on
+    whether a pidfile was specified (closes: #379387)
+  * log_end_msg no longer returns non-zero.  It's a log function, after all
+    (closes: #381687)
+  * log_use_fancy_output is now overridable by admin (closes: #374780)
+  * pidofproc actually checks if process is running (closes: #381684)
+    (probably closes: #167757)
+  * Use shell built-in getopts instead of /usr/bin/getopt (closes: #335216)
+  * Remove reference to /usr/share/doc/lsb-core/html/ (closes: #380045)
+  * Ru translation (thanks: Yuri Kozlov <kozlov.y@gmail.com>)
+    (closes: #380430)
+  * Above changes prepared by Stephen Gran <sgran@debian.org>.
+  * Update debian/TODO, which was a wee bit out of date.
+  * Accomplish Python policy transition. (Closes: #380858)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Sun,  6 Aug 2006 18:18:08 -0500
+
+lsb (3.1-10) unstable; urgency=low
+
+  * Quote tests of $specified.  (Closes: #370256)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Mon,  5 Jun 2006 16:00:17 -0400
+
+lsb (3.1-9) unstable; urgency=high
+
+  * Add missing < "$pidfile" to read in pidofproc().  (Closes: #370155)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Sun,  4 Jun 2006 04:08:31 -0400
+
+lsb (3.1-8) unstable; urgency=low
+
+  * Fix killproc() to work if signal isn't specified; also fix the
+    pidfile check in both killproc() and pidofproc().  (Closes: #370075)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Sat,  3 Jun 2006 02:45:55 -0400
+
+lsb (3.1-7) unstable; urgency=low
+
+  * lsb-graphics: Depend on libx11-6 | xlibs.  (Closes: #369955)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Fri,  2 Jun 2006 15:47:52 -0400
+
+lsb (3.1-6) unstable; urgency=low
+
+  * Replace uses of $n with ${n:-} where $n could be unbound.
+    (Closes: #369193)
+  * Use pidof only if pid file is not specified.  (Closes: #365736)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Thu,  1 Jun 2006 14:20:24 -0400
+
+lsb (3.1-5) unstable; urgency=high
+
+  * Remove /usr/X11R6/bin from lsb-core, since I'm pretty sure it's not
+    strictly necessary for LSB compliance and it breaks x.org 7.0.
+    (Closes: #365264)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Fri, 28 Apr 2006 17:33:15 -0400
+
+lsb (3.1-4) unstable; urgency=high
+
+  * Bump priority since (a) these changes are trivial and (b) 3.1-3 was
+    two days from testing.
+  * lsb-desktop: also depend on fontconfig (for fc-* binaries).
+  * Add Galician debconf translation.  (Closes: #361938)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Thu, 20 Apr 2006 02:17:12 -0400
+
+lsb (3.1-3) unstable; urgency=low
+
+  * Fix dependency on libgtk2.  (Closes: #361879)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Mon, 10 Apr 2006 22:27:46 -0400
+
+lsb (3.1-2) unstable; urgency=low
+
+  * Upload lsb 3.1 support for unstable.
+  * Really create ld-lsb-x86-64.so.3 symlink.  (Closes: #355959)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Mon, 10 Apr 2006 14:22:14 -0400
+
+lsb (3.1-1) experimental; urgency=low
+
+  * First crack at a package for LSB 3.1.
+  * Add -desktop and -qt4 metapackages.
+  * Update README.Debian and control file for 3.1.
+  * Update lsb_release to recognize lsb-desktop and lsb-qt4 modules.
+  * Update FSF address in debian/copyright.
+  * Fix debian/control to allow sarge build.
+
+ -- Chris Lawrence <lawrencc@debian.org>  Wed, 29 Mar 2006 16:11:45 -0500
+
+lsb (3.0-16) unstable; urgency=low
+
+  * Add ld-linux-x64-64.so.3 symlink on AMD64.  (Closes: #355959)
+  * Depends: ia32-libs -> libc6-i386, lib32z1 on AMD64.  (Closes: #355388)
+  * On purge or upgrade from < lsb-release 3.0-8, remove /etc/lsb-release
+    if its md5sum is the same as that shipped in sarge.  (Closes: #355377)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Thu,  9 Mar 2006 01:14:05 -0500
+
+lsb (3.0-15) unstable; urgency=low
+
+  * Test $TERM in log_use_fancy_output; if it is "dumb" we don't have a
+    fancy TTY.  (Closes: #350291)
+  * Better heuristics in lsb_release to guess whether we're running on
+    testing or unstable.  (Closes: #95824, #341231)
+    Note that /etc/lsb-release, if present, will override these results,
+    and /etc/debian_version has priority.
+  * Fix lsb_release to allow multiple fields to be displayed (i.e.
+    lsb_release --id --codename).
+
+ -- Chris Lawrence <lawrencc@debian.org>  Sat, 28 Jan 2006 18:24:49 -0500
+
+lsb (3.0-14) unstable; urgency=low
+
+  * Allow lsb-base to be built on sarge.  (Closes: #345984)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Sun,  8 Jan 2006 20:09:52 -0500
+
+lsb (3.0-13) unstable; urgency=medium
+
+  * The "answer all the questions in the changelog" release.
+  * Skip empty headers when parsing RFC822 headers for init scripts.
+    (Closes: #343310)
+  * The versioned dependency on dpkg-dev is due to the use of
+    DEB_*_ARCH_CPU in debian/rules, which only became available in dpkg
+    1.13.2.  Feel free to submit a patch to facilitate a sarge backport.
+    (Closes: #344392)
+  * Since the lsb family of packages track an upstream specification with
+    "non-native" version numbering, the use of a hyphenated version number
+    for these native packages is justified.  (Closes: #344384)
+    (Note that although it does violate policy for a non-native package to
+    lack a hyphen in its version number, the contrapositive case does not
+    violate policy.)
+  * Deal with missing /etc/debian_version.  (Closes: #341719)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Thu, 29 Dec 2005 03:50:44 -0500
+
+lsb (3.0-12) unstable; urgency=low
+
+  * Remove the pidfile in killproc().  (Closes: #321271)
+  * Declare $i local where it was previously omitted.  (Closes: #340667)
+  * Fix syntax errors in init-skeleton.  (Closes: #302009)
+  * Add sv.po.  (Closes: #333595)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Tue, 29 Nov 2005 23:01:38 -0500
+
+lsb (3.0-11) unstable; urgency=low
+
+  * Use the basename in killproc when calling start-stop-daemon.
+    (Closes: #332744)
+  * lsb-base conflicts/replaces lsb-core (<< 2.0-6).  (Closes: #335798)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Thu, 27 Oct 2005 05:29:07 -0400
+
+lsb (3.0-10) unstable; urgency=low
+
+  * Use --name instead of --exec in killproc().  (Closes: #332744)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Sun, 16 Oct 2005 15:35:38 -0400
+
+lsb (3.0-9) unstable; urgency=low
+
+  * Fix silly Pythonic else in init-functions.  (Closes: #329936)
+  * s/log_action_start_msg/log_action_begin_msg/ in README.Debian.
+    (Thanks to Marco d'Itri for pointing these two out.)
+  * If bits of /etc/lsb-release are missing (but not the whole file), use
+    detected information in its place.
+
+ -- Chris Lawrence <lawrencc@debian.org>  Sat, 24 Sep 2005 19:16:00 -0400
+
+lsb (3.0-8) unstable; urgency=low
+
+  * Bring in lsb-release (binary) package; rewritten to handle -v properly
+    for LSB 2.x and beyond.
+  * /etc/lsb-release is no longer provided by the lsb-release package;
+    it is probably best managed in base-files (which derived distros are
+    probably branding anyway).
+
+ -- Chris Lawrence <lawrencc@debian.org>  Wed, 21 Sep 2005 20:53:37 -0400
+
+lsb (3.0-7) unstable; urgency=low
+
+  * Update lsb-core dependencies to include:
+      ed (for /bin/ed)
+      bsdutils (for /usr/bin/logger)
+      cupsys-client | lprng (for /usr/bin/lp)
+      mailutils | mailx (for /usr/bin/mailx)
+    These are required in the final LSB 3.0 spec.
+
+ -- Chris Lawrence <lawrencc@debian.org>  Mon, 19 Sep 2005 18:08:33 -0400
+
+lsb (3.0-6) unstable; urgency=low
+
+  * Add ld-lsb.so.3 symlinks.  (Closes: #326609)
+  * Use cat $pidfile instead of read.  (Closes: #327405)
+    If someone knows why the convoluted read was used instead... let me know.
+  * Test for TPUT and friends as needed.  (Closes: #327388, #327825)
+  * Add log_action_*().  (Closes: #324983)
+  * Edit README.Debian; fork off a README.Debian for lsb-base.
+    (Closes: #327525)
+  * The log_* functions can be overridden in /etc/lsb-base-logging.sh.
+    (Closes: #321963)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Fri, 16 Sep 2005 19:32:29 -0400
+
+lsb (3.0-5) unstable; urgency=low
+
+  * Use --exec in calls to start-stop-daemon in killproc().  (Closes: #322770)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Fri, 12 Aug 2005 15:18:39 -0500
+
+lsb (3.0-4) unstable; urgency=medium
+
+  * Fix LIBC setting; add Alpha support.  (Closes: #322316)
+  * Add support for PPC64.  (Closes: #322293)
+  * Document usage of log_*_msg in README.Debian.
+
+ -- Chris Lawrence <lawrencc@debian.org>  Wed, 10 Aug 2005 12:00:57 -0500
+
+lsb (3.0-3) unstable; urgency=low
+
+  * Upload to unstable, since glibc 2.3.5 is now in.
+  * lsb-base is now Priority: important.
+  * Fix $FANCYTTY tests in a more POSIXly-correct way.  (Closes: #322022)
+  * Get rid of the html/* stuff and references to it in README.Debian.
+    (Closes: #321260)
+  * Maintainers who are using the lsb-base logging facilities should
+    *strongly* consider using log_daemon_msg() instead of log_start_msg();
+    the new log_daemon_msg() is designed to meet both Debian and Ubuntu
+    logging requirements.  Customization should come in a subsequent 3.0-x
+    release.
+
+ -- Chris Lawrence <lawrencc@debian.org>  Mon,  8 Aug 2005 15:58:45 -0500
+
+lsb (3.0-2) experimental; urgency=low
+
+  * Uploaded to experimental since glibc 2.3.5 is not in sid yet.
+  * Add /usr/lib/lsb/lsbinstall.
+    Note: the inetd stuff isn't implemented yet.
+  * Require glibc >> 2.3.5, since some interfaces in LSB 3.0 were
+    introduced by glibc 2.3.5.
+  * Require Python 2.3 or later, so we can use optparse.
+  * Fix test in pidofproc in /lib/lsb/init-functions.  (Closes: #315067)
+  * Document /etc/profile.d lossage in README.Debian.
+  * Remove stale link in README.Debian.  (Closes: #316064)
+  * Update German translation.  (Closes: #313979)
+  * Add Vietnamese translation.  (Closes: #312606)
+  * Updated description.  (Closes: #318224)
+  * Use DEB_BUILD_ARCH_CPU instead of DEB_BUILD_ARCH.
+  * Call /bin/echo when using -e.  (Closes: #320709)
+  * Kludge log_*_msg into being more policy-compliant and (in the case of
+    the LSB functions) more Debian-like.
+  * Add log_progress_msg.  See spiffy example adapted from the Policy
+    Manual in init-functions.  (Closes: #319739)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Mon,  1 Aug 2005 22:45:41 -0500
+
+lsb (3.0-1) unstable; urgency=low
+
+  * lsb-cxx now depends on libstdc++6 as well as libstdc++5, necessitated
+    by LSB 3.0.
+  * Don't create /lib64 on AMD64.  (Closes: #308220)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Sun,  8 May 2005 19:11:45 -0500
+
+lsb (2.0-7) unstable; urgency=high
+
+  * Fix Replaces line to use the correct version in lsb-base.
+    (Closes: #301694, RC; Closes: #301747)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Sun, 27 Mar 2005 21:42:24 -0600
+
+lsb (2.0-6) unstable; urgency=low
+
+  * Create lsb package in binary-indep step.  (Closes: #297788)
+  * Merge /lib/lsb/init-functions from Ubuntu.
+  * Split /lib/lsb/init-functions into arch-all lsb-base package; this
+    functionality is thus available for use by other, non-LSB packages.
+  * Update README.Debian.
+
+ -- Chris Lawrence <lawrencc@debian.org>  Fri,  4 Mar 2005 17:42:11 -0600
+
+lsb (2.0-5) unstable; urgency=low
+
+  * Upload to unstable.  (Closes: #278093)
+  * Ignore empty headers in init files.  (Closes: #292835)
+  * Add Czech translation of the debconf messages.  (Closes: #288015)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Sun, 30 Jan 2005 08:01:29 -0600
+
+lsb (2.0-4) experimental; urgency=low
+
+  * Fix path of HTML docs in debian/doc-base.lsb-core  (Closes: #278357)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Tue, 26 Oct 2004 09:16:46 -0500
+
+lsb (2.0-3) experimental; urgency=low
+
+  * Fix x86-64 ls-lsb symlink.  (Closes: #278093)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Sun, 24 Oct 2004 19:50:00 -0500
+
+lsb (2.0-2) experimental; urgency=low
+
+  * Upload to experimental so we don't break lsb 2.0-1 in unstable as it
+    tries to migrate to sarge.
+  * Split into lsb-core, lsb-graphics, and lsb-cxx packages, leaving lsb
+    as a metapackage (lsb-graphics and lsb-cxx are also metapackages).
+  * Include /lib64 in the AMD64 package rather than running mkdir in the
+    postinst.
+  * Revise README.Debian for LSB 2.0 and the package split; ensure LSB
+    package install instructions are in the first page of text.
+
+ -- Chris Lawrence <lawrencc@debian.org>  Mon, 20 Sep 2004 21:38:36 -0500
+
+lsb (2.0-1) unstable; urgency=high
+
+  * Add lsb-core-{noarch,[arch]} Provides.
+  * Symlink ld-lsb.so.2 to appropriate dynamic linker.
+  * Add Japanese translation of debconf template.  (Closes: #270926)
+  * Depend on ia32-libs on amd64.  (Closes: #259976)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Sun, 19 Sep 2004 18:01:07 -0500
+
+lsb (1.3-9) unstable; urgency=low
+
+  * Added Danish po file.  (Closes: #234406)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Mon, 23 Feb 2004 15:04:37 -0600
+
+lsb (1.3-8) unstable; urgency=low
+
+  * Added German po file.  (Closes: #223120)
+  * Depend on exim4 | m-t-a instead of exim | m-t-a.  (Closes: #228588)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Sat, 31 Jan 2004 20:49:47 -0600
+
+lsb (1.3-7) unstable; urgency=medium
+
+  * Conflict with libutahglx1 instead of depending on xlibmesa3-gl.
+    This will allow XFree86 4.3.0's libgl1 to be installed on the system.
+  * Move conflicts with Python to 2.5, since 2.4 is not expected to be
+    backwards incompatible with anything in the lsb package.
+
+ -- Chris Lawrence <lawrencc@debian.org>  Tue, 18 Nov 2003 12:02:01 -0600
+
+lsb (1.3-6) unstable; urgency=medium
+
+  * Depend on alien 8.36 or later.  (Closes: #220177)
+  * Depend on xlibmesa3-gl instead of libgl1.  (Closes: #220523)
+  * If the pathname supplied to install_initd or remove_initd exists
+    relative to the cwd, use it rather than prepending /etc/init.d.
+    (Closes: #207851)
+  * Added notes for backporting to woody to README.Debian.
+
+ -- Chris Lawrence <lawrencc@debian.org>  Mon, 17 Nov 2003 10:05:29 -0600
+
+lsb (1.3-5) unstable; urgency=low
+
+  * Note in README.Debian that the --lsbsysinit option in /etc/crontab is
+    required for strict LSB compliance.  (Closes: #214896)
+  * Re-enable $netdaemons facility in the "internal registry" again, as
+    gLSB 1.1 included it and some packages appear to still use it.
+    (Closes: #210578)
+  * Use ld.so.1 symlink instead of the glibc-version-dependent location
+    for s390.  (Closes: #216824)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Wed, 22 Oct 2003 13:17:25 -0500
+
+lsb (1.3-4) unstable; urgency=low
+
+  "cobaco":
+  * Add Dutch translation of debconf template.  (Closes: #204921)
+  Matt Taggart:
+  * Add ia64 to description.  (Closes: #207694)
+  Tobias Burnus:
+  * Provide a skeleton LSB init script.  (Closes: #207715)
+  * Numerous improvements to init-functions.  (Closes: #207639)
+  Me:
+  * Support broken uses of install_initd and remove_initd.
+    (See #207851; still pondering on start_daemon's behavior.)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Wed, 10 Sep 2003 17:40:24 -0500
+
+lsb (1.3-3) unstable; urgency=low
+
+  * Depend on pax.  (Closes: #203545)
+  * Add ld.so symlink for ia64.  (Closes: #203541)
+  * Improved French translation.  (Closes: #202692)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Fri,  8 Aug 2003 18:13:08 -0400
+
+lsb (1.3-2) unstable; urgency=low
+
+  * Use iteritems instead of the default iterator when saving the
+    init script dependency dictionary.  (Closes: #202012)
+  * Add a link to Matt Taggart's DebConf2 talk to README.Debian.
+    (Closes: #198600)
+  * Add French translation of debconf prompts.  (Closes: #201626)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Mon, 21 Jul 2003 12:19:34 -0400
+
+lsb (1.3-1) unstable; urgency=low
+
+  * First release of LSB 1.3 for Debian.
+  * Convert everything to Python 2.2+ style.
+  * Clean up the parsing of header lines to be fully compliant.
+  * Add po-debconf patch.  (Closes: #186853)
+  * Don't retry if a signal specified in killproc.  (Closes: #167759)
+  * Revise pidofproc to return a failure code if no pid found.
+    (Closes: #190719)
+  * Properly treat Required-Start and Required-Stop as strict dependencies
+    (install_initd will now fail if they cannot be fulfilled.)
+  * remove_initd will now fail if removing the init script would cause
+    another LSB package to be missing a dependency.  (However, the
+    tracking for these dependencies was not done in the past.  As this is
+    part of gLSB 1.9, this should not be a problem.)
+  * The previous two items were in a single report.  (Closes: #198293)
+  * Support Should-Start and Should-Stop from gLSB 1.9.  (Closes: #198277)
+    (A warning message will be output if a facility requested is unavailable.)
+  * Support -p argument to killproc, pidofproc and start_daemon, per gLSB 1.9.
+    (Closes: #197794)
+  * Set up the ld-lsb symlink in the postinst, so it can vary between
+    architectures, and remove in the prerm.  (Closes: #183617)
+    Currently only defined for IA32 (i386), PPC32 (powerpc) and S390
+    (s390); please let me know the correct link for IA64 (ia64) and any
+    other ports that may be floating out there.  (I'm only interested in
+    architectures that appear at http://www.linuxbase.org/spec/.)
+  * Purge the lsb registry on package removal.
+  * Depend on mawk | gawk; original-awk may not be SUS-compliant.
+    (See http://www.linuxbase.org/spec/refspecs/LSB_1.3.0/gLSB/gLSB/awk.html)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Tue, 24 Jun 2003 03:06:37 -0500
+
+lsb (1.2-6) unstable; urgency=medium
+
+  * Fix call to shadowconfig in postinst.  (Closes: #166041)
+  * Add text to the debconf template that lets the user know that shadow
+    passwords are not needed by most LSB applications.
+
+ -- Chris Lawrence <lawrencc@debian.org>  Sat, 26 Oct 2002 07:20:54 -0500
+
+lsb (1.2-5) unstable; urgency=medium
+
+  * Remove duplicate --retry 5 from start-stop-daemon call.  (Closes: #165395)
+  * Fix bugs in the init script registry code.  (Closes: #165038)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Tue, 22 Oct 2002 06:23:03 -0500
+
+lsb (1.2-4) unstable; urgency=low
+
+  * Support more specifications for the signal in "killproc".
+    (Closes: #163109)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Fri,  4 Oct 2002 07:09:22 -0500
+
+lsb (1.2-3) unstable; urgency=low
+
+  * Return non-zero exit status if "pidofproc" can't find the process.
+    (Closes: #157314)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Wed, 21 Aug 2002 13:20:09 -0500
+
+lsb (1.2-2) unstable; urgency=low
+
+  * Fix silly typos in install_initd.  (Closes: #152544)
+  * Fix duplicated --retry 5.  (Closes: #152552)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Wed, 10 Jul 2002 15:48:10 -0500
+
+lsb (1.2-1) unstable; urgency=low
+
+  * ADV: Matt Taggart will be giving a presentation on LSB in Debian at
+    Debconf2 on Sunday afternoon; your attendence and attentiveness is
+    strongly encouraged :-)
+
+  * First release of LSB 1.2 (hopefully-)compliant package.
+  * Added link to joeyh's LSB testing page to README.Debian.
+  * Revised README.Debian in light of LSB 1.2's improved verbiage.
+  * Added support for facilities introduced in gLSB 1.2.  (Closes: #148568)
+    - $time: start >= S24, stop <= K21
+    - $portmap: start >= S19, stop <= K34
+  * Removed support for the $netdaemons facility, which vanished from the
+    specification.  Hopefully nobody is using it...
+  * Call pidof if it's available and /var/run/$1.pid doesn't exist.
+
+ -- Chris Lawrence <lawrencc@debian.org>  Tue,  2 Jul 2002 19:48:35 -0500
+
+lsb (1.1.0-11) unstable; urgency=low
+
+  * Note that Debian's run-parts ignores certain lsb cron.* scripts, in
+    violation of the LSB specification.  See #118646.
+    (If necessary, run-parts may be diverted by this package to conform.)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Mon, 15 Apr 2002 02:25:51 -0500
+
+lsb (1.1.0-10) unstable; urgency=low
+
+  * Force removal of rc.d links in remove_initd.  (Closes: #139400)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Thu, 21 Mar 2002 22:43:01 -0600
+
+lsb (1.1.0-9) unstable; urgency=low
+
+  * Improve error handing in {install,remove}_initd when no argument is
+    specified.
+  * Fix minor syntax error in outputing the facilities file.
+  * Move facilities file handling into the initdutils module.
+  * Changed facilities file format to allow multiple init scripts to
+    provide the same facility w/o crashing.
+  * These changes should solve all the init script handing bugs; thanks to
+    Tobias Burnus <tburnus@physik.fu-berlin.de> for his testing.
+
+ -- Chris Lawrence <lawrencc@debian.org>  Tue, 19 Mar 2002 20:40:50 -0600
+
+lsb (1.1.0-8) unstable; urgency=low
+
+  * Fix typo in debian/rules.  (Closes: #138945)
+  * Rewrite the init script handling to improve modularity.
+  * Fix typos in regexes in init script handling.  (Closes: #138946)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Tue, 19 Mar 2002 14:47:43 -0600
+
+lsb (1.1.0-7) unstable; urgency=low
+
+  * Fix remove_initd in line with the changes to install_initd.
+
+ -- Chris Lawrence <lawrencc@debian.org>  Sun, 17 Mar 2002 19:46:21 -0600
+
+lsb (1.1.0-6) unstable; urgency=medium
+
+  * Fix typos in init functions.  (Closes: #138766)
+  * Move init-functions to /lib/lsb.  (Closes: #138762)
+  * Fix logic errors in start_daemon.  (Closes: #138771)
+  * Fix init script header processing to accomodate minor deviations from
+    the LSB spec.  (Closes: #138789)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Sun, 17 Mar 2002 18:27:42 -0600
+
+lsb (1.1.0-5) unstable; urgency=low
+
+  * Include /usr/X11R6/bin to make the LSB test suite happy.  Document
+    LSB's lack of specification of an X server or any clients as required
+    for compliance (hence making it odd that /usr/X11R6/bin would be
+    needed, as it could conceivably be empty).  (Closes: #136713)
+  * Prompt on installation if shadow passwords appear to be disabled, and
+    enable them if requested.  (Closes: #136806)
+  * Fix the spelling of Matt Taggart's name in README.Debian.
+
+ -- Chris Lawrence <lawrencc@debian.org>  Fri,  8 Mar 2002 23:19:39 -0600
+
+lsb (1.1.0-4) unstable; urgency=low
+
+  * Clean up directories to omit those present in current base-files.
+  * Rearrange README.Debian to put installation discussion near the top.
+
+ -- Chris Lawrence <lawrencc@debian.org>  Sun, 24 Feb 2002 23:51:05 -0600
+
+lsb (1.1.0-3) unstable; urgency=low
+
+  * Release candidate.
+  * Include HTML files from Matt Taggart <taggart@debian.org> comparing
+    the LSB spec to Debian.
+  * Clean up dependency list.
+  * Convert to arch-independent package.
+  * Add lsb(8) manpage.
+
+ -- Chris Lawrence <lawrencc@debian.org>  Sun, 24 Feb 2002 21:42:26 -0600
+
+lsb (1.1.0-2) unstable; urgency=low
+
+  * Update README.Debian and install_initd to implement a few changes:
+    - uid/gid for bin is documented.
+    - treat RL 2-5 as the same, because nothing else sensible seems
+      available.
+
+ -- Chris Lawrence <lawrencc@debian.org>  Mon, 18 Feb 2002 20:08:23 -0600
+
+lsb (1.1.0-1) unstable; urgency=low
+
+  * Initial Release.  (Closes: #134658)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Sun, 17 Feb 2002 14:07:32 -0600
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..ec63514
--- /dev/null
@@ -0,0 +1 @@
+9
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..a28b4bf
--- /dev/null
@@ -0,0 +1,84 @@
+Source: lsb
+Section: misc
+Priority: extra
+Maintainer: Debian LSB Team <debian-lsb@lists.debian.org>
+Uploaders: Didier Raboud <odyx@debian.org>, Jeff Licquia <licquia@debian.org>
+Build-Depends: debhelper (>> 9.0),
+ po-debconf (>= 0.5.0),
+ dpkg-dev (>= 1.10),
+ python3-all:any,
+ dh-python,
+ distro-info-data,
+X-Python3-Version: >= 3.4
+Standards-Version: 3.9.8
+Homepage: http://www.linuxfoundation.org/collaborate/workgroups/lsb
+Vcs-Git: git://anonscm.debian.org/collab-maint/lsb.git
+Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/lsb.git
+
+Package: lsb-base
+Architecture: all
+Multi-Arch: foreign
+Depends: ${misc:Depends}
+Pre-Depends: ${misc:Pre-Depends}
+Priority: required
+Description: Linux Standard Base init script functionality
+ The Linux Standard Base (http://www.linuxbase.org/) is a standard
+ core system that third-party applications written for Linux can
+ depend upon.
+ .
+ This package only includes the init-functions shell library, which
+ may be used by other packages' initialization scripts for console
+ logging and other purposes.
+
+Package: lsb-release
+Architecture: all
+Priority: optional
+Multi-Arch: foreign
+Depends: ${python3:Depends},
+ ${misc:Depends},
+ distro-info-data,
+Recommends: apt
+Suggests: lsb
+Description: Linux Standard Base version reporting utility
+ The Linux Standard Base (http://www.linuxbase.org/) is a standard
+ core system that third-party applications written for Linux can
+ depend upon.
+ .
+ The lsb-release command is a simple tool to help identify the Linux
+ distribution being used and its compliance with the Linux Standard Base.
+ LSB conformance will not be reported unless the required metapackages are
+ installed.
+ .
+ While it is intended for use by LSB packages, this command may also
+ be useful for programmatically distinguishing between a pure Debian
+ installation and derived distributions.
+
+Package: lsb-compat
+Architecture: any
+Depends: lsb-release (>= ${source:Version}),
+ lsb-base (>= ${source:Version}),
+ ${glibc},
+ ${python3:Depends},
+ ${misc:Depends},
+ ${depends},
+# printer drivers, such as epson-inkjet-printer-201106w
+ libcups2,
+ libcupsimage2,
+ ghostscript,
+ cups-filters (>= 1.0.36),
+Provides: ${provides},
+ lsb-core (= 4.1),
+ lsb (= 4.1),
+Conflicts:
+ lsb-core,
+ lsb
+Replaces:
+ lsb-core,
+ lsb
+Description: Linux Standard Base Compatibility
+ The Linux Standard Base (http://www.linuxbase.org/) was a standard
+ core system that third-party applications written for Linux could
+ depend upon.
+ .
+ This package provides the most minimal layer to be able to install and run
+ selected legacy LSB packages on Debian.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..145c590
--- /dev/null
@@ -0,0 +1,58 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: LSB implementation package
+
+Files: *
+Copyright: 2002-2010, Chris Lawrence <lawrencc@debian.org> 
+License: GPL-2
+
+Files: init-functions.d/50-ubuntu-logging
+Copyright: 2005-2011, Canonical Ltd.
+License: GPL-2
+
+Files: init-functions
+Copyright: 2002-2009, Chris Lawrence <lawrencc@debian.org>
+License: BSD-3-clause
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the author nor the names of other contributors
+    may be used to endorse or promote products derived from this software
+    without specific prior written permission.
+ .
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS''
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
+ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+License: GPL-2
+ This program is free software; you can redistribute it
+ and/or modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation;
+ version 2 dated June 1991.
+ .
+ This program is distributed in the hope that it will be
+ useful, but WITHOUT ANY WARRANTY; without even the implied
+ warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.  See the GNU General Public License for more
+ details.
+ .
+ You should have received a copy of the GNU General Public
+ License along with this package; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ Boston, MA  02110-1301 USA
+ .
+ On Debian systems, the full text of the GNU General Public
+ License version 2 can be found in the file
+ `/usr/share/common-licenses/GPL-2'.
diff --git a/debian/gbp.conf b/debian/gbp.conf
new file mode 100644 (file)
index 0000000..8f53891
--- /dev/null
@@ -0,0 +1,2 @@
+[DEFAULT]
+debian-branch = debian/master
diff --git a/debian/lsb-base.NEWS b/debian/lsb-base.NEWS
new file mode 100644 (file)
index 0000000..1e5274d
--- /dev/null
@@ -0,0 +1,25 @@
+lsb (9.20150826) unstable; urgency=low
+
+  This update drops all lsb-* compatibility packages, and is therefore an
+  abandon of the pursuit of LSB compatibility for Debian. Only lsb-release and
+  lsb-base are kept as they continue to be used throughout the archive.
+
+ -- Didier Raboud <odyx@debian.org>  Wed, 26 Aug 2015 12:00:00 +0200
+
+lsb (4.1+Debian1) unstable; urgency=low
+
+  This version implements a new "Fancy output" in the form of "[....] "
+  blocks prepended to the daemon status messages:
+
+  Before:
+     Starting/stopping long daemon name: daemond daemon2d
+  After:
+     [....] Starting/stopping long daemon name: daemond daemon2d
+
+  This block will become either a green [ ok ], a yellow [warn]
+  or a red [FAIL] depending on the daemon exit status.
+
+  The "Fancy output" can be disabled by setting the FANCYTTY variable to 0
+  in the /etc/lsb-base-logging.sh configuration file.
+
+ -- Didier Raboud <odyx@debian.org>  Thu, 19 Apr 2012 11:25:01 +0200
diff --git a/debian/lsb-base.README.Debian b/debian/lsb-base.README.Debian
new file mode 100644 (file)
index 0000000..9f73860
--- /dev/null
@@ -0,0 +1,234 @@
+lsb-base for Debian
+-------------------
+
+The Debian lsb-base package provides a series of logging functions to
+permit simplified logging of init script actions.  These functions are
+specific to Debian and (in some cases) other derived distributions.
+
+  - log_daemon_msg "Starting/stopping long daemon name" "daemond"
+
+    Log starting/stopping of daemons. On Debian, outputs:
+
+    "Starting/stopping long daemon name: daemond"
+
+    and leaves the cursor at the end of the line. If "Fancy output" is
+    enabled, outputs:
+
+    "[....] Starting/stopping long daemon name: daemond"
+
+    and leaves the cursor at the end of the line.
+
+  - log_progress_msg "daemon2d"
+
+    Log startup of a second daemon (e.g. sysklogd, nfs init scripts).
+    On Debian, outputs " daemon2d" and leaves the cursor at the EOL.
+
+  - log_end_msg 0/1
+
+    Log successful startup.  On Debian, outputs "." followed by newline.
+    A non-zero code may also be specified, which indicates failure;
+    currently implemented as outputting "failed!" (in red on a color
+    TTY) followed by newline.
+
+    Unsucessful startup will cause the specified failure code to be
+    returned by this function; unless trapped, this may end your init
+    script depending on whether or not set -e is used.
+
+    If "Fancy output" is enabled, it will store the cursor position,
+    move it to the start of the line, write a colored "[ ok ]", "[FAIL]"
+    or "[warn]" and restore the cursor position. This has the effect of
+    updating the "[....]" printed by log_daemon_msg.
+
+  - log_action_msg "Setting VARIABLE to VALUE"
+
+    Log an atomic action by your init script.  Typically, this is the
+    setting of a kernel variable, but it might be something else that is
+    not expected to take any time (or fail).
+
+    On Debian, a trailing period will be added to the message, followed by
+    a newline. If "Fancy output" is enabled, the message will get prepended
+    with a blue [info].
+
+  - log_action_begin_msg "Configuring network interfaces"
+
+    Log the start of an action that is expected to take some time.  On
+    Debian, an elipsis (...) will follow the message, and the cursor will
+    stay at EOL.
+
+    If "Fancy output" is enabled, it will get the same [....] block as
+    log_daemon_msg.
+
+  - log_action_cont_msg "flushing ARP cache"
+
+    Log an action as part of a process started by log_action_start_msg().
+    On Debian, this message will receive a trailing elipsis, and the cursor
+    will stay at EOL.
+
+  - log_action_end_msg {0|1} ["message"]
+
+    Log the end of the action started by log_action_start_msg().  If one
+    argument is supplied, either "done." (0) or "failed." (1) will be output,
+    followed by a newline.  If a second argument is supplied, the message
+    will appear as follows:
+
+    "done (your message here)." --- if first argument is 0
+    "failed (your message here)." --- if first argument is 1
+
+    This argument must be quoted, or otherwise only the first word will
+    be output.
+
+    On color TTYs, the failure messages will be red.
+
+    Note that unlike log_end_msg(), this function does not return the
+    first argument as its exit code.
+
+  - status_of_proc [-p pidfile] pathname "Daemon_name"
+
+    Log the status of a process and return an LSB-compliant exit status
+    code:
+
+    0       program is running or service is OK
+    1       program is dead and /var/run pid file exists
+    2       program is dead and /var/lock lock file exists
+    3       program is not running
+    4       program or service status is unknown
+    5-99    reserved for future LSB use
+    100-149 reserved for distribution use
+    150-199 reserved for application use
+    200-254 reserved
+
+    On Debian, outputs:
+      "Daemon_name is running.".
+      "Daemon_name is not running ... failed!"
+
+    The pidfile path will be used as argument for pidofproc and must be
+    provided if the pidfile is not /var/run/$daemon_basename.pid.
+
+    status_of_proc can be used to easily implement the "status" argument
+    of init scripts:
+
+      status)
+        status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
+      ;;
+
+  - init_is_upstart
+
+    If the currently running init daemon is upstart, return zero; if the
+    calling init script belongs to a package which also provides a native
+    upstart job, it should generally exit non-zero in this case.
+
+    init_is_upstart is available since lsb-base 4.1+Debian3.
+
+To use these functions, source /lib/lsb/init-functions at the
+beginning of your (Bourne sh or compatible) init script.
+
+Please depend on lsb-base to ensure all of these functions are available
+for your init scripts.
+
+LSB LOGGING FUNCTIONS
+
+This package also includes the LSB-specified logging functions:
+
+log_success_msg message
+log_failure_msg message
+log_warning_msg message
+
+These functions *do not* comply with Debian policy and should only be used
+by LSB packages.
+
+OTHER LSB FUNCTIONALITY
+
+start_daemon [-f] [-n nicelevel] [-p pidfile] pathname [args...]
+  Start "pathname" as a daemon.  We call Debian's start-stop-daemon to
+  implement this functionality.
+
+killproc [-p pidfile] pathname [signal]
+  Stops "pathname" (using "pidfile", if specified, to find the process
+  ID).  This is implemented using start-stop-daemon as well.
+
+pidofproc [-p pidfile] pathname
+  Find the process ID of pathname.  If the pidfile is specified, we use the
+  first space-delimited word; otherwise, /bin/pidof is used from the
+  sysvinit package, if available.
+
+For full documentation, please refer to:
+
+http://refspecs.linuxbase.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptfunc.html
+
+Note: Debian packages probably should use start-stop-daemon directly;
+however, these functions may be useful in porting init scripts from
+other distributions.  Also, if you are developing software for wider
+use, you should not expect these functions to be implemented
+identically on other LSB-conforming distributions; the only guaranteed
+behaviors are those in the specification above.
+
+CUSTOMIZING LOGGING OUTPUT
+
+  - FOR PACKAGES AND DISTRIBUTIONS
+
+Since lsb-base 4.1+Debian4, init-functions will source all
+correctly-named files under /lib/lsb/init-functions.d for the purpose of
+allowing packages to alter or enhance the init-functions functions.
+
+By providing a file in there, any package or derivative distribution can
+override the default behaviour of /lib/lsb/init-functions: logging init
+script events, changing the logging messages format, etc.
+
+If supplied, these script fragments shall be compatible with any Debian
+/bin/sh, as init scripts sourcing /lib/lsb/init-functions may be running
+under any Bourne-style shell permitted by Debian policy (i.e. not just
+bash).
+
+  - FOR ADMINISTRATORS
+
+After those distribution-provided files, if it exists,
+/etc/lsb-base-logging.sh will be sourced by /lib/lsb/init-functions.
+This file is to be supplied by the administrator for machine-specific
+overrides. This file may also be useful on systems where the console log
+is not visible during startup.
+
+If supplied, this script fragment should be compatible with any Debian
+/bin/sh, as init scripts sourcing this file may be running under any
+Bourne-style shell permitted by Debian policy (i.e. not just bash).
+
+  - FANCY OUTPUT
+
+"Fancy output" can be overridden by setting FANCYTTY=0 in
+/etc/lsb-base-logging.sh .
+
+  - OUTPUT FUNCTIONS
+
+From lsb-base 3.2-14, you can use the following hook functions which
+are called by the appropriate functions, instead of supplying your own
+logging functions:
+
+log_daemon_msg_pre
+log_daemon_msg_post
+log_begin_msg_pre (since 4.1+Debian1)
+log_begin_msg_post (since 4.1+Debian1)
+log_action_msg_pre (since 4.1+Debian1)
+log_action_msg_post (since 4.1+Debian1)
+log_action_begin_msg_pre (since 4.1+Debian1)
+log_action_begin_msg_post (since 4.1+Debian1)
+log_end_msg_pre
+log_end_msg_post
+log_action_end_msg_pre
+log_action_end_msg_post
+
+Each function receives all of the arguments sent to the parent
+function; the "pre" functions operate before any output, while the
+"post" functions operate after the output is produced.
+
+FANCY OUTPUT, KNOWN BUGS
+
+  * Daemons writing too much information on the screen (hence getting
+    their output spawned on multiple lines) won't get their [....]
+    replaced by [ ok ] as the replacement will happen on the last input
+    line.
+  * The above has the side-effect of hiding 7 characters of potentially
+    useful output.
+  * init.d scripts not using the /lib/lsb/init-functions provided
+    functions will (obviously) not get the fancy output.
+
+ -- Chris Lawrence <lawrencc@debian.org>, Sat, 18 Sep 2010 17:09:57 -0500
+ -- Didier Raboud <odyx@debian.org>  Mon, 21 May 2012 15:00:10 +0200
diff --git a/debian/lsb-base.dirs b/debian/lsb-base.dirs
new file mode 100644 (file)
index 0000000..acead11
--- /dev/null
@@ -0,0 +1 @@
+/lib/lsb/init-functions.d
diff --git a/debian/lsb-base.install b/debian/lsb-base.install
new file mode 100644 (file)
index 0000000..66dc0df
--- /dev/null
@@ -0,0 +1,2 @@
+init-functions /lib/lsb
+init-functions.d/20-left-info-blocks /lib/lsb/init-functions.d
diff --git a/debian/lsb-base.maintscript.Ubuntu b/debian/lsb-base.maintscript.Ubuntu
new file mode 100644 (file)
index 0000000..efdcca8
--- /dev/null
@@ -0,0 +1 @@
+rm_conffile /etc/lsb-base-logging.sh 4.1+Debian4 lsb-base
diff --git a/debian/lsb-compat.dirs b/debian/lsb-compat.dirs
new file mode 100644 (file)
index 0000000..d3d8c10
--- /dev/null
@@ -0,0 +1,3 @@
+usr/lib/lsb
+var/lib/lsb
+etc/profile.d
diff --git a/debian/lsb-compat.install b/debian/lsb-compat.install
new file mode 100644 (file)
index 0000000..eaee1e9
--- /dev/null
@@ -0,0 +1,4 @@
+initdutils.py /usr/lib/lsb
+install_initd /usr/lib/lsb
+remove_initd /usr/lib/lsb
+lsbinstall /usr/lib/lsb
diff --git a/debian/lsb-compat.lintian-overrides b/debian/lsb-compat.lintian-overrides
new file mode 100644 (file)
index 0000000..64b2b9f
--- /dev/null
@@ -0,0 +1,2 @@
+# The purpose of LSB is to ensure that those packages are present. Being explicit cannot hurt.
+depends-on-essential-package-without-using-version depends: bsdutils
diff --git a/debian/lsb-compat.manpages b/debian/lsb-compat.manpages
new file mode 100644 (file)
index 0000000..44c423d
--- /dev/null
@@ -0,0 +1 @@
+lsb.8
diff --git a/debian/lsb-compat.postinst b/debian/lsb-compat.postinst
new file mode 100755 (executable)
index 0000000..ce155f5
--- /dev/null
@@ -0,0 +1,65 @@
+#!/bin/sh
+
+set -e
+
+setup_ldso_symlink () {
+    ARCH=$DPKG_MAINTSCRIPT_ARCH
+    if [ -z "$ARCH" ]; then
+        ARCH=$(dpkg --print-architecture)
+    fi
+    case "$ARCH" in
+        s390|ppc64|sparc|sparc64|alpha|hppa|m68k|mipsel)
+            ln -sf ld.so.1 /lib/ld-lsb-$ARCH.so.1
+            ln -sf ld.so.1 /lib/ld-lsb-$ARCH.so.2
+            ln -sf ld.so.1 /lib/ld-lsb-$ARCH.so.3
+            ;;
+        powerpc)
+            ln -sf ld.so.1 /lib/ld-lsb-ppc32.so.1
+            ln -sf ld.so.1 /lib/ld-lsb-ppc32.so.2
+            ln -sf ld.so.1 /lib/ld-lsb-ppc32.so.3
+            ;;
+        i386)
+            ln -sf ld-linux.so.2 /lib/ld-lsb.so.1
+            ln -sf ld-linux.so.2 /lib/ld-lsb.so.2
+            ln -sf ld-linux.so.2 /lib/ld-lsb.so.3
+            ;;
+        amd64)
+            ln -sf ld-linux.so.2 /lib/ld-lsb.so.1
+            ln -sf ld-linux.so.2 /lib/ld-lsb.so.2
+            ln -sf ld-linux.so.2 /lib/ld-lsb.so.3
+            ln -sf ld-linux-x86-64.so.2 /lib64/ld-lsb-x86-64.so.2
+            ln -sf ld-linux-x86-64.so.2 /lib64/ld-lsb-x86-64.so.3
+            ;;
+        ia64)
+            ln -sf ld-linux-ia64.so.2 /lib/ld-lsb-ia64.so.1
+            ln -sf ld-linux-ia64.so.2 /lib/ld-lsb-ia64.so.2
+            ln -sf ld-linux-ia64.so.2 /lib/ld-lsb-ia64.so.3
+            ;;
+        *)
+            echo "ld-lsb-*.so.1 symlink for $ARCH is unknown!"
+            ;;
+    esac
+}
+
+PATH=/sbin:/usr/sbin:$PATH
+export PATH
+
+. /usr/share/debconf/confmodule
+
+case "$1" in
+    configure)
+        if dpkg --compare-versions "$2" lt "3.2+Debian30" ; then
+          [ -L /lib/ld-lsb-x86-64.so.2 ] && rm /lib/ld-lsb-x86-64.so.2 || true
+          [ -L /lib/ld-lsb-x86-64.so.3 ] && rm /lib/ld-lsb-x86-64.so.3 || true
+        fi
+        setup_ldso_symlink
+        ;;
+    abort-upgrade|abort-remove|abort-deconfigure)
+        ;;
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+#DEBHELPER#
diff --git a/debian/lsb-compat.prerm b/debian/lsb-compat.prerm
new file mode 100644 (file)
index 0000000..8b1f535
--- /dev/null
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+set -e
+
+remove_ldso_symlink () {
+    ARCH=$DPKG_MAINTSCRIPT_ARCH
+    if [ -z "$ARCH" ]; then
+        ARCH=$(dpkg --print-architecture)
+    fi
+    case "$ARCH" in
+        s390|ia64|ppc64|sparc|sparc64|alpha|hppa|m68k|mipsel)
+            rm -f /lib/ld-lsb-$ARCH.so.[123]
+            ;;
+        powerpc)
+            rm -f /lib/ld-lsb-ppc32.so.[123]
+            ;;
+        i386)
+            rm -f /lib/ld-lsb.so.[123]
+            ;;
+        amd64)
+            rm -f /lib/ld-lsb.so.[123] /lib64/ld-lsb-x86-64.so.[23]
+            ;;
+        *)
+            echo "ld-lsb-*.so.1 symlink for $ARCH is unknown; not removed."
+            ;;
+    esac
+}
+
+PATH=/sbin:/usr/sbin:$PATH
+export PATH
+
+case "$1" in
+    remove)
+        remove_ldso_symlink
+        rm -f /var/lib/lsb/facilities
+        rm -f /var/lib/lsb/depends
+        ;;
+    failed-upgrade|upgrade|deconfigure)
+        ;;
+    *)
+        echo "prerm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+
+#DEBHELPER#
diff --git a/debian/lsb-release.README.Debian b/debian/lsb-release.README.Debian
new file mode 100644 (file)
index 0000000..af32d74
--- /dev/null
@@ -0,0 +1,38 @@
+lsb-release for Debian
+----------------------
+
+NB: These notes are intended for anyone building a derived
+distribution using this package.  They are not likely to be helpful to
+end-users.
+
+This is a reimplementation of the classic lsb_release command; its
+main new feature is support for the new output for the -v option in
+LSB 2.x/3.x.  This version of lsb_release is also designed to only report
+that a system is LSB compliant if the correct LSB metapackages are available,
+and to properly support situations where only certain LSB metapackages
+(i.e. lsb-core only) are installed.
+
+Distribution-specific information should be *separately provided* in
+/etc/lsb-release; it is no longer provided in this package.  It is my
+hope that in Debian, this will be managed by the base-files
+maintainer (who already maintains the debian_version file).
+
+The file should be formatted as a series of shell variable
+assignments.  Multiword strings should be quoted in double quotes.
+You should not assume this file is actually parsed by a Bourne shell
+(i.e., no fancy stuff).  Example:
+
+DISTRIB_ID=(Distributor ID)
+DISTRIB_DESCRIPTION=(A human-readable description of the release)
+DISTRIB_RELEASE=(The release number)
+DISTRIB_CODENAME=(The codename for the release)
+
+Any other variable assignments will be silently ignored.  For Debian
+7.0 (jessie), it might have read:
+
+DISTRIB_ID=Debian
+DISTRIB_DESCRIPTION="Debian GNU/Linux 7.0 (jessie)"
+DISTRIB_RELEASE=7.0
+DISTRIB_CODENAME=jessie
+
+ -- Chris Lawrence <lawrencc@debian.org>, Wed Sep 21 20:40:25 2005
diff --git a/debian/lsb-release.bug-script b/debian/lsb-release.bug-script
new file mode 100755 (executable)
index 0000000..151361b
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+echo 'lsb_release output' >& 3
+echo '-*- -*- -*- -*- -*-'>&3
+lsb_release -a >& 3
+echo '-*- -*- -*- -*- -*-'>&3
+echo '    Apt policy' >&3
+echo '-*- -*- -*- -*- -*-'>&3
+apt-cache policy >&3
+echo '-*- -*- -*- -*- -*-'>&3
+echo '   sources.list' >&3
+echo '-*- -*- -*- -*- -*-'>&3
+if [ -f /etc/apt/sources.list ]; then
+    cat /etc/apt/sources.list | grep -v '^\s*#' | grep -v '^\s*$' >&3
+else
+    echo '- none' >&3
+fi
+echo '-*- -*- -*- -*- -*-'>&3
+echo ' /etc/lsb_release' >&3
+echo '-*- -*- -*- -*- -*-'>&3
+if [ -f /etc/lsb_release ]; then
+    cat /etc/lsb_release >&3
+else
+    echo '- none' >&3
+fi
diff --git a/debian/lsb-release.install b/debian/lsb-release.install
new file mode 100644 (file)
index 0000000..7cb506f
--- /dev/null
@@ -0,0 +1,2 @@
+lsb_release /usr/bin
+lsb_release.py /usr/share/pyshared/
diff --git a/debian/lsb-release.links b/debian/lsb-release.links
new file mode 100644 (file)
index 0000000..a71099b
--- /dev/null
@@ -0,0 +1,2 @@
+usr/share/pyshared/lsb_release.py usr/lib/python2.7/dist-packages/lsb_release.py
+usr/share/pyshared/lsb_release.py usr/lib/python3/dist-packages/lsb_release.py
diff --git a/debian/lsb-release.manpages b/debian/lsb-release.manpages
new file mode 100644 (file)
index 0000000..c610296
--- /dev/null
@@ -0,0 +1 @@
+lsb_release.1
diff --git a/debian/lsb-release.postinst b/debian/lsb-release.postinst
new file mode 100644 (file)
index 0000000..93862fd
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+    configure)
+        if [ -e /etc/lsb-release ]; then
+            MD5SUM=`md5sum /etc/lsb-release | cut -d" " -f1`
+            if [ "$MD5SUM" = "b5bfe10d9b02fb4e4a45337d1c4d88ab" ]; then
+                rm -f /etc/lsb-release
+            fi
+        fi
+        ;;
+esac
+
+#DEBHELPER#
diff --git a/debian/lsb-release.postrm b/debian/lsb-release.postrm
new file mode 100644 (file)
index 0000000..29333f6
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+    purge)
+        if [ -e /etc/lsb-release ]; then
+            MD5SUM=`md5sum /etc/lsb-release | cut -d" " -f1`
+            if [ "$MD5SUM" = "b5bfe10d9b02fb4e4a45337d1c4d88ab" ]; then
+                rm -f /etc/lsb-release
+            fi
+        fi
+        ;;
+esac
+
+#DEBHELPER#
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..7e803de
--- /dev/null
@@ -0,0 +1,93 @@
+#!/usr/bin/make -f
+
+derives_from_ubuntu := $(shell (dpkg-vendor --derives-from Ubuntu && echo "yes") || echo "no")
+
+PY3VERSIONS=$(shell [ -x /usr/bin/py3versions ] && py3versions -vr)
+
+%:
+       dh $@ --with python3
+
+# These are used for cross-compiling and for saving the configure script
+# from having to guess our platform (since we know it already)
+DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+DEB_HOST_ARCH       ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
+
+# Map Debian architectures to LSB architectures
+lsbarch=${DEB_HOST_ARCH}
+ifeq (${lsbarch}, i386)
+lsbarch=ia32
+endif
+ifeq (${lsbarch}, powerpc)
+lsbarch=ppc32
+endif
+
+LIBC=libc6 (>> 2.3.5)
+ifeq (${lsbarch}, amd64)
+LIBC=libc6 (>= 2.13-17)
+endif
+ifeq (${lsbarch}, hurd-i386)
+LIBC=libc0.3 (>> 2.3.5)
+endif
+ifeq (${lsbarch}, kfreebsd-amd64)
+LIBC=libc0.1 (>> 2.3.5)
+endif
+ifeq (${lsbarch}, kfreebsd-i386)
+LIBC=libc0.1 (>> 2.3.5)
+endif
+ifeq (${lsbarch}, ia64)
+LIBC=libc6.1 (>> 2.3.5)
+endif
+ifeq (${lsbarch}, alpha)
+LIBC=libc6.1 (>> 2.3.5)
+endif
+
+override_dh_clean:
+       dh_clean
+       rm -f *.py[co]
+       rm -f debian/lsb-base.maintscript
+       rm -rf __pycache__
+       rm -rf test/__pycache__
+
+ifneq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
+override_dh_auto_test:
+else
+override_dh_auto_test: $(PY3VERSIONS:%=test-python%)
+endif
+
+test-python%:
+       PATH=test/:$${PATH} PYTHONPATH=. python$* test/test_lsb_release.py -vv
+       PYTHONPATH=. python$* test/test_initdutils.py -vv
+       rm -rf __pycache__
+       rm -rf test/__pycache__
+       rm -f test/debian_version_*
+
+override_dh_python3:
+       dh_python3
+       dh_python3 /usr/lib/lsb
+
+override_dh_install:
+       dh_install
+ifeq ($(derives_from_ubuntu),yes)
+ifneq (,$(findstring lsb-base, $(shell dh_listpackages)))
+       cp -p init-functions.d/50-ubuntu-logging debian/lsb-base/lib/lsb/init-functions.d/
+endif
+
+override_dh_installdeb:
+       cp debian/lsb-base.maintscript.Ubuntu debian/lsb-base.maintscript
+       dh_installdeb
+endif
+
+override_dh_gencontrol:
+       @echo >> debian/lsb-compat.substvars "glibc=${LIBC}"
+#      @[ ${DEB_HOST_GNU_TYPE} != 'arm-linux-gnueabi' ] && echo >> debian/lsb-cxx.substvars "depends=libstdc++5" || true
+       @echo >> debian/lsb-cxx.substvars "provides=lsb-cxx-${lsbarch}"
+       @echo >> debian/lsb-graphics.substvars "provides=lsb-graphics-${lsbarch}"
+       @echo >> debian/lsb-desktop.substvars "provides=lsb-qt4-${lsbarch}, lsb-desktop-${lsbarch}"
+       @echo >> debian/lsb-multimedia.substvars "provides=lsb-multimedia-${lsbarch}"
+       @echo >> debian/lsb-languages.substvars "provides=lsb-languages-${lsbarch}"
+       @echo >> debian/lsb-printing.substvars "provides=lsb-printing-${lsbarch}"
+       @echo >> debian/lsb-security.substvars "provides=lsb-security-${lsbarch}"
+       @[ ${DEB_HOST_ARCH} = 'amd64' ] && echo >> debian/lsb-compat.substvars "depends=libc6:i386 | libc6-i386, zlib1g:i386 | lib32z1" || true
+       @[ ${DEB_HOST_ARCH} = 'kfreebsd-amd64' ] && echo >> debian/lsb-compat.substvars "depends=libc0.1:kfreebsd-i386 | libc0.1-i386, zlib1g:kfreebsd-i386 | lib32z1" || true
+       dh_gencontrol
diff --git a/debian/source/format b/debian/source/format
new file mode 100644 (file)
index 0000000..89ae9db
--- /dev/null
@@ -0,0 +1 @@
+3.0 (native)
diff --git a/debian/source/options b/debian/source/options
new file mode 100644 (file)
index 0000000..b7bc1f2
--- /dev/null
@@ -0,0 +1 @@
+compression = "xz"
diff --git a/init-functions b/init-functions
new file mode 100644 (file)
index 0000000..cb8874c
--- /dev/null
@@ -0,0 +1,433 @@
+# /lib/lsb/init-functions for Debian -*- shell-script -*-
+#
+#Copyright (c) 2002-08 Chris Lawrence
+#All rights reserved.
+#
+#Redistribution and use in source and binary forms, with or without
+#modification, are permitted provided that the following conditions
+#are met:
+#1. Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+#2. Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+#3. Neither the name of the author nor the names of other contributors
+#   may be used to endorse or promote products derived from this software
+#   without specific prior written permission.
+#
+#THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+#IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+#WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+#ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+#LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+#CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+#SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+#BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+#WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+#OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+#EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+start_daemon () {
+    local force nice pidfile exec args OPTIND
+    force=""
+    nice=0
+    pidfile=/dev/null
+
+    OPTIND=1
+    while getopts fn:p: opt ; do
+        case "$opt" in
+            f)  force="force";;
+            n)  nice="$OPTARG";;
+            p)  pidfile="$OPTARG";;
+        esac
+    done
+    
+    shift $(($OPTIND - 1))
+    if [ "$1" = '--' ]; then
+        shift
+    fi
+
+    exec="$1"; shift
+
+    args="--start --nicelevel $nice --quiet --oknodo"
+    if [ "$force" ]; then
+        /sbin/start-stop-daemon $args \
+           --chdir "$PWD" --startas $exec --pidfile /dev/null -- "$@"
+    elif [ $pidfile ]; then
+        /sbin/start-stop-daemon $args \
+           --chdir "$PWD" --exec $exec --oknodo --pidfile "$pidfile" -- "$@"
+    else
+        /sbin/start-stop-daemon $args --chdir "$PWD" --exec $exec -- "$@"
+    fi
+}
+
+pidofproc () {
+    local pidfile base status specified pid OPTIND
+    pidfile=
+    specified=
+    
+    OPTIND=1
+    while getopts p: opt ; do
+        case "$opt" in
+            p)  pidfile="$OPTARG"
+                specified="specified"
+               ;;
+        esac
+    done
+    shift $(($OPTIND - 1))
+    if [ $# -ne 1 ]; then
+        echo "$0: invalid arguments" >&2
+        return 4
+    fi
+
+    base=${1##*/}
+    if [ ! "$specified" ]; then
+        pidfile="/var/run/$base.pid"
+    fi
+
+    if [ -n "${pidfile:-}" ]; then
+     if [ -e "$pidfile" ]; then
+      if [ -r "$pidfile" ]; then
+        read pid < "$pidfile"
+        if [ -n "${pid:-}" ]; then
+            if $(kill -0 "${pid:-}" 2> /dev/null); then
+                echo "$pid" || true
+                return 0
+            elif ps "${pid:-}" >/dev/null 2>&1; then
+                echo "$pid" || true
+                return 0 # program is running, but not owned by this user
+            else
+                return 1 # program is dead and /var/run pid file exists
+            fi
+        fi
+      else
+        return 4 # pid file not readable, hence status is unknown.
+      fi
+     else
+       # pid file doesn't exist, try to find the pid nevertheless
+       if [ -x /bin/pidof ] && [ ! "$specified" ]; then
+         status="0"
+         /bin/pidof -o %PPID -x $1 || status="$?"
+         if [ "$status" = 1 ]; then
+             return 3 # program is not running
+         fi
+         return 0
+       fi
+       return 3 # specified pid file doesn't exist, program probably stopped
+     fi
+    fi
+    if [ "$specified" ]; then
+        return 3 # almost certain it's not running
+    fi
+    return 4 # Unable to determine status
+}
+
+# start-stop-daemon uses the same algorithm as "pidofproc" above.
+killproc () {
+    local pidfile sig status base name_param is_term_sig OPTIND
+    pidfile=
+    name_param=
+    is_term_sig=
+
+    OPTIND=1
+    while getopts p: opt ; do
+        case "$opt" in
+            p)  pidfile="$OPTARG";;
+        esac
+    done
+    shift $(($OPTIND - 1))
+
+    base=${1##*/}
+    if [ ! $pidfile ]; then
+        name_param="--name $base --pidfile /var/run/$base.pid"
+    else
+        name_param="--pidfile $pidfile"
+    fi
+
+    sig=$(echo ${2:-} | sed -e 's/^-\(.*\)/\1/')
+    sig=$(echo $sig | sed -e 's/^SIG\(.*\)/\1/')
+    if [ "$sig" = 15 ] || [ "$sig" = TERM ]; then
+        is_term_sig="terminate_signal"
+    fi
+    status=0
+    if [ ! "$is_term_sig" ]; then
+        if [ -n "$sig" ]; then
+            /sbin/start-stop-daemon --stop --signal "$sig" \
+               --quiet $name_param || status="$?"
+        else
+            /sbin/start-stop-daemon --stop \
+               --retry 5 \
+               --quiet $name_param || status="$?"
+        fi
+    else
+        /sbin/start-stop-daemon --stop --quiet \
+           --oknodo $name_param || status="$?"
+    fi
+    if [ "$status" = 1 ]; then
+        if [ -z "$sig" ]; then
+            return 0
+        fi
+        return 3 # program is not running
+    fi
+
+    if [ "$status" = 0 ] && [ "$is_term_sig" ] && [ "$pidfile" ]; then
+        pidofproc -p "$pidfile" "$1" >/dev/null || rm -f "$pidfile"
+    fi
+    return 0
+}
+
+# Return LSB status
+status_of_proc () {
+    local pidfile daemon name status OPTIND
+
+    pidfile=
+    OPTIND=1
+    while getopts p: opt ; do
+        case "$opt" in
+            p)  pidfile="$OPTARG";;
+        esac
+    done
+    shift $(($OPTIND - 1))
+
+    if [ -n "$pidfile" ]; then
+        pidfile="-p $pidfile"
+    fi
+    daemon="$1"
+    name="$2"
+
+    status="0"
+    pidofproc $pidfile $daemon >/dev/null || status="$?"
+    if [ "$status" = 0 ]; then
+        log_success_msg "$name is running"
+        return 0
+    elif [ "$status" = 4 ]; then
+        log_failure_msg "could not access PID file for $name"
+        return $status
+    else
+        log_failure_msg "$name is not running"
+        return $status
+    fi
+}
+
+log_use_fancy_output () {
+    TPUT=/usr/bin/tput
+    EXPR=/usr/bin/expr
+    if  [ -t 1 ] &&
+       [ "x${TERM:-}" != "x" ] &&
+       [ "x${TERM:-}" != "xdumb" ] &&
+       [ -x $TPUT ] && [ -x $EXPR ] &&
+       $TPUT hpa 60 >/dev/null 2>&1 &&
+       $TPUT setaf 1 >/dev/null 2>&1
+    then
+        [ -z $FANCYTTY ] && FANCYTTY=1 || true
+    else
+        FANCYTTY=0
+    fi
+    case "$FANCYTTY" in
+        1|Y|yes|true)   true;;
+        *)              false;;
+    esac
+}
+
+log_success_msg () {
+    if [ -n "${1:-}" ]; then
+        log_begin_msg $@
+    fi
+    log_end_msg 0
+}
+
+log_failure_msg () {
+    if [ -n "${1:-}" ]; then
+        log_begin_msg $@ "..."
+    fi
+    log_end_msg 1 || true
+}
+
+log_warning_msg () {
+    if [ -n "${1:-}" ]; then
+        log_begin_msg $@ "..."
+    fi
+    log_end_msg 255 || true
+}
+
+#
+# NON-LSB HELPER FUNCTIONS
+#
+# int get_lsb_header_val (char *scriptpathname, char *key)
+get_lsb_header_val () {
+        if [ ! -f "$1" ] || [ -z "${2:-}" ]; then
+                return 1
+        fi
+        LSB_S="### BEGIN INIT INFO"
+        LSB_E="### END INIT INFO"
+        sed -n "/$LSB_S/,/$LSB_E/ s/# $2: \(.*\)/\1/p" $1
+}
+
+# If the currently running init daemon is upstart, return zero; if the
+# calling init script belongs to a package which also provides a native
+# upstart job, it should generally exit non-zero in this case.
+init_is_upstart()
+{
+   if [ -x /sbin/initctl ] && /sbin/initctl version 2>/dev/null | /bin/grep -q upstart; then
+       return 0
+   fi
+   return 1
+}
+
+# int log_begin_message (char *message)
+log_begin_msg () {
+    log_begin_msg_pre "$@"
+    if [ -z "${1:-}" ]; then
+        return 1
+    fi
+    echo -n "$@" || true
+    log_begin_msg_post "$@"
+}
+
+# Sample usage:
+# log_daemon_msg "Starting GNOME Login Manager" "gdm"
+#
+# On Debian, would output "Starting GNOME Login Manager: gdm"
+# On Ubuntu, would output " * Starting GNOME Login Manager..."
+#
+# If the second argument is omitted, logging suitable for use with
+# log_progress_msg() is used:
+#
+# log_daemon_msg "Starting remote filesystem services"
+#
+# On Debian, would output "Starting remote filesystem services:"
+# On Ubuntu, would output " * Starting remote filesystem services..."
+
+log_daemon_msg () {
+    if [ -z "${1:-}" ]; then
+        return 1
+    fi
+    log_daemon_msg_pre "$@"
+
+    if [ -z "${2:-}" ]; then
+        echo -n "$1:" || true
+        return
+    fi
+    
+    echo -n "$1: $2" || true
+    log_daemon_msg_post "$@"
+}
+
+# #319739
+#
+# Per policy docs:
+#
+#     log_daemon_msg "Starting remote file system services"
+#     log_progress_msg "nfsd"; start-stop-daemon --start --quiet nfsd
+#     log_progress_msg "mountd"; start-stop-daemon --start --quiet mountd
+#     log_progress_msg "ugidd"; start-stop-daemon --start --quiet ugidd
+#     log_end_msg 0
+#
+# You could also do something fancy with log_end_msg here based on the
+# return values of start-stop-daemon; this is left as an exercise for
+# the reader...
+#
+# On Ubuntu, one would expect log_progress_msg to be a no-op.
+log_progress_msg () {
+    if [ -z "${1:-}" ]; then
+        return 1
+    fi
+    echo -n " $@" || true
+}
+
+
+# int log_end_message (int exitstatus)
+log_end_msg () {
+    # If no arguments were passed, return
+    if [ -z "${1:-}" ]; then
+        return 1
+    fi
+
+    local retval
+    retval=$1
+
+    log_end_msg_pre "$@"
+
+    # Only do the fancy stuff if we have an appropriate terminal
+    # and if /usr is already mounted
+    if log_use_fancy_output; then
+        RED=$( $TPUT setaf 1)
+        YELLOW=$( $TPUT setaf 3)
+        NORMAL=$( $TPUT op)
+    else
+        RED=''
+        YELLOW=''
+        NORMAL=''
+    fi
+
+    if [ $1 -eq 0 ]; then
+        echo "." || true
+    elif [ $1 -eq 255 ]; then
+        /bin/echo -e " ${YELLOW}(warning).${NORMAL}" || true
+    else
+        /bin/echo -e " ${RED}failed!${NORMAL}" || true
+    fi
+    log_end_msg_post "$@"
+    return $retval
+}
+
+log_action_msg () {
+    log_action_msg_pre "$@"
+    echo "$@." || true
+    log_action_msg_post "$@"
+}
+
+log_action_begin_msg () {
+    log_action_begin_msg_pre "$@"
+    echo -n "$@..." || true
+    log_action_begin_msg_post "$@"
+}
+
+log_action_cont_msg () {
+    echo -n "$@..." || true
+}
+
+log_action_end_msg () {
+    local end
+    log_action_end_msg_pre "$@"
+    if [ -z "${2:-}" ]; then
+        end="."
+    else
+        end=" ($2)."
+    fi
+
+    if [ $1 -eq 0 ]; then
+        echo "done${end}" || true
+    else
+        if log_use_fancy_output; then
+            RED=$( $TPUT setaf 1)
+            NORMAL=$( $TPUT op)
+            /bin/echo -e "${RED}failed${end}${NORMAL}" || true
+        else
+            echo "failed${end}" || true
+        fi
+    fi
+    log_action_end_msg_post "$@"
+}
+
+# Pre&Post empty function declaration, to be overriden from /lib/lsb/init-functions.d/*
+log_daemon_msg_pre () { :; }
+log_daemon_msg_post () { :; }
+log_begin_msg_pre () { :; }
+log_begin_msg_post () { :; }
+log_end_msg_pre () { :; }
+log_end_msg_post () { :; }
+log_action_msg_pre () { :; }
+log_action_msg_post () { :; }
+log_action_begin_msg_pre () { :; }
+log_action_begin_msg_post () { :; }
+log_action_end_msg_pre () { :; }
+log_action_end_msg_post () { :; }
+
+# Include hooks from other packages in /lib/lsb/init-functions.d
+for hook in $(run-parts --lsbsysinit --list /lib/lsb/init-functions.d 2>/dev/null); do
+    [ -r $hook ] && . $hook || true
+done
+
+FANCYTTY=
+[ -e /etc/lsb-base-logging.sh ] && . /etc/lsb-base-logging.sh || true
diff --git a/init-functions.d/20-left-info-blocks b/init-functions.d/20-left-info-blocks
new file mode 100644 (file)
index 0000000..5bd8082
--- /dev/null
@@ -0,0 +1,43 @@
+# Default info blocks put to the left of the screen
+log_daemon_msg_pre () {
+    if log_use_fancy_output; then
+        echo -n "[....] " || true
+    fi
+}
+log_begin_msg_pre () {
+    log_daemon_msg_pre "$@"
+}
+log_end_msg_pre () {
+    if log_use_fancy_output; then
+        RED=$( $TPUT setaf 1)
+        GREEN=$( $TPUT setaf 2)
+        YELLOW=$( $TPUT setaf 3)
+        NORMAL=$( $TPUT op)
+
+        $TPUT civis || true
+        $TPUT sc && \
+        $TPUT hpa 0 && \
+        if [ $1 -eq 0 ]; then
+            /bin/echo -ne "[${GREEN} ok ${NORMAL}" || true
+        elif [ $1 -eq 255 ]; then
+            /bin/echo -ne "[${YELLOW}warn${NORMAL}" || true
+        else
+            /bin/echo -ne "[${RED}FAIL${NORMAL}" || true
+        fi && \
+        $TPUT rc || true
+        $TPUT cnorm || true
+    fi
+}
+log_action_msg_pre () {
+    if log_use_fancy_output; then
+        CYAN=$( $TPUT setaf 6)
+        NORMAL=$( $TPUT op)
+        /bin/echo -ne "[${CYAN}info${NORMAL}] " || true
+    fi
+}
+log_action_begin_msg_pre () {
+    log_daemon_msg_pre "$@"
+}
+log_action_end_msg_pre () {
+    log_end_msg_pre "$@"
+}
diff --git a/init-functions.d/50-ubuntu-logging b/init-functions.d/50-ubuntu-logging
new file mode 100644 (file)
index 0000000..4fdadcf
--- /dev/null
@@ -0,0 +1,141 @@
+# Default init script logging functions suitable for Ubuntu.
+# See /lib/lsb/init-functions for usage help.
+LOG_DAEMON_MSG=""
+
+log_use_plymouth () {
+    if [ "${loop:-n}" = y ]; then
+        return 1
+    fi
+    plymouth --ping >/dev/null 2>&1
+}
+
+log_success_msg () {
+    echo " * $@" || true
+}
+
+log_failure_msg () {
+    if log_use_fancy_output; then
+        RED=`$TPUT setaf 1`
+        NORMAL=`$TPUT op`
+        echo " $RED*$NORMAL $@" || true
+    else
+        echo " * $@" || true
+    fi
+}
+
+log_warning_msg () {
+    if log_use_fancy_output; then
+        YELLOW=`$TPUT setaf 3`
+        NORMAL=`$TPUT op`
+        echo " $YELLOW*$NORMAL $@" || true
+    else
+        echo " * $@" || true
+    fi
+}
+
+log_begin_msg () {
+    log_daemon_msg "$1"
+}
+
+log_daemon_msg () {
+    if [ -z "$1" ]; then
+        return 1
+    fi
+
+    if log_use_fancy_output && $TPUT xenl >/dev/null 2>&1; then
+        COLS=`$TPUT cols`
+        if [ "$COLS" ] && [ "$COLS" -gt 6 ]; then
+            COL=`$EXPR $COLS - 7`
+        else
+            COLS=80
+            COL=73
+        fi
+
+        if log_use_plymouth; then
+            # If plymouth is running, don't output anything at this time
+            # to avoid buffering problems (LP: #752393)
+            if [ -z "$LOG_DAEMON_MSG" ]; then
+                LOG_DAEMON_MSG=$*
+                return
+            fi
+        fi
+
+        # We leave the cursor `hanging' about-to-wrap (see terminfo(5)
+        # xenl, which is approximately right). That way if the script
+        # prints anything then we will be on the next line and not
+        # overwrite part of the message.
+
+        # Previous versions of this code attempted to colour-code the
+        # asterisk but this can't be done reliably because in practice
+        # init scripts sometimes print messages even when they succeed
+        # and we won't be able to reliably know where the colourful
+        # asterisk ought to go.
+
+        printf " * $*       " || true
+        # Enough trailing spaces for ` [fail]' to fit in; if the message
+        # is too long it wraps here rather than later, which is what we
+        # want.
+        $TPUT hpa `$EXPR $COLS - 1` || true
+        printf ' ' || true
+    else
+        echo " * $@" || true
+        COL=
+    fi
+}
+
+log_progress_msg () {
+    :
+}
+
+log_end_msg () {
+    if [ -z "$1" ]; then
+        return 1
+    fi
+
+    if [ "$COL" ] && [ -x "$TPUT" ]; then
+        # If plymouth is running, print previously stored output
+        # to avoid buffering problems (LP: #752393)
+        if log_use_plymouth; then
+            if [ -n "$LOG_DAEMON_MSG" ]; then
+                log_daemon_msg $LOG_DAEMON_MSG
+                LOG_DAEMON_MSG=""
+            fi
+        fi
+
+        printf "\r" || true
+        $TPUT hpa $COL
+        if [ "$1" -eq 0 ]; then
+            echo "[ OK ]" || true
+        else
+            printf '[' || true
+            $TPUT setaf 1 || true # red
+            printf fail || true
+            $TPUT op || true # normal
+            echo ']' || true
+        fi
+    else
+        if [ "$1" -eq 0 ]; then
+            echo "   ...done." || true
+        else
+            echo "   ...fail!" || true
+        fi
+    fi
+    return $1
+}
+
+log_action_msg () {
+    echo " * $@" || true
+}
+
+log_action_begin_msg () {
+    log_daemon_msg "$@..." || true
+}
+
+log_action_cont_msg () {
+    log_daemon_msg "$@..." || true
+}
+
+log_action_end_msg () {
+    # In the future this may do something with $2 as well.
+    log_end_msg "$1" || true
+}
diff --git a/initdutils.py b/initdutils.py
new file mode 100644 (file)
index 0000000..f2e90a8
--- /dev/null
@@ -0,0 +1,173 @@
+# Support for scanning init scripts for LSB info
+
+import re, sys, os
+import pickle
+
+from io import StringIO
+
+class RFC822Parser(dict):
+    "A dictionary-like object."
+    __linere = re.compile(r'([^:]+):\s*(.*)$')
+    
+    def __init__(self, fileob=None, strob=None, startcol=0, basedict=None):
+        if fileob is None and strob is None:
+            raise ValueError('need a file or string')
+        if not basedict:
+            basedict = {}
+        
+        super(RFC822Parser, self).__init__(basedict)
+
+        if not fileob:
+            fileob = StringIO(strob)
+
+        key = None
+        for line in fileob:
+            if startcol:
+                line = line[startcol:]
+
+            if not line.strip():
+                continue
+
+            # Continuation line
+            if line[0].isspace():
+                if not key:
+                    continue
+                self[key] += '\n' + line.strip()
+                continue
+
+            m = self.__linere.match(line)
+            if not m:
+                # Not a valid RFC822 header
+                continue
+            key, value = m.groups()
+            self[key] = value.strip()
+
+# End of RFC882Parser
+
+LSBLIB = '/var/lib/lsb'
+FACILITIES = os.path.join(LSBLIB, 'facilities')
+DEPENDS = os.path.join(LSBLIB, 'depends')
+LSBINSTALL = os.path.join(LSBLIB, 'lsbinstall')
+
+beginre = re.compile(re.escape('### BEGIN INIT INFO'))
+endre = re.compile(re.escape('### END INIT INFO'))
+#linere = re.compile(r'\#\s+([^:]+):\s*(.*)')
+
+def scan_initfile(initfile):
+    headerlines = ''
+    scanning = False
+    
+    for line in open(initfile):
+        line = line.rstrip()
+        if beginre.match(line):
+            scanning = True
+            continue
+        elif scanning and endre.match(line):
+            scanning = False
+            continue
+        elif not scanning:
+            continue
+
+        if line.startswith('# '):
+            headerlines += line[2:] + '\n'
+        elif line.startswith('#\t'):
+            headerlines += line[1:] + '\n'
+
+    inheaders = RFC822Parser(strob=headerlines)
+    headers = {}
+    for header, body in inheaders.items():
+        # Ignore empty headers
+        if not body.strip():
+            continue
+        
+        if header in ('Default-Start', 'Default-Stop'):
+            headers[header] = list(map(int, body.split()))
+        elif header in ('Required-Start', 'Required-Stop', 'Provides',
+                        'Should-Start', 'Should-Stop'):
+            headers[header] = body.split()
+        else:
+            headers[header] = body
+
+    return headers
+
+def save_facilities(facilities):
+    if not facilities:
+        try:
+            os.unlink(FACILITIES)
+        except OSError:
+            pass
+        return
+    
+    fh = open(FACILITIES, 'w')
+    for facility, entries in facilities.items():
+        # Ignore system facilities
+        if facility.startswith('$'): continue
+        for (scriptname, pri) in entries.items():
+            start, stop = pri
+            print("%(scriptname)s %(facility)s %(start)d %(stop)d" % locals(), file=fh)
+    fh.close()
+
+def load_facilities():
+    facilities = {}
+    if os.path.exists(FACILITIES):
+        for line in open(FACILITIES):
+            try:
+                scriptname, name, start, stop = line.strip().split()
+                facilities.setdefault(name, {})[scriptname] = (int(start),
+                                                               int(stop))
+            except ValueError as x:
+                print('Invalid facility line', line, file=sys.stderr)
+
+    return facilities
+
+def load_depends():
+    depends = {}
+
+    if os.path.exists(DEPENDS):
+        independs = RFC822Parser(fileob=open(DEPENDS))
+        for initfile, facilities in independs.items():
+            depends[initfile] = facilities.split()
+    return depends
+
+def save_depends(depends):
+    if not depends:
+        try:
+            os.unlink(DEPENDS)
+        except OSError:
+            pass
+        return
+    
+    fh = open(DEPENDS, 'w')
+    for initfile, facilities in depends.items():
+        print('%s: %s' % (initfile, ' '.join(facilities)), file=fh)
+    fh.close()
+
+# filemap entries are mappings, { (package, filename) : instloc }
+def load_lsbinstall_info():
+    if not os.path.exists(LSBINSTALL):
+        return {}
+    
+    fh = open(LSBINSTALL, 'rb')
+    filemap = cPickle.load(fh)
+    fh.close()
+
+    # Just in case it's corrupted somehow
+    if not isinstance(filemap, dict):
+        return {}
+
+    return filemap
+
+def save_lsbinstall_info(filemap):
+    if not filemap:
+        try:
+            os.unlink(LSBINSTALL)
+        except OSError:
+            pass
+        return
+    
+    fh = open(LSBINSTALL, 'wb')
+    cPickle.dump(fh, filemap)
+    fh.close()
+
+if __name__ == '__main__':
+    print(scan_initfile('init-fragment'))
diff --git a/install_initd b/install_initd
new file mode 100755 (executable)
index 0000000..fdf2ff5
--- /dev/null
@@ -0,0 +1,138 @@
+#!/usr/bin/python3
+
+import sys, re, os, initdutils
+
+if len(sys.argv) > 1:
+    initfile = sys.argv[1]
+    # If the absolute path isn't specified, assume it's relative to
+    # cwd; if that doesn't exist, try /etc/init.d
+    ap = os.path.abspath(initfile)
+    if os.path.exists(ap):
+        initfile = ap
+    else:
+        initfile = os.path.join('/etc/init.d', initfile)
+else:
+    print('Usage: %s /etc/init.d/<init-script>' % sys.argv[0], file=sys.stderr)
+    sys.exit(1)
+
+# Default priorities
+startpri = stoppri = 20
+defstart = [2, 3, 4, 5]
+defstop = [0, 1, 6]
+
+# Estimated priorities of these facilities in Debian
+os_facilities = {
+    "$local_fs" : {'lsb' : (0, 100)},
+    "$network" : {'lsb' : (10, 50)},
+    "$remote_fs" : {'lsb': (19, 20)},
+    "$named" : {'lsb': (19, 19)},
+    "$syslog" : {'lsb' : (10, 89)},
+    # No longer present in gLSB 1.2; however, required for gLSB 1.1
+    # compat.  Note that these are looser than $portmap and $time;
+    # anything specifying $netdaemons will be run later, which may not
+    # be what you want...
+    "$netdaemons" : {'lsb': (80, 19)},
+    # gLSB 1.2
+    "$portmap" : {'lsb' : (19, 34)},
+    "$time" : {'lsb' : (24, 21)},
+    }
+
+facilities = initdutils.load_facilities()
+facilities.update(os_facilities)
+
+depends = initdutils.load_depends()
+depends[initfile] = []
+
+headers = initdutils.scan_initfile(initfile)
+
+reqstart = headers.get('Required-Start', [])
+shouldstart = headers.get('Should-Start', [])
+if reqstart or shouldstart:
+    startpri = 5
+    for facility in reqstart:
+        if facility not in facilities:
+            print('Missing required start facility', facility, file=sys.stderr)
+            sys.exit(1)
+        else:
+            for script, pri in facilities[facility].items():
+                if script != initfile:
+                    start, stop = pri
+                    startpri = max(startpri, start+1)
+            if facility not in depends[initfile]:
+                depends[initfile].append(facility)
+    
+    for facility in shouldstart:
+        if facility not in facilities:
+            print('Missing should-start facility', facility, '(ignored)', file=sys.stderr)
+        else:
+            for script, pri in facilities[facility].items():
+                if script != initfile:
+                    start, stop = pri
+                    startpri = max(startpri, start+1)
+    startpri = min(max(startpri, 1), 99)
+
+reqstop = headers.get('Required-Stop', [])
+shouldstop = headers.get('Should-Stop', [])
+if reqstop or shouldstop:
+    stoppri = 95
+    for facility in reqstop:
+        if facility not in facilities:
+            print('Missing required stop facility', facility, file=sys.stderr)
+            sys.exit(1)
+        else:
+            for script, pri in facilities[facility].items():
+                if script != initfile:
+                    start, stop = pri
+                    stoppri = min(stoppri, stop-1)
+            if facility not in depends[initfile]:
+                depends[initfile].append(facility)
+
+    for facility in shouldstop:
+        if facility not in facilities:
+            print('Missing should-stop facility', facility, '(ignored)', file=sys.stderr)
+        else:
+            for script, pri in facilities[facility].items():
+                if script != initfile:
+                    start, stop = pri
+                    stoppri = min(stoppri, stop-1)
+
+    stoppri = min(max(stoppri, 1), 99)
+
+if depends[initfile]:
+    initdutils.save_depends(depends)
+
+provides = headers.get('Provides', [])
+if provides:
+    for facility in provides:
+        if facility[0] == '$':
+            print('Ignoring system-provided facility', facility, file=sys.stderr)
+            continue
+        if facility not in facilities:
+            facilities[facility] = {}
+
+        facilities[facility][initfile] = (startpri, stoppri)
+    initdutils.save_facilities(facilities)
+
+defstart = headers.get('Default-Start', defstart)
+defstop = headers.get('Default-Stop', defstop)
+
+# A set type would be nice... [range(2,6) = 2..5]
+for level in range(2,6):
+    if level in defstart:
+        for i in range(2,6):
+            if i not in defstart:
+                defstart.append(i)
+    if level in defstop:
+        for i in range(2,6):
+            if i not in defstop:
+                defstop.append(i)
+
+defstart.sort()
+defstop.sort()
+
+start_runlevels = " ".join(map(str, defstart))
+stop_runlevels = " ".join(map(str, defstop))
+
+initfile = initfile.replace('/etc/init.d/', '')
+
+os.system("/usr/sbin/update-rc.d %(initfile)s start %(startpri)d %(start_runlevels)s . stop %(stoppri)d %(stop_runlevels)s ." % locals())
diff --git a/lsb.8 b/lsb.8
new file mode 100644 (file)
index 0000000..12a1494
--- /dev/null
+++ b/lsb.8
@@ -0,0 +1,35 @@
+.\"                                      Hey, EMACS: -*- nroff -*-
+.\" First parameter, NAME, should be all caps
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
+.\" other parameters are allowed: see man(7), man(1)
+.TH lsb 8 "2002-02-24"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh        disable hyphenation
+.\" .hy        enable hyphenation
+.\" .ad l      left justify
+.\" .ad b      justify to both left and right margins
+.\" .nf        disable filling
+.\" .fi        enable filling
+.\" .br        insert line break
+.\" .sp <n>    insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+lsb \- Linux Standard Base support for Debian
+.SH DESCRIPTION
+The \fBlsb\fP package provides infrastructure for installing Linux
+Standard Base applications on Debian.  This manual page is designed to
+refer system adminstrators and others to the documentation available.
+.PP
+The Linux Standard Base is a common runtime environment for
+third-party packages.  The goal of the LSB is to make it easy to
+create binary packages that will run on any Linux distribution.  For
+more information on the standard, please see the LSB web site.
+.SH SEE ALSO
+.BR /usr/share/doc/lsb-core/README.Debian.gz
+.BR http://www.linuxbase.org/
+.BR http://refspecs.linuxbase.org/lsb.shtml
+.SH AUTHOR
+This manual page was written by Chris Lawrence <lawrencc@debian.org>
+for the Debian system (but may be used by others).
diff --git a/lsb_release b/lsb_release
new file mode 100755 (executable)
index 0000000..433d5a5
--- /dev/null
@@ -0,0 +1,95 @@
+#!/usr/bin/python3 -Es
+
+# lsb_release command for Debian
+# (C) 2005-10 Chris Lawrence <lawrencc@debian.org>
+
+#    This package is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation; version 2 dated June, 1991.
+
+#    This package is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+
+#    You should have received a copy of the GNU General Public License
+#    along with this package; if not, write to the Free Software
+#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+#    02110-1301 USA
+
+from optparse import OptionParser
+import sys
+import os
+import re
+
+import lsb_release
+
+def main():
+    parser = OptionParser()
+    parser.add_option('-v', '--version', dest='version', action='store_true',
+                      default=False,
+                      help="show LSB modules this system supports")
+    parser.add_option('-i', '--id', dest='id', action='store_true',
+                      default=False,
+                      help="show distributor ID")
+    parser.add_option('-d', '--description', dest='description',
+                      default=False, action='store_true',
+                      help="show description of this distribution")
+    parser.add_option('-r', '--release', dest='release',
+                      default=False, action='store_true',
+                      help="show release number of this distribution")
+    parser.add_option('-c', '--codename', dest='codename',
+                      default=False, action='store_true',
+                      help="show code name of this distribution")
+    parser.add_option('-a', '--all', dest='all',
+                      default=False, action='store_true',
+                      help="show all of the above information")
+    parser.add_option('-s', '--short', dest='short',
+                      action='store_true', default=False,
+                      help="show requested information in short format")
+    
+    (options, args) = parser.parse_args()
+    if args:
+        parser.error("No arguments are permitted")
+
+    short = (options.short)
+    none = not (options.all or options.version or options.id or
+                options.description or options.codename or options.release)
+
+    distinfo = lsb_release.get_distro_information()
+
+    if none or options.all or options.version:
+        verinfo = lsb_release.check_modules_installed()
+        if not verinfo:
+            print("No LSB modules are available.", file=sys.stderr)
+        elif short:
+            print(':'.join(verinfo))
+        else:
+            print('LSB Version:\t' + ':'.join(verinfo))
+
+    if options.id or options.all:
+        if short:
+            print(distinfo.get('ID', 'n/a'))
+        else:
+            print('Distributor ID:\t%s' % distinfo.get('ID', 'n/a'))
+
+    if options.description or options.all:
+        if short:
+            print(distinfo.get('DESCRIPTION', 'n/a'))
+        else:
+            print('Description:\t%s' % distinfo.get('DESCRIPTION', 'n/a'))
+
+    if options.release or options.all:
+        if short:
+            print(distinfo.get('RELEASE', 'n/a'))
+        else:
+            print('Release:\t%s' % distinfo.get('RELEASE', 'n/a'))
+
+    if options.codename or options.all:
+        if short:
+            print(distinfo.get('CODENAME', 'n/a'))
+        else:
+            print('Codename:\t%s' % distinfo.get('CODENAME', 'n/a'))
+
+if __name__ == '__main__':
+    main()
diff --git a/lsb_release.1 b/lsb_release.1
new file mode 100644 (file)
index 0000000..b75ecb5
--- /dev/null
@@ -0,0 +1,60 @@
+.TH lsb_release 1
+.SH NAME
+lsb_release \- print distribution-specific information
+.SH SYNOPSIS
+.B lsb_release
+.I "[options]"
+.SH DESCRIPTION
+The
+.B lsb_release
+command provides certain LSB (Linux Standard Base) and
+distribution-specific information.
+.PP
+If no options are given, the \fI\-v\fP option is assumed.
+.SH OPTIONS
+The program follows the usual GNU command line syntax, with long
+options starting with two dashes (`\-\-').
+A summary of options are included below.
+.TP
+.B \-v, \-\-version
+Show the version of the LSB against which your current installation is
+compliant.  The version is expressed as a colon separated list of LSB
+module descriptions.
+.TP
+.B \-i, \-\-id
+Display the distributor's ID.
+.TP
+.B \-d, \-\-description
+Display a description of the currently installed distribution.
+.TP
+.B \-r, \-\-release
+Display the release number of the currently installed distribution.
+.TP
+.B \-c, \-\-codename
+Display the code name of the currently installed distribution.
+.TP
+.B \-a, \-\-all
+Display all of the above information.
+.TP
+.B \-s, \-\-short
+Use the short output format for any information displayed.  This
+format omits the leading header(s).
+.TP
+.B \-h, \-\-help
+Show summary of options.
+.SH NOTES
+This is a reimplementation of the 
+.B lsb_release
+command provided by the Free Standards Group.  Any bugs are solely the
+responsibility of the author below.
+
+Detection of systems using a mix of packages from various distributions
+or releases is something of a black art; the current heuristic tends
+to assume that the installation is of the earliest distribution which
+is still being used by
+.B apt
+but that heuristic is subject to error.
+.SH "SEE ALSO"
+lsb(8)
+.SH AUTHOR
+Chris Lawrence <lawrencc@debian.org>.
diff --git a/lsb_release.py b/lsb_release.py
new file mode 100644 (file)
index 0000000..0c4b078
--- /dev/null
@@ -0,0 +1,352 @@
+#!/usr/bin/python
+
+# LSB release detection module for Debian
+# (C) 2005-10 Chris Lawrence <lawrencc@debian.org>
+
+#    This package is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation; version 2 dated June, 1991.
+
+#    This package is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+
+#    You should have received a copy of the GNU General Public License
+#    along with this package; if not, write to the Free Software
+#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+#    02110-1301 USA
+
+# Python3-compatible print() function
+from __future__ import print_function
+
+import sys
+import subprocess
+import os
+import re
+import warnings
+import csv
+
+def get_distro_info(origin='Debian'):
+    try:
+        csvfile = open('/usr/share/distro-info/%s.csv' % origin.lower())
+    except FileNotFoundError:
+        # Unknown distro, fallback to Debian
+        csvfile = open('/usr/share/distro-info/debian.csv')
+
+    reader = csv.DictReader(csvfile)
+    global RELEASE_CODENAME_LOOKUP, RELEASES_ORDER, TESTING_CODENAME
+    RELEASE_CODENAME_LOOKUP = { r['version']: r['series'] for r in reader if r['version']}
+    RELEASES_ORDER = list(RELEASE_CODENAME_LOOKUP.items())
+    RELEASES_ORDER.sort(key=lambda n: float(n[0]))
+    RELEASES_ORDER = list(list(zip(*RELEASES_ORDER))[1])
+
+    if origin.lower() == 'debian':
+        TESTING_CODENAME = 'unknown.new.testing'
+        RELEASES_ORDER.extend(['stable', 'proposed-updates', 'testing', 'testing-proposed-updates', 'unstable', 'sid'])
+
+    csvfile.close()
+
+# Populate default distro info
+get_distro_info()
+
+def lookup_codename(release, unknown=None):
+    m = re.match(r'(\d+)\.(\d+)(r(\d+))?', release)
+    if not m:
+        return unknown
+
+    if int(m.group(1)) < 7:
+        shortrelease = '%s.%s' % m.group(1,2)
+    else:
+        shortrelease = '%s' % m.group(1)
+    return RELEASE_CODENAME_LOOKUP.get(shortrelease, unknown)
+
+def valid_lsb_versions(version, module):
+    # If a module is ever released that only appears in >= version, deal
+    # with that here
+    if version == '3.0':
+        return ['2.0', '3.0']
+    elif version == '3.1':
+        if module in ('desktop', 'qt4'):
+            return ['3.1']
+        elif module == 'cxx':
+            return ['3.0', '3.1']
+        else:
+            return ['2.0', '3.0', '3.1']
+    elif version == '3.2':
+        if module == 'desktop':
+            return ['3.1', '3.2']
+        elif module == 'qt4':
+            return ['3.1']
+        elif module in ('printing', 'languages', 'multimedia'):
+            return ['3.2']
+        elif module == 'cxx':
+            return ['3.0', '3.1', '3.2']
+        else:
+            return ['2.0', '3.0', '3.1', '3.2']
+    elif version == '4.0':
+        if module == 'desktop':
+            return ['3.1', '3.2', '4.0']
+        elif module == 'qt4':
+            return ['3.1']
+        elif module in ('printing', 'languages', 'multimedia'):
+            return ['3.2', '4.0']
+        elif module == 'security':
+            return ['4.0']
+        elif module == 'cxx':
+            return ['3.0', '3.1', '3.2', '4.0']
+        else:
+            return ['2.0', '3.0', '3.1', '3.2', '4.0']
+    elif version == '4.1':
+        if module == 'desktop':
+            return ['3.1', '3.2', '4.0', '4.1']
+        elif module == 'qt4':
+            return ['3.1']
+        elif module in ('printing', 'languages', 'multimedia'):
+            return ['3.2', '4.0', '4.1']
+        elif module == 'security':
+            return ['4.0', '4.1']
+        elif module == 'cxx':
+            return ['3.0', '3.1', '3.2', '4.0', '4.1']
+        else:
+            return ['2.0', '3.0', '3.1', '3.2', '4.0', '4.1']
+
+
+    return [version]
+
+try:
+    set # introduced in 2.4
+except NameError:
+    import sets
+    set = sets.Set
+
+# This is Debian-specific at present
+def check_modules_installed():
+    return []
+
+longnames = {'v' : 'version', 'o': 'origin', 'a': 'suite',
+             'c' : 'component', 'l': 'label'}
+
+def parse_policy_line(data):
+    retval = {}
+    bits = data.split(',')
+    for bit in bits:
+        kv = bit.split('=', 1)
+        if len(kv) > 1:
+            k, v = kv[:2]
+            if k in longnames:
+                retval[longnames[k]] = v
+    return retval
+
+def release_index(x):
+    suite = x[1].get('suite')
+    if suite:
+        if suite in RELEASES_ORDER:
+            return int(len(RELEASES_ORDER) - RELEASES_ORDER.index(suite))
+        else:
+            try:
+                return float(suite)
+            except ValueError:
+                return 0
+    return 0
+
+def compare_release(x, y):
+    warnings.warn('compare_release(x,y) is deprecated; please use the release_index(x) as key for sort() instead.', DeprecationWarning, stacklevel=2)
+    suite_x_i = release_index(x)
+    suite_y_i = release_index(y)
+    
+    try:
+        return suite_x_i - suite_y_i
+    except TypeError:
+        return (suite_x_i > suite_y_i) - (suite_x_i < suite_y_i)
+
+def parse_apt_policy():
+    data = []
+    
+    C_env = os.environ.copy(); C_env['LC_ALL'] = 'C.UTF-8'
+    policy = subprocess.Popen(['apt-cache','policy'],
+                              env=C_env,
+                              stdout=subprocess.PIPE,
+                              stderr=subprocess.PIPE,
+                              close_fds=True).communicate()[0].decode('utf-8')
+    for line in policy.split('\n'):
+        line = line.strip()
+        m = re.match(r'(-?\d+)', line)
+        if m:
+            priority = int(m.group(1))
+        if line.startswith('release'):
+            bits = line.split(' ', 1)
+            if len(bits) > 1:
+                data.append( (priority, parse_policy_line(bits[1])) )
+
+    return data
+
+def guess_release_from_apt(origin='Debian', component='main',
+                           ignoresuites=('experimental'),
+                           label='Debian',
+                           alternate_olabels={'Debian Ports': ('ftp.ports.debian.org', 'ftp.debian-ports.org')}):
+    releases = parse_apt_policy()
+
+    if not releases:
+        return None
+
+    # We only care about the specified origin, component, and label
+    releases = [x for x in releases if (
+        x[1].get('origin', '') == origin and
+        x[1].get('suite', '') not in ignoresuites and
+        x[1].get('component', '') == component and
+        x[1].get('label', '') == label) or (
+        x[1].get('origin', '') in alternate_olabels and
+        x[1].get('label', '') in alternate_olabels.get(x[1].get('origin', '')))]
+
+    # Check again to make sure we didn't wipe out all of the releases
+    if not releases:
+        return None
+    
+    releases.sort(key=lambda tuple: tuple[0],reverse=True)
+
+    # We've sorted the list by descending priority, so the first entry should
+    # be the "main" release in use on the system
+
+    max_priority = releases[0][0]
+    releases = [x for x in releases if x[0] == max_priority]
+    releases.sort(key=release_index)
+
+    return releases[0][1]
+
+def guess_debian_release():
+    distinfo = {}
+
+    distinfo['ID'] = 'Debian'
+    # Use /etc/dpkg/origins/default to fetch the distribution name
+    etc_dpkg_origins_default = os.environ.get('LSB_ETC_DPKG_ORIGINS_DEFAULT','/etc/dpkg/origins/default')
+    if os.path.exists(etc_dpkg_origins_default):
+        try:
+            with open(etc_dpkg_origins_default) as dpkg_origins_file:
+                for line in dpkg_origins_file:
+                    try:
+                        (header, content) = line.split(': ', 1)
+                        header = header.lower()
+                        content = content.strip()
+                        if header == 'vendor':
+                            distinfo['ID'] = content
+                    except ValueError:
+                        pass
+        except IOError as msg:
+            print('Unable to open ' + etc_dpkg_origins_default + ':', str(msg), file=sys.stderr)
+
+    # Populate RELEASES_ORDER for the correct distro
+    get_distro_info(distinfo['ID'])
+
+    kern = os.uname()[0]
+    if kern in ('Linux', 'Hurd', 'NetBSD'):
+        distinfo['OS'] = 'GNU/'+kern
+    elif kern == 'FreeBSD':
+        distinfo['OS'] = 'GNU/k'+kern
+    elif kern in ('GNU/Linux', 'GNU/kFreeBSD'):
+        distinfo['OS'] = kern
+    else:
+        distinfo['OS'] = 'GNU'
+
+    distinfo['DESCRIPTION'] = '%(ID)s %(OS)s' % distinfo
+
+    etc_debian_version = os.environ.get('LSB_ETC_DEBIAN_VERSION','/etc/debian_version')
+    if os.path.exists(etc_debian_version):
+        try:
+            with open(etc_debian_version) as debian_version:
+                release = debian_version.read().strip()
+        except IOError as msg:
+            print('Unable to open ' + etc_debian_version + ':', str(msg), file=sys.stderr)
+            release = 'unknown'
+            
+        if not release[0:1].isalpha():
+            # /etc/debian_version should be numeric
+            codename = lookup_codename(release, 'n/a')
+            distinfo.update({ 'RELEASE' : release, 'CODENAME' : codename })
+        elif release.endswith('/sid'):
+            if release.rstrip('/sid').lower() != 'testing':
+                global TESTING_CODENAME
+                TESTING_CODENAME = release.rstrip('/sid')
+            distinfo['RELEASE'] = 'testing/unstable'
+        else:
+            distinfo['RELEASE'] = release
+
+    # Only use apt information if we did not get the proper information
+    # from /etc/debian_version or if we don't have a codename
+    # (which will happen if /etc/debian_version does not contain a
+    # number but some text like 'testing/unstable' or 'lenny/sid')
+    #
+    # This is slightly faster and less error prone in case the user
+    # has an entry in his /etc/apt/sources.list but has not actually
+    # upgraded the system.
+    if not distinfo.get('CODENAME'):
+      rinfo = guess_release_from_apt()
+      if rinfo:
+        release = rinfo.get('version')
+
+        # Special case Debian-Ports as their Release file has 'version': '1.0'
+        if release == '1.0' and rinfo.get('origin') == 'Debian Ports' and rinfo.get('label') in ('ftp.ports.debian.org', 'ftp.debian-ports.org'):
+            release = None
+            rinfo.update({'suite': 'unstable'})
+
+        if release:
+            codename = lookup_codename(release, 'n/a')
+        else:
+            release = rinfo.get('suite', 'unstable')
+            if release == 'testing':
+                # Would be nice if I didn't have to hardcode this.
+                codename = TESTING_CODENAME
+            else:
+                codename = 'sid'
+        distinfo.update({ 'RELEASE' : release, 'CODENAME' : codename })
+
+    if distinfo.get('RELEASE'):
+        distinfo['DESCRIPTION'] += ' %(RELEASE)s' % distinfo
+    if distinfo.get('CODENAME'):
+        distinfo['DESCRIPTION'] += ' (%(CODENAME)s)' % distinfo
+
+    return distinfo
+
+# Whatever is guessed above can be overridden in /etc/lsb-release
+def get_lsb_information():
+    distinfo = {}
+    etc_lsb_release = os.environ.get('LSB_ETC_LSB_RELEASE','/etc/lsb-release')
+    if os.path.exists(etc_lsb_release):
+        try:
+            with open(etc_lsb_release) as lsb_release_file:
+                for line in lsb_release_file:
+                    line = line.strip()
+                    if not line:
+                        continue
+                    # Skip invalid lines
+                    if not '=' in line:
+                        continue
+                    var, arg = line.split('=', 1)
+                    if var.startswith('DISTRIB_'):
+                        var = var[8:]
+                        if arg.startswith('"') and arg.endswith('"'):
+                            arg = arg[1:-1]
+                        if arg: # Ignore empty arguments
+                            distinfo[var] = arg.strip()
+        except IOError as msg:
+            print('Unable to open ' + etc_lsb_release + ':', str(msg), file=sys.stderr)
+            
+    return distinfo
+
+def get_distro_information():
+    lsbinfo = get_lsb_information()
+    # OS is only used inside guess_debian_release anyway
+    for key in ('ID', 'RELEASE', 'CODENAME', 'DESCRIPTION',):
+        if key not in lsbinfo:
+            distinfo = guess_debian_release()
+            distinfo.update(lsbinfo)
+            return distinfo
+    else:
+        return lsbinfo
+
+def test():
+    print(get_distro_information())
+    print(check_modules_installed())
+
+if __name__ == '__main__':
+    test()
diff --git a/lsbinstall b/lsbinstall
new file mode 100755 (executable)
index 0000000..4ae66f6
--- /dev/null
@@ -0,0 +1,271 @@
+#!/usr/bin/python3
+
+import sys
+import os
+import shutil
+import socket
+import subprocess
+from tempfile import NamedTemporaryFile
+from initdutils import load_lsbinstall_info, save_lsbinstall_info
+
+# These keep getting revised... *sigh*
+objecttypes = (
+    #'init',
+    'profile',
+    'service',
+    'inet', # XXX - reenable when implemented
+    #'crontab',
+    #'man'
+    )
+
+def installed_message(objectname):
+    print(objectname, 'is installed')
+
+def handle_generic_install(options, args, location, showinstloc=False):
+    filename = args[0]
+    basename = os.path.basename(filename)
+    instloc = os.path.join(location, basename)
+    package = args.package
+
+    filemap = load_lsbinstall_info()
+    fileinfo = filemap.get((package, filename))
+    
+    if options.check:
+        if fileinfo and os.path.exists(fileinfo):
+            installed_message(fileinfo)
+            return
+        else:
+            sys.exit(1)
+    elif options.remove:
+        if os.path.exists(fileinfo):
+            try:
+                os.unlink(fileinfo)
+            except OSError as why:
+                print('Removal of %s failed: %s' % (
+                    instloc, str(why)), file=sys.stderr)
+                sys.exit(1)
+
+        # Remove it from the database, even if it was previously removed
+        del filemap[(package, filename)]
+        save_lsbinstall_info(filemap)
+        return
+
+    if os.path.exists(instloc) and options.package:
+        instloc = os.path.join(location, '%s.%s' % (options.package, basename))
+
+    if os.path.exists(instloc):
+        print('Unable to install %s: %s exists' % (
+            filename, instloc), file=sys.stderr)
+        sys.exit(1)
+
+    if not os.path.exists(location):
+        try:
+            os.makedirs(location)
+        except OSError as why:
+            print('Unable to create %s to install %s: %s' % (
+                location, filename, str(why)), file=sys.stderr)
+            sys.exit(1)
+        
+    try:
+        shutil.copy2(filename, instloc)
+    except (IOError, os.error) as why:
+        print('Installation of %s as %s failed: %s' % (
+            filename, instloc, str(why)), file=sys.stderr)
+        sys.exit(1)
+        
+    if showinstloc:
+        print(instloc)
+
+    filemap[(package, filename)] = instloc
+    save_lsbinstall_info(filemap)
+
+def handle_service(options, args):
+    # LSB says we don't actually have to remove these things...
+    if options.remove:
+        sys.exit(0)
+
+    pkg = options.package or '<unknown package>'
+
+    try:
+        pproto = args[0]
+        port, proto = pproto.split('/', 1)
+        port = int(port)
+    except ValueError:
+        print('You must specify a port/protocol pair as the first argument.', file=sys.stderr)
+        sys.exit(2)
+
+    if options.check:
+        try:
+            serv = socket.getservbyport(port, proto)
+        except socket.error:
+            sys.exit(1)
+
+        print('%d/%s corresponds to service %s' % (port, proto, serv))
+        return
+
+    sname = args[1]
+    saliases = args[2:]
+
+    try:
+        serv = socket.getservbyport(port, proto)
+    except socket.error:
+        serv = None
+
+    if serv:
+        # Editing existing service
+        fpin = open('/etc/services')
+        fpout = NamedTemporaryFile('w', prefix='services-', dir='/etc')
+        newfname = fpout.name
+
+        for line in fpin:
+            line = line.rstrip()
+            if not line.startswith('#'):
+                lcomment = ''
+                if '#' in line:
+                    line, lcomment = line.split('#', 1)
+                
+                bits = line.split(None, 2)
+                lname, lpproto = bits[:2]
+                laliases = []
+                if len(bits) > 2:
+                    laliases = bits[2].split()
+
+                lport, lproto = lpproto.split('/')
+                lport = int(lport)
+
+                if lport == port and lproto == proto:
+                    # We've found the right line
+                    if name != lname:
+                        aliases += [name]
+
+                    for a in aliases:
+                        if a != lname and a not in laliases:
+                            laliases += [a]
+                elif name == lname or name in laliases:
+                    # name shows up, but in wrong protocol/port
+                    print('Conflict between specified addition and /etc/services; aborting.', file=sys.stderr)
+                    fpout.close()
+                    os.unlink(newfname)
+                    sys.exit(1)
+
+                endbits = ''
+                if laliases:
+                    endbits = ' '.join(laliases) + ' '
+                if lcomment:
+                    endbits += '#'+lcomment
+                    
+                line = '%15s %15s %s' % lname, lpproto, endbits
+                line = line.rstrip()
+
+            print(line, file=fpout)
+        
+        fpin.close()
+        fpout.close()
+        # Make sure /etc/services is always available
+        shutil.copy2('/etc/services', '/etc/services~')
+        os.rename(newfname, '/etc/services')
+        return
+
+    fp = open('/etc/services', 'a')
+    print('%15s %15s %s # Added by lsbinstall for %s' % (
+        sname, pproto, ' '.join(saliases), pkg), file=fp)
+    fp.close()
+
+def handle_inet(options, args, parser):
+    cmd = 'update-inetd --group LSB '
+
+    alist = list(args[0].split(':'))
+    if len(alist) < 2:
+        parser.error("The operand must include a service and protocol.")
+        return
+    
+    if not alist[1]:
+        alist[1] = 'tcp'
+    
+    if options.remove:
+        parts = r'%s\s+.*\s+%s\s+.*' % (re.escape(alist[0], alist[1]))
+        cmd += '--remove '+subprocess.mkarg(parts)
+    elif options.check:
+        return
+    else:
+        if len(alist) != 6:
+            parser.error('The operand must have six colon-separated arguments.')
+            return
+        newalist = [alist[0], alist[2], alist[1]] + alist[3:]
+        cmd += '--add '+subprocess.mkarg('\t'.join(newalist))
+
+    os.system(cmd)
+    pass
+
+def handle_man(options, args):
+    # Try to figure out the man page section
+    section = 1
+    
+    location = '/usr/local/share/man/man%d/' % section
+
+    handle_generic_install(options, args, location)
+
+
+def main():
+    from optparse import OptionParser
+
+    parser = OptionParser('usage: %prog [-r|-c] -t TYPE arguments...')
+    parser.add_option('-c', '--check', dest="check", default=False,
+                      action="store_true", help='check whether or not an '
+                      'object of this type is already installed')
+    parser.add_option('-r', '--remove', action="store_true",
+                      dest="remove", default=False,
+                      help='remove the named object')
+    parser.add_option('-t', '--type', dest="type", type='choice',
+                      default=None, choices=objecttypes,
+                      help='type of object to be '
+                      'installed: one of %s' % ', '.join(objecttypes) )
+    parser.add_option('-p', '--package', dest="package", default=None,
+                      help='LSB package to operate on')
+
+    (options, args) = parser.parse_args()
+
+    if len(args) < 1:
+        parser.error('You must specify at least one argument.')
+    elif (options.remove or options.check) and len(args) > 1:
+        parser.error('You may only specify one argument with --check or '
+                     '--remove.')
+
+    if not options.type:
+        parser.error('You must specify an object type.')
+
+    if not options.package and options.type not in ['service']:
+        parser.error('You must specify a package with %s objects.' %
+                     options.type)
+
+    if options.type == 'init':
+        if len(args) > 1:
+            parser.error('Only one argument supported for %s' % options.type)
+        handle_generic_install(options, args, '/etc/init.d', showinstloc=True)
+    elif options.type == 'profile':
+        if len(args) > 1:
+            parser.error('Only one argument supported for %s' % options.type)
+        # profile.d does nothing on Debian... sigh
+        handle_generic_install(options, args, '/etc/profile.d')
+    elif options.type == 'service':
+        if len(args) < 2 and not (options.remove or options.check):
+            parser.error('You must specify at least two arguments when adding a service entry.')
+        elif len(args) != 1 and (options.remove or options.check):
+            parser.error('You must specify one argument when removing or checking a service entry.')
+        handle_service(options, args)
+    elif options.type == 'inet':
+        handle_inet(options, args, parser)
+    elif options.type == 'crontab':
+        if len(args) > 1:
+            parser.error('Only one argument supported for %s' % options.type)
+        handle_generic_install(options, args, '/etc/cron.d')
+    elif options.type == 'man':
+        if len(args) > 1:
+            parser.error('Only one argument supported for %s' % options.type)
+        handle_man(options, args)
+    else:
+        print('Unsupported type %s' % options.type, file=sys.stderr)
+        sys.exit(1)
+
+if __name__ == '__main__':
+    main()
diff --git a/remove_initd b/remove_initd
new file mode 100755 (executable)
index 0000000..2eaa440
--- /dev/null
@@ -0,0 +1,49 @@
+#!/usr/bin/python3
+
+import sys, re, os, initdutils
+
+if len(sys.argv) > 1:
+    initfile = sys.argv[1]
+    # If the absolute path isn't specified, assume it's relative to
+    # cwd; if that doesn't exist, try /etc/init.d
+    ap = os.path.abspath(initfile)
+    if os.path.exists(ap):
+        initfile = ap
+    else:
+        initfile = os.path.join('/etc/init.d', initfile)
+else:
+    print('Usage: %s /etc/init.d/<init-script>' % sys.argv[0], file=sys.stderr)
+    sys.exit(1)
+
+headers = initdutils.scan_initfile(initfile)
+
+provides = headers.get('Provides')
+if provides:
+    facilities = initdutils.load_facilities()
+    depends = initdutils.load_depends()
+
+    for facility in provides:
+        if facility in facilities:
+            entries = {}
+            for entry in facilities[facility].items():
+                if entry[0] != initfile:
+                    entries[entry[0]] = entry[1]
+            facilities[facility] = entries
+
+    for (initscript, needed) in depends.items():
+        for facility in needed:
+            if facility[0] == "$":
+                continue
+            if not facilities.get(facility) and facility in provides:
+                print('Unable to remove %s: %s needs %s\n' % (
+                    initfile, initscript, facility), file=sys.stderr)
+                sys.exit(1)
+
+    if initfile in depends:
+        del depends[initfile]
+        initdutils.save_depends(depends)
+
+    initdutils.save_facilities(facilities)
+
+initfile = initfile.replace('/etc/init.d/', '')
+os.system('/usr/sbin/update-rc.d -f %s remove' % initfile)
diff --git a/sendmail b/sendmail
new file mode 100644 (file)
index 0000000..259b86b
--- /dev/null
+++ b/sendmail
@@ -0,0 +1,3 @@
+#!/bin/sh
+echo "Please install an MTA on this system if you want to use sendmail!" >&2
+exit 255
diff --git a/test/apt-cache b/test/apt-cache
new file mode 100755 (executable)
index 0000000..eb503a5
--- /dev/null
@@ -0,0 +1,59 @@
+#!/usr/bin/python3
+# coding=utf-8
+
+# Fake apt-cache python script to emulate policy output for test usage
+
+import sys
+import os
+
+if len(sys.argv) <= 1 or sys.argv[1] != 'policy':
+       sys.exit("Shall only be run with exactly one argument: 'policy'")
+
+print("Package files:")
+print(" 100 /var/lib/dpkg/status")
+print("     release a=now")
+
+if os.environ.get('TEST_APT_CACHE1') == '932':
+       print(' 932 http://Mirror_is_not_read/folder-either-debian/ sid/main arch Packages')
+       print('     release o=oRigIn,a=SuiTe,n=codename-not-read,l=lABel,c=C0mp0nent')
+       print('     origin Mirror-is-not-read')
+
+if os.environ.get('TEST_APT_CACHE2') == '600':
+       print('600  http://MirRor_is_not_read/folder-either-debian/ sid/main arch Packages')
+       print('     release o=0RigIn,a=5uiTe,n=codename-not-read,l=1ABel,c=C03p0nent')
+       print('     origin MirRor-is-not-read')
+
+if os.environ.get('TEST_APT_CACHE3') == '754':
+       print(' 754 http://MirRor_is_not_read/folder-either-debian/ sid/main arch Packages')
+       print('     release o=Jérôme Helvète,a=5uiTe,n=codename-not-read,l=1ABel,c=C03p0nent')
+       print('     origin MirRor-is-not-read')
+
+if os.environ.get('TEST_APT_CACHE_RELEASE') == '512':
+       print(' 512 http://MirRor_is_not_read/folder-either-debian/ sid/main arch Packages')
+       print('     release o=or1g1n,a=testing,n=codename-not-read,l=l8bel,c=c0mp0nent')
+       print('     origin MirRor-is-not-read')
+       # Add an experimental to be ignored, with a bigger priority.
+       print('  12 http://MirRor_is_not_read/folder-either-debian/ exp/main arch Packages')
+       print('     release o=or1g1n,a=Riliz5uiTe,n=codename-not-read,l=l8bel,c=c0mp0nentIgn')
+       print('     origin MirRor-is-not-read')
+       # Add an release from foreign repository, to be considered too.
+       print(' 512 http://MirRor_is_not_read/folder-either-debian/ exp/main arch Packages')
+       print('     release o=P-or1g1n,a=sid,n=codename-not-read,l=P-l8bel,c=OtherComp')
+       print('     origin MirRor-is-not-read')
+
+if os.environ.get('TEST_APT_CACHE_UNSTABLE') == '500':
+       print(' 500 http://MirRor_is_not_read/folder-either-debian/ sid/main arch Packages')
+       print('     release o=Debian,a=unstable,n=sid,l=Debian,c=main')
+       print('     origin MirRor-is-not-read')
+
+if os.environ.get('TEST_APT_CACHE_UNSTABLE_PORTS_OLD') == '500':
+       print(' 500 http://MirRor_is_not_read/folder-either-debian-ports/ sid/main arch Packages')
+       print('     release o=Debian Ports,a=unstable,n=sid,l=ftp.debian-ports.org,c=main,v=1.0')
+       print('     origin MirRor-is-not-read')
+
+if os.environ.get('TEST_APT_CACHE_UNSTABLE_PORTS') == '500':
+       print(' 500 http://MirRor_is_not_read/folder-either-debian-ports/ sid/main arch Packages')
+       print('     release o=Debian Ports,a=unstable,n=sid,l=ftp.ports.debian.org,c=main,v=1.0')
+       print('     origin MirRor-is-not-read')
+
+print('Pinned packages:')
diff --git a/test/dpkg-query b/test/dpkg-query
new file mode 100755 (executable)
index 0000000..6a79fcc
--- /dev/null
@@ -0,0 +1,26 @@
+#!/usr/bin/python3
+
+# Fake dpkg-query  python script to emulate output for test usage
+
+import sys
+import os
+import random
+
+if len(sys.argv) < 5:
+       sys.exit("Not enough arguments.")
+
+if sys.argv[1] != '-f' or \
+   sys.argv[2] != '${Version} ${Provides}\n' or \
+   sys.argv[3] != '-W':
+       sys.exit("Wrong input arguments.")
+
+if os.environ.get('TEST_DPKG_QUERY_NONE') == '1':
+       for package in sys.argv[4::]:
+               print('No packages found matching ' + package + '.',file=sys.stderr)
+
+if os.environ.get('TEST_DPKG_QUERY_ALL') == '1':
+       arch = 'TESTarch'
+       for package in sys.argv[4::]:
+               vers_sep = random.choice('-+~')
+               vers = '9.8' + vers_sep + 'Debian7ubuntu6'
+               print(vers + ' ' + package + '-' + arch + ', ' + package + '-noarch')
diff --git a/test/init-skeleton b/test/init-skeleton
new file mode 100644 (file)
index 0000000..27714a8
--- /dev/null
@@ -0,0 +1,233 @@
+#!/bin/sh
+#
+# /etc/init.d/FOO
+#
+# Template and example of a LSB conform init script for the service FOO
+# See http://www.linuxbase.org/spec/ for details
+#
+### BEGIN INIT INFO
+# Provides:          FOO
+# Required-Start:    $syslog $remote_fs
+# Should-Start:      $time $portmap
+# Required-Stop:     $syslog $remote_fs
+# Should-Stop:       $time $portmap
+# Default-Start:     3 5
+# Default-Stop:      0 1 2 6
+# Short-Description: FOO daemon used for ABC
+# Description:       The FOO service is used for ZZZ
+#      The (long) description can spread multiple lines
+#      which start with '#<TAB>' or # followed by at least
+#       two spaces.
+# X-UnitedLinux-Default-Enabled: yes
+### END INIT INFO
+# 
+# Remarks:
+# - The LSB actually might be interpreted that there is only a single space
+#   between the the colon after the keyword and the first argument, but
+#   most or all LSB install_initd's support more than one space
+# - Local extensions start with a X-[LANA registered provider or domain]-
+#   The X-UnitedLinux-Default-Enabled is one of the few actually used
+#   extension (enable service by when installing package, but keep current
+#   status when updating).
+#
+# The other keywords are described by the LSB. Notes on the differences
+# between Required-Start and Should-Start (which was introduced by LSB 1.9):
+#
+# a) Required-Start/Required-Stop is used as hard dependencies, i.e. for
+#    services which have to be started before this service. For instance
+#    needs the 'nfs-kernel-server' the portmap service. Requiring
+#      Required-Start: $portmap
+#    ensures that the portmapper is started before the nfs server.
+#    If a required service is missing, an init script cannot be installed
+#    and an init script which is required by another cannot be removed.
+#
+# b) Should-Start/Should-Stop is used for weak dependencies. This ensures
+#    that the order of the init scripts is useful. A possible use for
+#    'autofs' is to ask for
+#      Should-Start: nis
+#    which enables to read maps via NIS. Note that not all LSB install_initd
+#    programs support Should-Start (Debian's does) and therefore one should
+#    try hard not to rely on its support.
+#
+#    The Required-Stop/Should-Stop usually contain the same services as
+#    Required-Start/Should-Start do.
+#
+#    Besides using the services provided by the Provides section of
+#    init script, those predefined facilities are available
+#    (while they start with a $ they are no shell variables):
+#
+#    a) LSB 1.1 facility names
+#    - $local_fs    all local filesystems are mounted
+#    - $remote_fs   all remote filesystems are mounted
+#                   (note that /usr might be remote)
+#    - $syslog      system logging is operational
+#    - $network     low level networking (ethernet card etc.)
+#    - $named       hostname resolution available
+#    - $netdaemons  all network daemons are running
+#                   (Removed in LSB 1.2)
+#    b) LSB 1.2 facility names
+#    - $time        the system time has been set (e.g. NTP)
+#    - $portmap     daemons providing SunRPC/ONCRPC portmapping service
+#                   are running
+#
+# The LSB specifies those runlevels, most services use 3 and 5 for
+# Default-Start and 0 1 2 6 for Default-Stop.
+# 
+# 0 - halt
+# 1 - single user mode
+# 2 - multiuser with no network services exported
+# 3 - normal/full multiuser
+# 4 - reserved for local use (usually normal/full multiuser)
+# 5 - multiuser with xdm or equivalent
+# 6 - reboot
+# 
+# Note on that script names should follow the LSB:
+# http://www.linuxbase.org/spec/gLSB/gLSB/scrptnames.html
+# There is a registry for script names that are reserved for use by
+# distributions and registered script and provider names at
+# http://www.lanana.org/
+
+# Source LSB init functions
+# This provides start_daemon, killproc, pidofproc,
+# log_success_msg, log_failure_msg and log_warning_msg.
+. /lib/lsb/init-functions
+
+# Since init scripts are config files, they might be left after an uninstall
+# Check whether the binary is still present:
+FOO_BIN=/usr/sbin/FOO
+test -x "$FOO_BIN" || {log_failure_msg "$FOO_BIN not installed"; exit 5}
+
+# Check whether a required configuration file is available
+FOO_CONFIG=/etc/FOO.conf
+test -r "$FOO_CONFIG" || {log_failure_msg "$FOO_CONFIG not existing"; exit 6}
+
+# Those LSB defined exit status codes shall be used (except for status)
+# 0     sucess
+# 1    generic or unspecified error (current practice)
+# 2    invalid or excess argument(s)
+# 3    unimplemented feature (for example, "reload")
+# 4    user had insufficient privilege
+# 5    program is not installed
+# 6    program is not configured
+# 7            program is not running
+# 8-199 reserved (8-99 LSB, 100-149 distribution, 150-199 application)
+# 
+# Note that those situation shall also be regarded as success:
+# * restarting a service (instead of reloading it)
+#   with the "force-reload" argument
+# * running "start" on a service already running
+# * running "stop" on a service already stopped or not running
+# * running "restart" on a service already stopped or not running
+# * running "try-restart" on a service already stopped or not running
+#
+
+case "$1" in
+    start)
+       # Start service with startproc which shall return the
+        # LSB exit status
+       start_daemon "$FOO_BIN" -c "$FOO_CONFIG"
+       STATUS=$?
+       if [ "$STATUS" = 0 ]
+       then
+            log_success_msg "Starting FOO"
+        else
+           log_failure_msg "Starting FOO"
+        fi
+       exit $STATUS
+       ;;
+    stop)
+       echo -n "Shutting down FOO "
+       # Stop the service with killproc which shall return the
+        # LSB exit status
+       killproc "$FOO_BIN"
+       STATUS=$?
+       if [ "$STATUS" = 0 ]
+           log_success_msg "Shutting down FOO"
+           exit 0
+        else
+           log_failure_msg "Shutting down FOO"
+        fi
+       exit $STATUS
+       ;;
+    try-restart)
+       # Do a restart only if the service is running
+       # try-restart has been added to the LSB in 1.9
+       # RedHat's similar command is called condrestart.
+       $0 status > /dev/null
+       STATUS=$?
+       if [ "$STATUS" = 0 ]
+       then
+           $0 restart
+       else
+           log_success_msg "Try-Restarting FOO: not running"
+       fi
+       exit 0 # not running is also regarded as success
+       ;;
+    restart)
+       # Restart service (if running) or start service
+       $0 stop
+       $0 start
+       ;;
+    force-reload)
+       # Reload the configuartion. Usually a SIGHUP is used for this
+       # If it doesn't support his signal, restart it (only if running)
+
+        # Supports signalling
+       killproc -HUP "$FOO_BIN"
+       SIGNAL=$?
+       if [ "$SIGNAL" = 0 ]
+       then
+           log_success_msg "Reloading FOO"
+       else
+           log_failure_msg "Reloading FOO"
+       fi
+       exit $STATUS
+
+       # Otherwise
+       #$0 try-restart
+       ;;
+    reload)
+       # Reload configuration file, but don't restart if it is not supported
+
+       # If it supports signaling:
+       killproc -HUP "$FOO_BIN"
+       SIGNAL=$?
+       if [ "$SIGNAL" = 0 ]
+       then
+           log_success_msg "Reloading FOO"
+       else
+           log_failure_msg "Reloading FOO"
+       fi
+       exit $STATUS
+       
+       # Otherwise
+       # exit 3
+       ;;
+    status)
+       # Use pidofproc to check the status of the service,
+       # pidofproc returns the exit status code of 0 when it the process is
+       # running.
+
+       # LSB defined exit status codes for status:
+       # 0     program is running or service is OK
+       # 1     program is dead and /var/run pid file exists
+       # 2     program is dead and /var/lock lock file exists
+       # 3     program is not running
+       # 4     program or service status is unknown
+       # 5-199 reserved (5-99 LSB, 100-149 distribution, 150-199 applications)
+       
+       checkproc "$FOO_BIN" > /dev/null
+       STATUS=$?
+       if [ "$SIGNAL" = 0 ]
+       then
+           log_success_msg "Checking FOO"
+       else
+           log_warning_msg "Checking FOO: Not running"
+       fi
+       exit $STATUS
+       ;;
+    *)
+       echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
+       exit 1
+       ;;
+esac
diff --git a/test/lsb-release b/test/lsb-release
new file mode 100644 (file)
index 0000000..06d7473
--- /dev/null
@@ -0,0 +1,5 @@
+DISTRIB_ID=(Distributor ID)
+DISTRIB_DESCRIPTION=(A human-readable description of the release)
+DISTRIB_RELEASE=(The release number)
+DISTRIB_CODENAME=(The codename for the release)
+OTHER_VARIABLE=Not supposed to exist
diff --git a/test/lsb-test.sh b/test/lsb-test.sh
new file mode 100644 (file)
index 0000000..2db3457
--- /dev/null
@@ -0,0 +1,38 @@
+#!/bin/sh -e
+
+echo "Importing $1/init-functions"
+. $1/init-functions
+
+log_warning_msg "Only a warning"
+log_success_msg "This should succeed"
+log_failure_msg "This fails miserably"
+
+echo "OK!"
+
+# Test pidofproc sanity checking.
+
+echo "Testing pidofproc command line checks"
+
+echo " Simple check, no options:"
+pidofproc nonexistent
+RETVAL=$?
+if [ $RETVAL -ne 3 ]; then
+    echo "Unexpected return value $RETVAL"
+fi
+
+echo " With -p option:"
+pidofproc -p /var/run/nonexist.pid nonexistent
+RETVAL=$?
+if [ $RETVAL -ne 3 ]; then
+    echo "Unexpected return value $RETVAL"
+fi
+
+echo " With -p option, but in wrong place:"
+pidofproc nonexistent -p /var/run/nonexist.pid
+RETVAL=$?
+if [ $RETVAL -ne 4 ]; then
+    echo "Unexpected return value $RETVAL"
+fi
+
+echo "OK!"
+
diff --git a/test/minid.initd b/test/minid.initd
new file mode 100755 (executable)
index 0000000..2302015
--- /dev/null
@@ -0,0 +1,52 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:          svnd
+# Required-Start:    $syslog $remote_fs
+# Should-Start: $time ypbind sendmail
+# Required-Stop:     $syslog $remote_fs
+# Should-Stop: $time ypbind sendmail
+# Default-Start:     3 5
+# Default-Stop:      0 1 2 6
+# Short-Description: The daemon
+# Description:       a cool daemon
+### END INIT INFO
+# chkconfig: 345 99 00
+# description: a cool daemon
+
+
+DAEMON="/tmp/minid.pl"
+
+PARA=" "
+. /lib/lsb/init-functions
+
+case "$1" in
+   start)
+       echo -n "Starting $DAEMON "
+       start_daemon $DAEMON $PARA
+       RETVAL=$?
+       ;;
+   stop)
+       echo -n "Shutting down $DAEMON "
+       killproc $DAEMON -TERM
+       RETVAL=$?
+       ;;
+   restart)
+       $0 stop
+       $0 start
+       ;;
+   status)
+       echo -n "Checking for service $DAEMON "
+       pidofproc $DAEMON 2>&1 >/dev/null
+       RETVAL=$?
+       ;;
+   *)
+       echo "Usage: $0 {start|stop|restart|status}"
+       exit 1
+       ;;
+esac
+
+if [ "x$RETVAL" = "x0" ] ; then
+  log_success_msg
+ else
+  log_failure_msg
+fi
diff --git a/test/minid.pl b/test/minid.pl
new file mode 100755 (executable)
index 0000000..9bc81f2
--- /dev/null
@@ -0,0 +1,8 @@
+#!/usr/bin/perl -w
+# detach from tty
+main:
+$pid = fork;
+exit if $pid;
+die "fork: $!" unless defined $pid;
+print "continue in child";
+sleep(4000);
diff --git a/test/test_initdutils.py b/test/test_initdutils.py
new file mode 100644 (file)
index 0000000..07952d8
--- /dev/null
@@ -0,0 +1,31 @@
+#!/usr/bin/python3
+import unittest
+
+import initdutils as iu
+
+class TestInitdUtils(unittest.TestCase):
+
+       @unittest.skip('Test not implemented.')
+       def test_scan_initfile():
+               raise NotImplementedError()
+       @unittest.skip('Test not implemented.')
+       def test_save_facilities():
+               raise NotImplementedError()
+       @unittest.skip('Test not implemented.')
+       def test_load_facilities():
+               raise NotImplementedError()
+       @unittest.skip('Test not implemented.')
+       def test_load_depends():
+               raise NotImplementedError()
+       @unittest.skip('Test not implemented.')
+       def test_save_depends():
+               raise NotImplementedError()
+       @unittest.skip('Test not implemented.')
+       def test_load_lsbinstall_info():
+               raise NotImplementedError()
+       @unittest.skip('Test not implemented.')
+       def test_save_lsbinstall_info():
+               raise NotImplementedError()
+
+if __name__ == '__main__':
+       unittest.main()
diff --git a/test/test_lsb_release.py b/test/test_lsb_release.py
new file mode 100644 (file)
index 0000000..936af90
--- /dev/null
@@ -0,0 +1,310 @@
+#!/usr/bin/python3
+# coding=utf-8
+
+import unittest
+
+import lsb_release as lr
+
+import random
+import string
+
+import os
+import sys
+
+import warnings
+
+def rnd_string(min_l,max_l):
+       return ''.join( [random.choice(string.ascii_letters) for i in range(random.randint(min_l,max_l))])
+
+def get_arch_distinfo():
+       # Copied verbatim from guess_debian_release; sucks but unavoidable.
+       distinfo = {'ID' : 'Debian'}
+       kern = os.uname()[0]
+       if kern in ('Linux', 'Hurd', 'NetBSD'):
+               distinfo['OS'] = 'GNU/'+kern
+       elif kern == 'FreeBSD':
+               distinfo['OS'] = 'GNU/k'+kern
+       elif kern in ('GNU/Linux', 'GNU/kFreeBSD'):
+               distinfo['OS'] = kern
+       else:
+               distinfo['OS'] = 'GNU'
+       return distinfo
+
+
+class TestLSBRelease(unittest.TestCase):
+
+       def test_lookup_codename(self):
+               # Test all versions
+               for rno in lr.RELEASE_CODENAME_LOOKUP:
+                       cdn = lr.RELEASE_CODENAME_LOOKUP[rno]
+                       # Test that 1.1, 1.1r0 and 1.1.8 lead to buzz. Default is picked randomly and is not supposed to go trough
+                       badDefault = rnd_string(0,9)
+                       # From Wheezy on, the codename is defined by the first number but a dot-revision is mandatory
+                       if float(rno) >= 7:
+                               rno = rno + '.' + str(random.randint(0,9))
+                       self.assertEqual(lr.lookup_codename(rno,badDefault),cdn,'Release name `' + rno + '` is not recognized.')
+                       self.assertEqual(lr.lookup_codename(rno + 'r' + str(random.randint(0,9)),badDefault),cdn,'Release name `' + rno + 'r*` is not recognized.')
+                       self.assertEqual(lr.lookup_codename(rno + '.' + str(random.randint(0,9)),badDefault),cdn,'Release name `' + rno + '.*` is not recognized.')
+                       self.assertEqual(lr.lookup_codename('inexistent_release' + str(random.randint(0,9)),badDefault),badDefault,'Default release codename is not accepted.')
+
+       def test_valid_lsb_versions(self):
+               # List versions in which the modules are available
+               lsb_modules = {
+                       'cxx'           : ['3.0', '3.1', '3.2', '4.0', '4.1'],
+                       'desktop'       : ['3.1', '3.2', '4.0', '4.1'],
+                       'languages'  : ['3.2', '4.0', '4.1'],
+                       'multimedia' : ['3.2', '4.0', '4.1'],
+                       'printing'   : ['3.2', '4.0', '4.1'],
+                       'qt4'           : ['3.1'],
+                       'security'   : ['4.0','4.1'],
+               }
+               lsb_known_versions = ['2.0', '3.0', '3.1', '3.2', '4.0', '4.1'];
+               for lsb_module in lsb_modules:
+                       in_versions = lsb_modules[lsb_module]
+                       for test_v in lsb_known_versions:
+                               vlv_result = lr.valid_lsb_versions(test_v,lsb_module)
+                               assert_text = 'valid_lsb_versions(' + test_v + ',' + lsb_module + ')'
+                               # For 2.0, all output 2.0 only.
+                               if test_v == '2.0':
+                                       self.assertEqual(vlv_result,
+                                                                        ['2.0'],
+                                                                        assert_text)
+                               # For 3.0, all output 2.0 and 3.0.
+                               elif test_v == '3.0':
+                                       self.assertEqual(vlv_result,
+                                                                        ['2.0', '3.0'],
+                                                                        assert_text)
+                               # Before appearance, it outputs all past LSB versions
+                               elif int(float(test_v)*10) < int(float(in_versions[0])*10):
+                                       self.assertEqual(vlv_result,
+                                                                        [elem for elem in lsb_known_versions if int(float(elem)*10) <= int(float(test_v)*10)],
+                                                                        assert_text)
+                               # From appearence on, it outputs all lower versions from the in_versions
+                               else:
+                                       self.assertEqual(vlv_result,
+                                                                        [elem for elem in in_versions if int(float(elem)*10) <= int(float(test_v)*10)],
+                                                                        assert_text)
+
+       def test_check_modules_installed(self):
+               # Test that when no packages are available, then we get nothing out.
+               os.environ['TEST_DPKG_QUERY_NONE'] = '1'
+               self.assertEqual(lr.check_modules_installed(),[])
+               os.environ.pop('TEST_DPKG_QUERY_NONE')
+
+       def test_parse_policy_line(self):
+               release_line = ''
+               shortnames = list(lr.longnames.keys())
+               random.shuffle(shortnames)
+               longnames = {}
+               for shortname in shortnames:
+                       longnames[lr.longnames[shortname]] = rnd_string(1,9)
+                       release_line += shortname + '=' + longnames[lr.longnames[shortname]] + ','
+               release_line = release_line[:-1]
+               self.assertEqual(sorted(lr.parse_policy_line(release_line)),sorted(longnames),'parse_policy_line(' + release_line + ')')
+
+       def test_compare_release(self):
+               # Test that equal suite strings lead to 0
+               fake_release_equal = rnd_string(1,25)
+               x = [rnd_string(1,12), {'suite': fake_release_equal}]
+               y = [rnd_string(1,12), {'suite': fake_release_equal}]
+               self.assertEqual(lr.compare_release(x,y),0)
+               
+               # Test that sequences in RELEASES_ORDER lead to reliable output
+               RO_min = 0
+               RO_max = len(lr.RELEASES_ORDER) - 1
+               x_suite_i = random.randint(RO_min,RO_max)
+               y_suite_i = random.randint(RO_min,RO_max)
+               x[1]['suite'] = lr.RELEASES_ORDER[x_suite_i]
+               y[1]['suite'] = lr.RELEASES_ORDER[y_suite_i]
+               supposed_output = y_suite_i - x_suite_i
+               self.assertEqual(lr.compare_release(x,y),
+                                supposed_output,
+                                'compare_release(' + x[1]['suite'] + ',' + y[1]['suite'] + ') =? ' + str(supposed_output))
+
+       def test_parse_apt_policy(self):
+               # Test almost-empty apt-cache policy
+               supposed_output = [(100, {'suite': 'now'})]
+               self.assertEqual(lr.parse_apt_policy(),supposed_output)
+               # Add one fake entry
+               os.environ['TEST_APT_CACHE1'] = '932'
+               supposed_output.append((932, {'origin': 'oRigIn', 'suite': 'SuiTe', 'component': 'C0mp0nent', 'label': 'lABel'}))
+               self.assertEqual(lr.parse_apt_policy(),supposed_output)
+               # Add a second fake entry, unordered
+               os.environ['TEST_APT_CACHE2'] = '600'
+               supposed_output.append((600, {'origin': '0RigIn', 'suite': '5uiTe', 'component': 'C03p0nent', 'label': '1ABel'}))
+               self.assertEqual(lr.parse_apt_policy(),supposed_output)
+               # Add a third fake entry, unordered, with non-ascii chars (#675618)
+               os.environ['TEST_APT_CACHE3'] = '754'
+               supposed_output.append((754, {'origin': 'Jérôme Helvète', 'suite': '5uiTe', 'component': 'C03p0nent', 'label': '1ABel'}))
+               self.assertEqual(lr.parse_apt_policy(),supposed_output)
+               os.environ.pop('TEST_APT_CACHE1')
+               os.environ.pop('TEST_APT_CACHE2')
+               os.environ.pop('TEST_APT_CACHE3')
+
+       def test_guess_release_from_apt(self):
+               os.environ['TEST_APT_CACHE1'] = '932'
+               os.environ['TEST_APT_CACHE2'] = '600'
+               os.environ['TEST_APT_CACHE3'] = '754'
+               os.environ['TEST_APT_CACHE_RELEASE'] = '512'
+               supposed_output = {'origin': 'or1g1n', 'suite': 'testing', 'component': 'c0mp0nent', 'label': 'l8bel'}
+               self.assertEqual(
+                       lr.guess_release_from_apt(
+                               origin='or1g1n',
+                               label='l8bel',
+                               component='c0mp0nent',
+                               ignoresuites=('c0mp0nentIgn')),
+                       supposed_output)
+
+               # Test with a special repository (for Ports)
+               supposed_output = {'origin': 'P-or1g1n', 'suite': 'sid', 'component': 'OtherComp', 'label': 'P-l8bel'}
+               self.assertEqual(
+                       lr.guess_release_from_apt(
+                               origin='or1g1n',
+                               label='l8bel',
+                               component='c0mp0nent',
+                               ignoresuites=('c0mp0nentIgn'),
+                               alternate_olabels={'P-or1g1n': ('P-l8bel', 'P-l9bel')}),
+                       supposed_output)
+               os.environ.pop('TEST_APT_CACHE1')
+               os.environ.pop('TEST_APT_CACHE2')
+               os.environ.pop('TEST_APT_CACHE3')
+               os.environ.pop('TEST_APT_CACHE_RELEASE')
+
+       def test_guess_debian_release(self):
+               distinfo = get_arch_distinfo()
+               
+               # Test different dpkg origin with an fake "unstable releases" that ends in /sid, and an invalid apt-cache policy
+               distinfo['ID'] = rnd_string(5,12)
+               fn = 'test/dpkg_origins_default_' + rnd_string(5,5)
+               f = open(fn,'w')
+               f.write('Vendor: ' + distinfo['ID'] + "\n")
+               f.close()
+               os.environ['LSB_ETC_DPKG_ORIGINS_DEFAULT'] = fn
+               
+               distinfo['RELEASE']  = 'testing/unstable'
+               distinfo['DESCRIPTION'] = '%(ID)s %(OS)s %(RELEASE)s' % distinfo
+               fn2 = 'test/debian_version_' + rnd_string(5,12)
+               f = open(fn2,'w')
+               f.write(rnd_string(5,12) + '/sid')
+               f.close()
+               os.environ['LSB_ETC_DEBIAN_VERSION'] = fn2
+               self.assertEqual(lr.guess_debian_release(),distinfo)
+               os.remove(fn)
+               # Make sure no existing /etc/dpkg/origins/default is used
+               os.environ['LSB_ETC_DPKG_ORIGINS_DEFAULT'] = '/non-existant'
+               distinfo['ID'] = 'Debian'
+
+               # Test "stable releases" with numeric debian_versions
+               for rno in lr.RELEASE_CODENAME_LOOKUP:
+                       # From Wheezy on, the codename is defined by the first number but a dot-revision is mandatory
+                       if float(rno) >= 7:
+                               distinfo['RELEASE'] = rno + '.' + str(random.randint(0,9))
+                       else:
+                               distinfo['RELEASE'] = rno + random.choice('.r') + str(random.randint(0,9))
+                       distinfo['CODENAME'] = lr.RELEASE_CODENAME_LOOKUP[rno]
+                       distinfo['DESCRIPTION'] = '%(ID)s %(OS)s %(RELEASE)s (%(CODENAME)s)' % distinfo
+                       fn = 'test/debian_version_' + rnd_string(5,5)
+                       f = open(fn,'w')
+                       f.write(distinfo['RELEASE'])
+                       f.close()
+                       os.environ['LSB_ETC_DEBIAN_VERSION'] = fn
+                       self.assertEqual(lr.guess_debian_release(),distinfo)
+                       os.remove(fn)
+               os.environ.pop('LSB_ETC_DEBIAN_VERSION')
+
+               # Remove the CODENAME from the supposed output
+               distinfo.pop('CODENAME')
+               # Test "stable releases" with string debian_versions, go read invalid apt-cache policy
+               for rno in lr.RELEASE_CODENAME_LOOKUP:
+                       distinfo['RELEASE']  = lr.RELEASE_CODENAME_LOOKUP[rno]
+                       distinfo['DESCRIPTION'] = '%(ID)s %(OS)s %(RELEASE)s' % distinfo
+                       fn = 'test/debian_version_' + rnd_string(5,12)
+                       f = open(fn,'w')
+                       f.write(distinfo['RELEASE'])
+                       f.close()
+                       os.environ['LSB_ETC_DEBIAN_VERSION'] = fn
+                       self.assertEqual(lr.guess_debian_release(),distinfo)
+                       os.remove(fn)
+               os.environ.pop('LSB_ETC_DEBIAN_VERSION')
+
+               # Test "unstable releases" that end in /sid, go read invalid apt-cache policy
+               distinfo['RELEASE'] = 'testing/unstable'
+               distinfo['DESCRIPTION'] = '%(ID)s %(OS)s %(RELEASE)s' % distinfo
+               for rno in lr.RELEASE_CODENAME_LOOKUP:
+                       fn = 'test/debian_version_' + rnd_string(5,12)
+                       f = open(fn,'w')
+                       f.write(lr.RELEASE_CODENAME_LOOKUP[rno] + '/sid')
+                       f.close()
+                       os.environ['LSB_ETC_DEBIAN_VERSION'] = fn
+                       self.assertEqual(lr.guess_debian_release(),distinfo)
+                       os.remove(fn)
+               os.environ.pop('LSB_ETC_DEBIAN_VERSION')
+
+               # Test "unstable releases" that end in /sid, go read valid apt-cache policy
+               os.environ['TEST_APT_CACHE_UNSTABLE'] = '500'
+               distinfo['CODENAME'] = 'sid'
+               distinfo['RELEASE'] = 'unstable'
+               distinfo['DESCRIPTION'] = '%(ID)s %(OS)s %(RELEASE)s (%(CODENAME)s)' % distinfo
+               for rno in lr.RELEASE_CODENAME_LOOKUP:
+                       fn = 'test/debian_version_' + rnd_string(5,12)
+                       f = open(fn,'w')
+                       f.write(lr.RELEASE_CODENAME_LOOKUP[rno] + '/sid')
+                       f.close()
+                       os.environ['LSB_ETC_DEBIAN_VERSION'] = fn
+                       self.assertEqual(lr.guess_debian_release(),distinfo)
+                       os.remove(fn)
+               os.environ.pop('LSB_ETC_DEBIAN_VERSION')
+
+               distinfo['CODENAME'] = 'sid'
+               distinfo['RELEASE'] = 'unstable'
+               distinfo['DESCRIPTION'] = '%(ID)s %(OS)s %(RELEASE)s (%(CODENAME)s)' % distinfo
+
+               for CODE in ('PORTS', 'PORTS_OLD'):
+                       # Test "unstable releases with Debian Ports" that end in /sid, go read valid apt-cache policy
+                       os.environ['TEST_APT_CACHE_UNSTABLE_' + CODE] = '500'
+                       for rno in lr.RELEASE_CODENAME_LOOKUP:
+                               fn = 'test/debian_version_' + rnd_string(5,12)
+                               f = open(fn,'w')
+                               f.write(lr.RELEASE_CODENAME_LOOKUP[rno] + '/sid')
+                               f.close()
+                               os.environ['LSB_ETC_DEBIAN_VERSION'] = fn
+                               self.assertEqual(lr.guess_debian_release(),distinfo)
+                               os.remove(fn)
+                       os.environ.pop('TEST_APT_CACHE_UNSTABLE_' + CODE)
+               os.environ.pop('LSB_ETC_DEBIAN_VERSION')
+               os.environ.pop('TEST_APT_CACHE_UNSTABLE')
+
+       def test_get_lsb_information(self):
+               # Test that an inexistant /etc/lsb-release leads to empty output
+               supposed_output = {}
+               os.environ['LSB_ETC_LSB_RELEASE'] = 'test/inexistant_file_' + rnd_string(2,5)
+               self.assertEqual(lr.get_lsb_information(),supposed_output)
+               # Test that a fake /etc/lsb-release leads to output with only the content we want
+               supposed_output = {'RELEASE': '(The release number)',
+                                  'CODENAME': '(The codename for the release)',
+                                  'ID': '(Distributor ID)',
+                                  'DESCRIPTION': '(A human-readable description of the release)'}
+               os.environ['LSB_ETC_LSB_RELEASE'] = 'test/lsb-release'
+               self.assertEqual(lr.get_lsb_information(),supposed_output)
+               os.environ.pop('LSB_ETC_LSB_RELEASE')
+
+       def test_get_distro_information(self):
+               # Test that an inexistant /etc/lsb-release leads to empty output
+               supposed_output = get_arch_distinfo()
+               supposed_output['RELEASE']     = 'testing/unstable';
+               supposed_output['DESCRIPTION'] = '%(ID)s %(OS)s %(RELEASE)s' % supposed_output
+
+               os.environ['LSB_ETC_LSB_RELEASE'] = 'test/inexistant_file_' + rnd_string(2,5)
+               fn = 'test/debian_version_' + rnd_string(5,12)
+               f = open(fn,'w')
+               f.write('testing/sid')
+               f.close()
+               os.environ['LSB_ETC_DEBIAN_VERSION'] = fn
+               os.environ['LSB_ETC_DPKG_ORIGINS_DEFAULT'] = ''
+               self.assertEqual(lr.get_distro_information(),supposed_output)
+               os.remove(fn)
+               os.environ.pop('LSB_ETC_DPKG_ORIGINS_DEFAULT')
+               os.environ.pop('LSB_ETC_DEBIAN_VERSION')
+
+if __name__ == '__main__':
+       unittest.main()