tag 726656 +patch stop Hi,
Quoting manual page of patch(1) patch tries to skip any leading garbage, apply the diff, and then skip any trailing garbage. Thus you could feed an article or message con- taining a diff listing to patch, and it should work. And here it comes ... --- ../apt-cacher-ng-0.7.18.nen2//debian/apt-cacher-ng.templates 2009-11-02 21:43:41.000000000 +0100 +++ ./debian/apt-cacher-ng.templates 2013-10-10 07:26:34.684330786 +0200 @@ -24,3 +24,37 @@ Selecting "No automated setup" will leave the existing configuration unchanged. It will need to be updated manually. +Template: apt-cacher-ng/bindaddress +Type: string +Default: all +_Description: Bind Address(es) + Addresses or hostnames to listen on. Multiple addresses must be separated + by spaces. Each entry must be an exact local address which is associated + with a local interface. DNS resolution is performed using getaddrinfo(3) + for all available protocols (IPv4, IPv6, ...). Using a protocol specific + format will create binding(s) only on protocol specific socket(s) + (e.g. 0.0.0.0 will listen only to IPv4) + . + Another example: 'localhost 192.168.7.254 publicNameOnMainInterface' + . + Default: all, will listen on all interfaces and protocols + +Template: apt-cacher-ng/port +Type: string +Default: 3142 +_Description: TCP (http) port + Configure at which TCP port should Apt-Cacher NG listen for HTTP requests. + Default is port 3142. + Set to 9999 to emulate apt-proxy. + +Template: apt-cacher-ng/cachedir +Type: string +Default: /var/cache/apt-cacher-ng +_Description: Top level directory where the apt cache should be stored + +Template: apt-cacher-ng/proxy +Type: string +Default: none +_Description: proxy to use for downloads + The specification of another proxy which shall be used for downloads. + Username and password are optional and see manual for limitations. debian/apt-cacher-ng.config --- ../apt-cacher-ng-0.7.18.nen2//debian/apt-cacher-ng.config 2009-10-18 23:55:27.000000000 +0200 +++ ./debian/apt-cacher-ng.config 2013-10-10 07:26:34.684330786 +0200 @@ -1,5 +1,6 @@ #!/bin/sh -e +CONFIGFILE=/etc/apt-cacher-ng/deb.conf . /usr/share/debconf/confmodule #db_input medium apt-cacher-ng/modifytargets || true @@ -7,7 +8,29 @@ #db_get apt-cacher-ng/modifytargets || true +if [ -e $CONFIGFILE ]; then + CACHEDIR=` awk -F: '/CacheDir/ { print $2 }' $CONFIGFILE ` + PORT=` awk -F: '/\<Port/ { print $2 }' $CONFIGFILE ` + BINDADDRESS=` awk 'BEGIN { V="all" } \ + /^[[:space:]]*BindAddress[[:space:]]*:/ { V=substr($0,index($0,":")+1) } \ + END { print V }' $CONFIGFILE ` + PROXY=` awk 'BEGIN { V="none" } \ + /^[[:space:]]*Proxy[[:space:]]*:/ { V=substr($0,index($0,":")+1) } \ + END { print V }' $CONFIGFILE ` + + # Store values from config file into + # debconf db. + db_set apt-cacher-ng/cachedir "$CACHEDIR" + db_set apt-cacher-ng/bindaddress "$BINDADDRESS" + db_set apt-cacher-ng/port "$PORT" + db_set apt-cacher-ng/proxy "$PROXY" +fi + #if [ "$RET" = "true" ] ; then db_input medium apt-cacher-ng/gentargetmode || true + db_input low apt-cacher-ng/proxy || true + db_input low apt-cacher-ng/cachedir || true + db_input low apt-cacher-ng/bindaddress || true + db_input low apt-cacher-ng/port || true db_go #fi debian/apt-cacher-ng.postinst --- ../apt-cacher-ng-0.7.18.nen2//debian/apt-cacher-ng.postinst 2013-05-12 13:57:54.000000000 +0200 +++ ./debian/apt-cacher-ng.postinst 2013-10-10 07:26:34.688330786 +0200 @@ -3,7 +3,9 @@ . /usr/share/debconf/confmodule NAME=apt-cacher-ng -CDIR=/var/cache/$NAME +CONFIGFILE=/etc/$NAME/deb.conf +db_get $NAME/cachedir +CDIR="$RET" LDIR=/var/log/$NAME SLIST=/etc/apt/sources.list CFG=/etc/apt-cacher-ng @@ -122,6 +124,49 @@ gen_mirror_list_from_sources_list $CFG/backends_debvol $DDIR/debvol_mirrors.gz } +# Generate debconf-aware configuration file, if not exists +if [ ! -e $CONFIGFILE ]; then + cat << HERE > $CONFIGFILE + +# Letter case in directive names do matter for debconf, +# for the apt-cacher-ng deamon it doesn't matter. +# Must be separated with colons. +# Valid boolean values are a zero number for false, non-zero numbers for true. + +# The specification of another proxy which shall be used for downloads. +# See manual for limitations. +# Username and password are optional. Examples given +# http://www-proxy.example.net:80 +# username:proxypassw...@proxy.example.net:3128 +# When none wanted, comment out but keep the Parameter Keyword +#Proxy: to keep this Parameter Keyword + +# TCP (http) port +# Set to 9999 to emulate apt-proxy +Port:3142 + +# Addresses or hostnames to listen on. Multiple addresses must be separated by +# spaces. Each entry must be an exact local address which is associated with a +# local interface. DNS resolution is performed using getaddrinfo(3) for all +# available protocols (IPv4, IPv6, ...). Using a protocol specific format will +# create binding(s) only on protocol specific socket(s) (e.g. 0.0.0.0 will listen +# only to IPv4). +# +# Example: localhost 192.168.7.254 publicNameOnMainInterface +# +# When all wanted, comment out but keep the Parameter Keyword +# +# Default: not set, will listen on all interfaces and protocols +# +#BindAddress: to keep this Parameter Keyword + +# Where to store what we aiming to cache +CacheDir: /var/cache/apt-cacher-ng + +# l l +HERE +fi + if [ "$1" = "configure" ]; then # user should exist. adduser sometimes fails (system range issue) but that's ok @@ -149,6 +194,32 @@ ;; esac + db_get $NAME/bindaddress + BINDADDRESS="$RET" + if [ x"$BINDADDRESS" = x"all" ] ; then + BINDADDRESS='#BindAddress: to keep this Parameter Keyword' + else + BINDADDRESS="BindAddress: $BINDADDRESS" + fi + db_get $NAME/port + PORT="$RET" + db_get $NAME/proxy + PROXY="$RET" + if [ x"$PROXY" = x"none" ] ; then + PROXY='#Proxy: to keep this Parameter Keyword' + else + PROXY="Proxy: $PROXY" + fi + + cp -a -f $CONFIGFILE $CONFIGFILE.tmp + + sed -e "s~^ *CacheDir:.*~CacheDir: $CDIR~" \ + -e "s/.*BindAddress.*/$BINDADDRESS/" \ + -e "s/^ *Port:.*/Port:$PORT/" \ + -e "s'.*Proxy.*'$PROXY'" \ + < $CONFIGFILE > $CONFIGFILE.tmp + mv -f $CONFIGFILE.tmp $CONFIGFILE + db_stop || true rm -f $CFG/in.acng $CFG/mount.acng debian/apt-cacher-ng.postrm --- ../apt-cacher-ng-0.7.18.nen2//debian/apt-cacher-ng.postrm 2013-05-29 22:32:41.000000000 +0200 +++ ./debian/apt-cacher-ng.postrm 2013-10-10 07:26:34.688330786 +0200 @@ -1,7 +1,11 @@ #!/bin/sh -e +. /usr/share/debconf/confmodule + NAME=apt-cacher-ng -CDIR=/var/cache/$NAME +CONFIGFILE=/etc/$NAME/deb.conf +db_get $NAME/cachedir +CDIR="$RET" LDIR=/var/log/$NAME if [ "$1" = "purge" ]; then @@ -10,6 +14,7 @@ rm -f $LDIR/apt-cacher.err $LDIR/apt-cacher.log $LDIR/apt-cacher.log.* $LDIR/maint_*.log rmdir $LDIR 2>/dev/null || true rm -rf /var/lib/apt-cacher-ng + rm -rf $CONFIGFILE dpkg-statoverride --remove /etc/apt-cacher-ng/security.conf 2>/dev/null || true conf/acng.conf --- ../apt-cacher-ng-0.7.18.nen2//conf/acng.conf 2013-07-28 20:09:43.000000000 +0200 +++ ./conf/acng.conf 2013-10-10 07:26:34.688330786 +0200 @@ -2,7 +2,9 @@ # Letter case in directive names does not matter. Must be separated with colons. # Valid boolean values are a zero number for false, non-zero numbers for true. -CacheDir: /var/cache/apt-cacher-ng +# For your information: +# Keywords as 'Proxy', 'BindAddress, 'Port' and 'CacheDir' +# are now in another configuration file # set empty to disable logging LogDir: /var/log/apt-cacher-ng @@ -11,27 +13,6 @@ # found in the configuration directory # SupportDir: /usr/lib/apt-cacher-ng -# TCP (http) port -# Set to 9999 to emulate apt-proxy -Port:3142 - -# Addresses or hostnames to listen on. Multiple addresses must be separated by -# spaces. Each entry must be an exact local address which is associated with a -# local interface. DNS resolution is performed using getaddrinfo(3) for all -# available protocols (IPv4, IPv6, ...). Using a protocol specific format will -# create binding(s) only on protocol specific socket(s) (e.g. 0.0.0.0 will listen -# only to IPv4). -# -# Default: not set, will listen on all interfaces and protocols -# -# BindAddress: localhost 192.168.7.254 publicNameOnMainInterface - -# The specification of another proxy which shall be used for downloads. -# Username and password are, and see manual for limitations. -# -#Proxy: http://www-proxy.example.net:80 -#proxy: username:proxypassw...@proxy.example.net:3128 - # Repository remapping. See manual for details. # In this example, some backends files might be generated during package # installation using information collected on the system. source/acfg.cc --- ../apt-cacher-ng-0.7.18.nen2//source/acfg.cc 2013-08-12 10:51:40.000000000 +0200 +++ ./source/acfg.cc 2013-10-10 07:26:34.688330786 +0200 @@ -1058,6 +1058,7 @@ _ReadMainConfiguration(*it); #else _ReadMainConfiguration(confdir+SZPATHSEP"acng.conf"); + _ReadMainConfiguration(confdir+SZPATHSEP"deb.conf"); #endif } debian/changelog --- ../apt-cacher-ng-0.7.18.nen2//debian/changelog 2013-08-20 00:47:19.000000000 +0200 +++ ./debian/changelog 2013-10-17 21:58:24.954370316 +0200 @@ -1,3 +1,9 @@ +apt-cacher-ng (0.7.18-1.1) UNRELEASED; urgency=low + + * debconf for Proxy, Bindaddress, Port and CacheDir (closes: #726656) + + -- Geert Stappers <stapp...@stappers.nl> Thu, 17 Oct 2013 21:57:34 +0200 + apt-cacher-ng (0.7.18-1) unstable; urgency=medium * New upstream release Done creating patch Groeten Geert Stappers -- Leven en laten leven -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org