[debian-edu-commits] debian-edu/ 01/30: Import build rules for the killer package version 0.90-2.

Alexander Alemayhu ccscanf-guest at moszumanska.debian.org
Mon Jun 9 20:30:29 UTC 2014


This is an automated email from the git hooks/post-receive script.

ccscanf-guest pushed a commit to branch master
in repository killer.

commit e9f51270a71fa7e66d82753ae9c534e1d232e51c
Author: Petter Reinholdtsen <pere at hungry.com>
Date:   Tue Feb 26 08:48:11 2008 +0000

    Import build rules for the killer package version 0.90-2.
---
 debian/changelog                         |  25 +++++++
 debian/compat                            |   1 +
 debian/control                           |  20 +++++
 debian/copyright                         |  15 ++++
 debian/cron.hourly                       |   3 +
 debian/patches/00list                    |   8 ++
 debian/patches/console-devs.dpatch       |  16 ++++
 debian/patches/empty-domain.dpatch       |  19 +++++
 debian/patches/ignore-system-uids.dpatch |  47 ++++++++++++
 debian/patches/no-kill-opt.dpatch        | 121 +++++++++++++++++++++++++++++++
 debian/patches/posix-locale.dpatch       |  17 +++++
 debian/patches/proper-clean.dpatch       |  16 ++++
 debian/patches/ps-path.dpatch            |  17 +++++
 debian/patches/x-console.dpatch          |  29 ++++++++
 debian/rules                             |  18 +++++
 15 files changed, 372 insertions(+)

diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..f735304
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,25 @@
+killer (0.90-2) unstable; urgency=low
+
+  * Split all patches into separate files in debian/patch, to make
+    them easier to submit upstream.  Uses dpatch.
+  * Added patch to handle kdm and gdm logins better.
+  * Added patch to implement new option -n to tryrun only (not killing
+    anything) and -d for debug output.
+  * Make sure to use LC_ALL=POSIX to avoid different output depending
+    on locale.
+  * Add /dev/input/mice to list of devices to check for the console user.
+
+ -- Petter Reinholdtsen <pere at debian.org>  Sat, 16 Feb 2008 14:30:41 +0100
+
+killer (0.90-1) unstable; urgency=low
+
+  * Initial upload (Closes: #463161).
+  * Patches relative to upstream:
+    - Do not kill processes belonging to users with uid below 1000.
+    - Correct path to the ps command.
+    - Make sure to work even without the domainname program.
+    - Fix clean target to remove files generated by pod2html generated.
+  * Add cron.hourly file to call killer once an hour to kill
+    background jobs.
+
+ -- Petter Reinholdtsen <pere at debian.org>  Wed, 30 Jan 2008 13:59:09 +0100
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..7ed6ff8
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..cd3424b
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,20 @@
+Source: killer
+Section: misc
+Priority: optional
+Maintainer: Petter Reinholdtsen <pere at debian.org>
+Build-Depends: debhelper (>= 5.0.0), cdbs, perl, dpatch
+Standards-Version: 3.7.3
+
+Package: killer
+Architecture: all
+Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, exim4 | mail-transport-agent
+Description: Background job killer
+ killer is a perl script that gets rid of background jobs. Background
+ jobs are defined as processes that belong to users who are not currently
+ logged into the machine. Jobs can be run in the background (and are
+ expempt from *killer*'s acctions) if their scheduling priority has been
+ reduced by increasing their nice(1) value or if they are being run
+ through condor.
+ .
+ When the package is installed, a cron job is installed to run killer
+ once an hour.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..e30c3d2
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,15 @@
+This package was debianized by the author Petter Reinholdtsen
+<pere at hungry.com> on Tue Jan 29 22:00:27 CET 2008.
+
+It was downloaed from
+<URL:http://homepages.cae.wisc.edu/~gerdts/killer/>.
+
+The killer package is copyright Michael Gerdts <mgerdts at gmail.com>.
+
+These scripts are 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; either version 2, or (at your option) any
+later version.
+
+On Debian GNU/Linux systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL'.
diff --git a/debian/cron.hourly b/debian/cron.hourly
new file mode 100644
index 0000000..b21db4d
--- /dev/null
+++ b/debian/cron.hourly
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+[ -x /usr/sbin/killer ] && /usr/sbin/killer
diff --git a/debian/patches/00list b/debian/patches/00list
new file mode 100644
index 0000000..0524522
--- /dev/null
+++ b/debian/patches/00list
@@ -0,0 +1,8 @@
+empty-domain
+ignore-system-uids
+ps-path
+x-console
+proper-clean
+no-kill-opt
+posix-locale
+console-devs
diff --git a/debian/patches/console-devs.dpatch b/debian/patches/console-devs.dpatch
new file mode 100644
index 0000000..390537c
--- /dev/null
+++ b/debian/patches/console-devs.dpatch
@@ -0,0 +1,16 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+
+Check relevant devices for console access.
+
+ at DPATCH@
+--- killer-0.90.orig/killer
++++ killer-0.90/killer
+@@ -963,7 +963,7 @@
+     if ( $consoleuser eq $user ) {
+ 	my (@statparts, $device);
+ 	foreach $device ( '/dev/ps2mouse', '/dev/ps2kbd', '/dev/mouse', 
+-	                  '/dev/kbd' ) {
++	                  '/dev/kbd', '/dev/input/mice' ) {
+ 	    @statparts = stat($device);
+ 	    next unless defined($statparts[8]);
+ 
diff --git a/debian/patches/empty-domain.dpatch b/debian/patches/empty-domain.dpatch
new file mode 100644
index 0000000..d5739d2
--- /dev/null
+++ b/debian/patches/empty-domain.dpatch
@@ -0,0 +1,19 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+
+Use 'localhost' as domain if it is currently unset.
+
+ at DPATCH@
+diff -u killer-0.90/killer killer-0.90/killer
+--- killer-0.90/killer
++++ killer-0.90/killer
+@@ -1042,8 +1042,9 @@
+ # Configuration options:
+ # ########
+ 
++my $domainname = `domainname 2>/dev/null || true`;
+-my $domainname = `domainname`;
+ chop $domainname;
++$domainname = "localhost" unless ($domainname);
+ 
+ =item $forkadmin
+ 
diff --git a/debian/patches/ignore-system-uids.dpatch b/debian/patches/ignore-system-uids.dpatch
new file mode 100644
index 0000000..06c7db2
--- /dev/null
+++ b/debian/patches/ignore-system-uids.dpatch
@@ -0,0 +1,47 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+
+Make sure to not kill processes for system users (uid < 1000).
+
+ at DPATCH@
+--- killer-0.90.orig/killer
++++ killer-0.90/killer
+@@ -1085,6 +1086,14 @@
+ 
+ my @validusers = ( 'condor', 'root', 'daemon' );
+ 
++=item $minuid
++
++Do not kill processes of users with uid lower than this value.
++
++=cut
++
++my $minuid = 1000;
++
+ =item $maxidletime
+ 
+ The maximum number of seconds that a user can be idle without being
+@@ -1123,6 +1132,7 @@
+ my @ttys;
+ my @users;
+ my $user;
++my $uid;
+ 
+ =head2 gatherInfo
+ 
+@@ -1205,6 +1215,16 @@
+ 
+ =item *
+ 
++Removes all processes of users with uid lower than the $minuid value.
++
++=cut
++
++    foreach $uid ( 0 .. $minuid-1 ) {
++	$ptable->removeProcesses('uid', $uid);
++    }
++
++=item *
++
+ Finally, the process table and terminal objects are returned.
+ 
+ =back
diff --git a/debian/patches/no-kill-opt.dpatch b/debian/patches/no-kill-opt.dpatch
new file mode 100644
index 0000000..96351c0
--- /dev/null
+++ b/debian/patches/no-kill-opt.dpatch
@@ -0,0 +1,121 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+
+New option -n to not kill, just print out what would be killed.
+
+ at DPATCH@
+diff -urNad killer-0.90~/killer killer-0.90/killer
+--- killer-0.90~/killer	2008-02-16 13:25:28.000000000 +0100
++++ killer-0.90/killer	2008-02-16 13:27:50.000000000 +0100
+@@ -36,7 +36,7 @@
+ 
+ =head1 SYNOPSIS
+ 
+-killer [B<-h>] [B<-V>]
++killer [B<-h>] [B<-V>] [B<-n>] [B<-d>]
+ 
+ =head1 DESCRIPTION
+ 
+@@ -66,6 +66,14 @@
+ 
+ Display version number
+ 
++=item -n
++
++Do not kill, just print what would be killed
++
++=item -d
++
++Enable debug output
++
+ =back
+ 
+ =cut
+@@ -145,6 +153,8 @@
+ my %pid2nice = ();	# nice value
+ my %pid2comm = ();	# Command name being executed
+ my %remainingprocs = (); # The processes that have not been eliminated
++my $noop = 0;
++my $debug = 0;
+ 
+ =head2 new
+ 
+@@ -220,7 +230,7 @@
+     # skip the first line of input
+     <PS>;
+     while (<PS>) {
+-	#print "\t$_";
++	print "\t$_" if $debug;
+ 	chop;
+ 
+ 	# strip leading white space
+@@ -805,11 +815,16 @@
+     my $killcount = 0;
+ 
+     foreach my $pid ( keys %remainingprocs ) {
+-	if ( kill($signum, $pid) > 0 ) {
+-	    $killcount ++;
+-	    syslog('info', "kill($signum, $pid) user=%s command=%s nice=%d",
++        my $msg = sprintf("kill($signum, $pid) user=%s command=%s nice=%d",
+ 	                     $pid2ruser{$pid}, $pid2comm{$pid},
+                              $pid2nice{$pid});
++        if ($noop) {
++            print "$msg\n";
++        } else {
++            if ( kill($signum, $pid) > 0 ) {
++                $killcount ++;
++                syslog('info', "%s", $msg);
++            }
+ 	}
+     }
+     return $killcount;
+@@ -1014,6 +1029,14 @@
+             print STDERR "Type \"perldoc $0\" for lots of help.\n";
+             next;
+         };
++        $opt eq '-n' && do {
++            $noop = 1;
++            next;
++        };
++        $opt eq '-d' && do {
++            $debug = 1;
++            next;
++        };
+         $opt eq '-V' && do {
+             print STDERR "killer version $version\n";
+             next;
+@@ -1021,7 +1044,7 @@
+         print STDERR "killer: option \"$opt\" not recognized\n";
+         print STDERR "Type \"perldoc $0\" for lots of help.\n";
+     }
+-    exit(1);
++    exit(1) unless ($noop || $debug);
+ }
+ 
+ =head1 PACKAGE main
+@@ -1269,7 +1269,7 @@
+ print $outfile "Attempt 1: Nicely killing the following processes\n";
+ $ptable->printRemainingProcesses($outfile);
+ $ptable->killAll(15);
+-sleep(30);
++sleep(30) unless $noop;
+ $ptable->killAll(9);
+ 
+ # #########
+@@ -1279,7 +1279,7 @@
+ # be spawned.  This should catch fork() bombs as well
+ # ##########
+ 
+-sleep(5);
++sleep(5) unless $noop;
+ ($ptable, $term) = gatherInfo();
+ ( @remaining ) = $ptable->getRemainingProcesses();
+ if ( $#remaining == -1 ) {
+@@ -1301,7 +1301,7 @@
+ # the processes.  Let's just whine through email.
+ # ########
+ 
+-sleep(5);
++sleep(5) unless $noop;
+ ($ptable, $term) = gatherInfo();
+ ( @remaining ) = $ptable->getRemainingProcesses();
+ if ( $#remaining == -1 ) {
diff --git a/debian/patches/posix-locale.dpatch b/debian/patches/posix-locale.dpatch
new file mode 100644
index 0000000..de46762
--- /dev/null
+++ b/debian/patches/posix-locale.dpatch
@@ -0,0 +1,17 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+
+Make sure all processes have a well defined locale.
+
+ at DPATCH@
+diff -urNad killer-0.90~/killer killer-0.90/killer
+--- killer-0.90~/killer	2008-02-16 12:42:01.000000000 +0100
++++ killer-0.90/killer	2008-02-16 12:42:01.000000000 +0100
+@@ -1125,6 +1125,8 @@
+ # End of (intended) configuration options.
+ # ########
+ 
++$ENV{LC_ALL} = 'POSIX';
++
+ =back
+ 
+ If I am a user really trying to avoid a background job killer, I would
diff --git a/debian/patches/proper-clean.dpatch b/debian/patches/proper-clean.dpatch
new file mode 100644
index 0000000..71fc609
--- /dev/null
+++ b/debian/patches/proper-clean.dpatch
@@ -0,0 +1,16 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+
+Remove generated files.
+
+ at DPATCH@
+--- killer-0.90.orig/Makefile
++++ killer-0.90/Makefile
+@@ -19,7 +19,7 @@
+ 	pod2text $(SCRIPTNAME) > $(SCRIPTNAME).txt
+ 
+ clean:
+-	-rm -f $(TARGETS) pod2html-*cache
++	-rm -f $(TARGETS) pod2html-*cache pod2htm*.tmp
+ 
+ install:
+ 	@echo "You probably want to customize the script then copy it into place yourself." 1>&2
diff --git a/debian/patches/ps-path.dpatch b/debian/patches/ps-path.dpatch
new file mode 100644
index 0000000..93b0e9c
--- /dev/null
+++ b/debian/patches/ps-path.dpatch
@@ -0,0 +1,17 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+
+Fix path to ps.
+
+ at DPATCH@
+diff -urNad killer-0.90~/killer killer-0.90/killer
+--- killer-0.90~/killer	2008-02-16 12:42:19.000000000 +0100
++++ killer-0.90/killer	2008-02-16 12:42:19.000000000 +0100
+@@ -132,7 +132,7 @@
+ =cut
+ 
+ # On HP-UX be sure that env var UNIX95 is defined for ps -o to work!
+-my $pscmd = '/usr/bin/ps -e -o "user ruser uid ruid tty pid ppid nice comm"';
++my $pscmd = '/bin/ps -e -o "user ruser uid ruid tty pid ppid nice comm"';
+ 
+ my $errmsg;
+ 
diff --git a/debian/patches/x-console.dpatch b/debian/patches/x-console.dpatch
new file mode 100644
index 0000000..7b932d5
--- /dev/null
+++ b/debian/patches/x-console.dpatch
@@ -0,0 +1,29 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+
+Detect kdm and gdm logins as console users.
+This is example output from who in this case:
+
+% who
+kdmuser :0           2008-01-22 15:58
+%
+
+% who
+gdmuser tty7         2008-02-14 20:21 (:0)
+%
+
+ at DPATCH@
+diff -urNad killer-0.90~/killer killer-0.90/killer
+--- killer-0.90~/killer	2008-02-16 12:00:47.000000000 +0100
++++ killer-0.90/killer	2008-02-16 12:01:45.000000000 +0100
+@@ -876,7 +876,10 @@
+     while ( <W> ) {
+ 	chop;
+ 	@parts = split(/[ \t]+/);
+-	if ( $parts[1] eq 'console' ) {
++	if ( $parts[1] eq 'console'
++	     || $parts[1] eq ':0'        # kdm
++	     || $parts[1] =~ '^tty\d$'   # gdm
++           ) { 
+ 	    $consoleuser = $parts[0];
+ 	}
+ 	$self->initializeTty($parts[1], stat("/dev/" . $parts[1]));
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..28ae2c2
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,18 @@
+#!/usr/bin/make -f
+
+include /usr/share/cdbs/1/class/makefile.mk
+include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/rules/dpatch.mk
+
+DEB_MAKE_CLEAN_TARGET = clean
+
+DEB_INSTALL_DOCS_ALL = ChangeLog
+
+DESTDIR = debian/$(cdbs_curpkg)$(pkgdir)
+bindir  = /usr/sbin
+man1dir = /usr/share/man/man1
+
+install/killer::
+	install -d $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir)
+	install killer $(DESTDIR)$(bindir)
+	install -m 644 killer.1 $(DESTDIR)$(man1dir)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-edu/pkg-team/killer.git



More information about the debian-edu-commits mailing list