On Thu, Aug 23, 2012 at 09:06:07AM +0200, Andreas Tille wrote:

Hi Andreas,

> from a not so quick but untested look this seems to be reasonable to me.
> I could sponsor this patch but I might wait for some comment of the
> release team

Thanks for the review.

A new version of the patch is attached. Only the changelog is different, based
on the review and ack by the release team:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=685354#56

Can you sponsor it?

BTW if you build the package, be careful to avoid changes in the autogenerated
files. If you build twice in the same buildtree, the diff.gz contains unwanted
changes.

Cheers,

Ivo

diff -u sendfile-2.1b.20080616/debian/control sendfile-2.1b.20080616/debian/control
--- sendfile-2.1b.20080616/debian/control
+++ sendfile-2.1b.20080616/debian/control
@@ -9,7 +9,7 @@
 Section: net
 Priority: optional
 Architecture: any
-Depends: ${shlibs:Depends}, openbsd-inetd | inet-superserver, perl | perl5
+Depends: ${shlibs:Depends}, openbsd-inetd | inet-superserver, perl | perl5, update-inetd, libdpkg-perl
 Suggests: pgp-i
 Description: Simple Asynchronous File Transfer
  Sendfile is an asynchronous file transfer service for the Internet,
diff -u sendfile-2.1b.20080616/debian/postinst sendfile-2.1b.20080616/debian/postinst
--- sendfile-2.1b.20080616/debian/postinst
+++ sendfile-2.1b.20080616/debian/postinst
@@ -2,20 +2,7 @@
 # post install script for the Debian GNU/Linux sendfile package
 
 require DebianNet;
-
-# First modify the services file
-
-open(SERVICES, "/etc/services");
-    @services=<SERVICES>;
-close(SERVICES);
-
-if (! grep(/^saft.*/, @services)) {
-   push (@services, "saft		487/tcp			# simple asynchronous file transfer\n");
-   open(SERVICES, ">/etc/services.new");
-   print SERVICES @services;
-   close (SERVICES);
-   system ("mv -f /etc/services.new /etc/services");
-}
+use Dpkg::Version;
 
 # Now modify the inetd.conf file
 
@@ -29,30 +16,38 @@
 }
 undef(@inetd);
 
-for $profile (('/etc/profile')) {
-    open(PROFILE, "$profile");
-    @profile=<PROFILE>;
-    close(PROFILE);
-
-    open(PROFILE, ">$profile");
-    printf PROFILE "%s", join ('', grep (!/^.*check-sendfile/, @profile));
-    close (PROFILE);
+# cleanup edits from versions before 2.1b.20080616-5.2
+# this can be removed after wheezy
+if (($ARGV[1] ne "") &&
+	(version_compare($ARGV[1],"2.1b.20080616-5.2") < 0)) {
+	
+	# remove line added by old version of sendfile
+	my $profile = '/etc/profile';
+	if (-e $profile) {
+		open(PROFILE, "$profile");
+		@profile=<PROFILE>;
+		close(PROFILE);
+
+		open(PROFILE, ">$profile");
+		printf PROFILE "%s", join ('', grep (!/^.*check-sendfile/, @profile));
+		close (PROFILE);
+	}
+
+	# delete /etc/services with only 1 line created by previous versions of
+	# sendfile
+	my $services = "/etc/services";
+	if (-e $services) {
+		open(SERVICES, $services);
+		my @srv = <SERVICES>;
+		close(SERVICES);
+		my $srv = join('',@srv);
+		my $oldsrv = "saft		487/tcp			# simple asynchronous file transfer\n";
+		if ($srv eq $oldsrv) {
+			unlink $services;
+		}
+	}
 }
 
-for $profile (('/etc/csh.login')) {
-    open(PROFILE, "$profile");
-    @profile=<PROFILE>;
-    close(PROFILE);
-
-    if (grep(/^.*check-sendfile/, @profile)) {
-	open(PROFILE, ">$profile");
-	printf PROFILE "%s", join ('', grep (!/^.*check-sendfile/, @profile));
-	close(PROFILE);
-    }
-}
-
-system "/etc/init.d/netbase reload";
-
 if ($ARGV[0] eq 'configure') {
     if (defined $ARGV[1] && $ARGV[1] =~ /2\.1b(-[67]|\.20080311-|\.20080616-1)/) {
 	system "chmod 644 /etc/logrotate.d/sendfile";
diff -u sendfile-2.1b.20080616/debian/postrm sendfile-2.1b.20080616/debian/postrm
--- sendfile-2.1b.20080616/debian/postrm
+++ sendfile-2.1b.20080616/debian/postrm
@@ -3,15 +3,6 @@
 
 set -e
 
-if [ "$1" = "remove" ]
-then
-    for profile in /etc/profile /etc/csh.login
-    do
-	grep -v 'check-sendfile' $profile > $profile.new || true
-	mv -f $profile.new $profile
-    done
-fi
-
 if [ "$1" = "purge" ]
 then
   rm -rf /var/log/sendfile >/dev/null
diff -u sendfile-2.1b.20080616/debian/changelog sendfile-2.1b.20080616/debian/changelog
--- sendfile-2.1b.20080616/debian/changelog
+++ sendfile-2.1b.20080616/debian/changelog
@@ -1,3 +1,24 @@
+sendfile (2.1b.20080616-5.2) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Don't edit /etc/services, /etc/profile and /etc/csh.login
+  * Cleanup edits to those files from previous versions
+    Closes: #685631
+  * Depend on update-inetd because the postinst script requires the perl
+    module DebianNet
+  * Depend on libdpkg-perl for version checks in postinst script
+
+ -- Ivo De Decker <ivo.dedec...@ugent.be>  Sat, 25 Aug 2012 11:03:41 +0200
+
+sendfile (2.1b.20080616-5.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Remove all files on purge.  Thanks for the patch to
+    Andreas Beckmann <deb...@abeckmann.de>
+    Closes: #668721
+
+ -- Andreas Tille <ti...@debian.org>  Thu, 09 Aug 2012 15:03:55 +0200
+
 sendfile (2.1b.20080616-5) unstable; urgency=low
 
   * Add new config file /etc/profile.d/sendfile and remove old line from

Reply via email to