From c565c8ba38870439bedcfac8ced775d57b45dee4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 14 Feb 2016 20:04:45 +0100 Subject: Change handling of ps_accounting --- debian/changelog | 6 +- debian/foomatic-filters.postinst | 114 +++++++++++++++++++++++++++++++++ debian/foomatic-filters.postinst.in | 121 ------------------------------------ debian/rules | 13 ---- 4 files changed, 119 insertions(+), 135 deletions(-) create mode 100644 debian/foomatic-filters.postinst delete mode 100644 debian/foomatic-filters.postinst.in diff --git a/debian/changelog b/debian/changelog index 2e6a04f..1a6cbc3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,6 @@ foomatic-filters (4.0.17-8) UNRELEASED; urgency=medium - * Move beh to the new packackage foomatic-filters-beh. + * Move beh to the new package foomatic-filters-beh (Closes: #799259). * debian/control: - Bump Standards-Version to 3.9.7 (no changes required). - Change Vcs-* to secure protocol. @@ -12,6 +12,10 @@ foomatic-filters (4.0.17-8) UNRELEASED; urgency=medium * debian/rules: - Enable hardening. - Add overrides_dh_install-arch and -indep. + * Change handling of ps_accounting because debian stable has version 4.0.17. + - Move debian/foomatic-filters.postinst.in debian/foomatic-filters.postinst. + + Remove the version if query. + - debian/rules: Remove the foomatic-filters.postinst.in handling. -- Jörg Frings-Fürst Sat, 13 Feb 2016 23:56:21 +0100 diff --git a/debian/foomatic-filters.postinst b/debian/foomatic-filters.postinst new file mode 100644 index 0000000..3387d5a --- /dev/null +++ b/debian/foomatic-filters.postinst @@ -0,0 +1,114 @@ +#!/bin/bash + +set -e + +# Source debconf library. +. /usr/share/debconf/confmodule + +readonly FILTERCONF=/etc/foomatic/filter.conf +readonly FILTERBACK=$FILTERCONF.debconf-old +readonly tempfile=`tempfile -pfoomatic-filters-` + +function parseconfig +{ + db_clear + eval $(perl /usr/share/foomatic/parseconfig.pl) +} + +db_get foomatic-filters/config_parsed +if [ $RET = false ]; then + parseconfig + db_set foomatic-filters/config_parsed true +fi + +db_get foomatic-filters/filter_debug +debug="debug: 0" +if [ $RET = true ]; then + debug="debug: 1" +fi + +db_get foomatic-filters/textfilter +if [ "$RET" = Automagic ]; then + textfilter="# textfilter:" +else + if [ "$RET" = Custom ]; then + db_get foomatic-filters/custom_textfilter + fi + textfilter="textfilter: $RET" +fi + +# Disable the whole customized Ghostscript stuff +gspath="# gspath: gs" + +db_get foomatic-filters/ps_accounting +if [ $RET = true ]; then + ps_accounting="ps_accounting: 1" +else + ps_accounting="ps_accounting: 0" +fi + +ps_accounting="ps_accounting: 1" +RET=true +db_set foomatic-filters/ps_accounting true + +db_get foomatic-filters/spooler +echo "$RET" >| /etc/foomatic/defaultspooler + +cat <| $tempfile +# This file allows you to configure the "foomatic-rip" filter. + +# You can force reconfiguration managed via debconf by running the +# following command: +# dpkg-reconfigure foomatic-filters +# You may need to change the lowest priority of questions to be presented +# using the switch "-p" to access some or any of these options. + +# Command for converting text files to PostScript. +# +# Priority low +$textfilter + +# Enable debug output into a logfile in /tmp/foomatic-rip.log. +# It will contain status from this filter, plus Ghostscript stderr output. +# +# WARNING: This logfile is a potential security hole; do not use in production. +# +# Priority low +$debug + +# Enable insertion of PostScript code for accounting into each printjob. +# Currently only supported with CUPS. (EXPERIMENTAL) +# +# NOTE: Enabling this option may cause extra pages to be printed after each +# job as well as after banner pages, especially with generic +# PostScript printers. +# +# Priority low +$ps_accounting + +# Path to the Ghostscript interpreter; will search the path for 'gs' if +# not specified. +# +# Priority low +$gspath + +EOF + +if [ -e $FILTERCONF ]; then + chmod --reference=$FILTERCONF $tempfile +else + chmod 0644 $tempfile +fi + +ucf --three-way --debconf-ok $tempfile $FILTERCONF + +db_stop + +# Remove the temporary file +rm -f $tempfile + +#DEBHELPER# + +### Local Variables: +### tab-width: 4 +### End: diff --git a/debian/foomatic-filters.postinst.in b/debian/foomatic-filters.postinst.in deleted file mode 100644 index 2a5d21d..0000000 --- a/debian/foomatic-filters.postinst.in +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/bash - -set -e - -# Source debconf library. -. /usr/share/debconf/confmodule - -readonly FILTERCONF=/etc/foomatic/filter.conf -readonly FILTERBACK=$FILTERCONF.debconf-old -readonly tempfile=`tempfile -pfoomatic-filters-` - -function parseconfig -{ - db_clear - eval $(perl /usr/share/foomatic/parseconfig.pl) -} - -db_get foomatic-filters/config_parsed -if [ $RET = false ]; then - parseconfig - db_set foomatic-filters/config_parsed true -fi - -db_get foomatic-filters/filter_debug -debug="debug: 0" -if [ $RET = true ]; then - debug="debug: 1" -fi - -db_get foomatic-filters/textfilter -if [ "$RET" = Automagic ]; then - textfilter="# textfilter:" -else - if [ "$RET" = Custom ]; then - db_get foomatic-filters/custom_textfilter - fi - textfilter="textfilter: $RET" -fi - -# Disable the whole customized Ghostscript stuff -gspath="# gspath: gs" - -db_get foomatic-filters/ps_accounting -if [ $RET = true ]; then - ps_accounting="ps_accounting: 1" -else - ps_accounting="ps_accounting: 0" -fi - -# Since foomatic-filters #FF_PS_DEFAULT_CHANGE_VERSION# in #MOTHER_DISTRO#, -# the default for inserting PostScript code for CUPS' page accounting changed. -# This functionality is now activated by default as for problematic drivers it -# can be deactivated individually. -if dpkg --compare-versions "$2" lt-nl "#FF_PS_DEFAULT_CHANGE_VERSION#"; then - ps_accounting="ps_accounting: 1" - RET=true - db_set foomatic-filters/ps_accounting true -fi - - -db_get foomatic-filters/spooler -echo "$RET" >| /etc/foomatic/defaultspooler - -cat <| $tempfile -# This file allows you to configure the "foomatic-rip" filter. - -# You can force reconfiguration managed via debconf by running the -# following command: -# dpkg-reconfigure foomatic-filters -# You may need to change the lowest priority of questions to be presented -# using the switch "-p" to access some or any of these options. - -# Command for converting text files to PostScript. -# -# Priority low -$textfilter - -# Enable debug output into a logfile in /tmp/foomatic-rip.log. -# It will contain status from this filter, plus Ghostscript stderr output. -# -# WARNING: This logfile is a potential security hole; do not use in production. -# -# Priority low -$debug - -# Enable insertion of PostScript code for accounting into each printjob. -# Currently only supported with CUPS. (EXPERIMENTAL) -# -# NOTE: Enabling this option may cause extra pages to be printed after each -# job as well as after banner pages, especially with generic -# PostScript printers. -# -# Priority low -$ps_accounting - -# Path to the Ghostscript interpreter; will search the path for 'gs' if -# not specified. -# -# Priority low -$gspath - -EOF - -if [ -e $FILTERCONF ]; then - chmod --reference=$FILTERCONF $tempfile -else - chmod 0644 $tempfile -fi - -ucf --three-way --debconf-ok $tempfile $FILTERCONF - -db_stop - -# Remove the temporary file -rm -f $tempfile - -#DEBHELPER# - -### Local Variables: -### tab-width: 4 -### End: diff --git a/debian/rules b/debian/rules index 5fb5978..563c8db 100755 --- a/debian/rules +++ b/debian/rules @@ -25,19 +25,6 @@ override_dh_install-arch: ifeq ($(derives_from_ubuntu),yes) install -D -m 644 debian/ubuntu/apport-hook.py $(CURDIR)/debian/foomatic-filters/usr/share/apport/package-hooks/source_foomatic-filters.py endif - - # Prepare the postinst with distro-specific versions - cp debian/foomatic-filters.postinst.in debian/foomatic-filters.postinst -ifeq ($(derives_from_ubuntu),yes) - # We derive from Ubuntu, the ps_accounting default change was made in version 3.0.2-20070719-0ubuntu1 - sed -i -e "s/#MOTHER_DISTRO#/Ubuntu/g" debian/foomatic-filters.postinst - sed -i -e "s/#FF_PS_DEFAULT_CHANGE_VERSION#/3.0.2-20070719-0ubuntu1/g" debian/foomatic-filters.postinst -else - # We derive from Debian, the ps_accounting default change was made in version 4.0.5-1 - sed -i -e "s/#MOTHER_DISTRO#/Debian/g" debian/foomatic-filters.postinst - sed -i -e "s/#FF_PS_DEFAULT_CHANGE_VERSION#/4.0.5-1/g" debian/foomatic-filters.postinst -endif -# cp 111.111 333.333 override_dh_install-indep: dh_install -- cgit v1.2.3