debian/0000775000000000000000000000000012244400157007167 5ustar debian/console-log.postrm0000664000000000000000000000060312244400147012654 0ustar #!/bin/sh -e # postrm USERNAME="Debian-console-log" #DEBHELPER# [ -n "$CONLOGDEBUG" ] && set -x if [ "$1" = "purge" ]; then if command -v deluser >/dev/null; then echo >&2 'Removing system user' deluser --remove-home --system $USERNAME || deluser --system $USERNAME else echo >&2 'Not removing system user, deluser not found' fi fi # end of file debian/README.Debian-accountname0000664000000000000000000000547612244400147013536 0ustar Q: The user name Debian-$PACKAGE is too long: it misalignes ls output and is truncated by ps and atop. And it's ugly! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Answer: The user name Debian-$PACKAGE was chosen in late 2003 when we, the maintainers of the Debian exim4 package found it necessary to create an account for exim to run under during package installation. To avoid accidentylly zapping a locally used account, we intended to use a name from a name space with low potential for name conflicts. About the same time, Fabio Massimo Di Nitto started the same discussion on debian devel (thread starting with http://lists.debian.org/debian-devel/2003/11/msg02231.html). In this thread, many things were said: - This should be decided by the LSB. - However, to my knowledge, that step has not yet happened. - It needs to be in policy. - However, policy has not been amended, and there is no bug filed against policy. - Purging a package should remove the account as well. - Special care needs to be taken to avoid removing an account that doesn't belong to us. - numeric UID shouldn't be re-used. For the namespaces, we have the following suggestions: - Prepend/Append "Debian" or "debian" - Prepend/Append a capital letter (http://cr.yp.to/unixaccount.html) - Prepend/Append an underscore Unfortunately, the way to get a LSB solution will take way too long. Additionally, the LSB likes to have pre-existing use as example before they change the standard. So, it was our job to decide which account name to use. Andreas Metzler and me chose Debian-$PACKAGE, while Peter Palfrader started using debian-$PACKAGE. So we currently have Debian-exim, Debian-console-log, debian-tor, debian-mixminion and debian-sks. Again, the goal was to create accounts that don't conflict with other, or with manually created accounts, and to get pre-existing use before trying to change the LSB and even Debian policy. Migrating from one account name to another is extremely painful and error-pronce since one needs to meddle with the local account database and has to optionally chown files. Additionally, it is necessary to change every script that accesses the account. To put it short: It's something you want to avoid. This is also the reason while the account names used by these packages will not likely change before a namespace is dedicated and allocated either in the LSB or in Debian policy. The maintainers reserve the right of hurling this FAQ in the direction of everybody filing bugs about the "ugly" account names, and to close the bugs in the process. We would appreciate, however, if people would aid in getting the standardization process under way as soon as possible. This needs to be in policy, the sooner the better. Marc Haber, 2004-05-11 debian/changelog0000664000000000000000000002523012244400147011042 0ustar console-log (1.2-1) unstable; urgency=low * make logpager configurable, add pager-specific configuration. * re-work docs, include docs for pager-specific configuration * this now allowes re-reading of a rotated log (Closes: #111272) * remove /usr/local from local path. * use long options for less (jless supports them now) * debhelper 9, package format 3.0 quilt * move /var/run to /run * move default home directory of account to /nonexistent * machine readable copyright file * change license to GPL2+ * add Vcs and Homepage fields * make short package description clearer * remove exim 3's /var/log/exim/mainlog from default config * remove TODO file * Standards-Version: 3.9.5 (no other changes necessary) -- Marc Haber Sun, 24 Nov 2013 14:34:18 +0100 console-log (1.1-2) unstable; urgency=low * Stop postrm from failing in some obscure synthetic test environments. Closes: #604223 * Standards-Versions: 3.9.1 (no changes needed) -- Marc Haber Sun, 21 Nov 2010 17:11:12 +0100 console-log (1.1-1) unstable; urgency=low * remove debconf. Thanks to Christian Perrier. Closes: #578258 * The upstream version bump is necessary because of the debian/console-log.templates file in the .orig.tar.gz * remove convert-console-log.conf * Standards-Version: 3.9.0 (no changes necessary) -- Marc Haber Tue, 29 Jun 2010 21:21:38 +0200 console-log (1.0-17) unstable; urgency=low * The "Happy Birthday Sandra" upload. Thanks to bubulle. * Add Russian (ru) debconf messages. Thanks to Yuri Kozlov. Closes: #545218 * Add debian/source/format * Standards-Version. 3.8.4 (no changes necessary) -- Marc Haber Sun, 18 Apr 2010 12:47:56 +0200 console-log (1.0-16) unstable; urgency=low * Add Brazilian Portuguese (pt_BR) debconf messages. Thanks to Flamarion Jorge. Closes: #512455 * Standards-Version: 3.8.1 (no changes necessary) -- Marc Haber Sun, 07 Jun 2009 15:05:07 +0200 console-log (1.0-15) unstable; urgency=low * Fix wrong logic in /lib/lsb/init-functions processing. * Standards-Version: 3.8.0 (no changes necessary) -- Marc Haber Sat, 21 Jun 2008 16:17:52 +0200 console-log (1.0-14) unstable; urgency=low * fix typo in CONLOGDEBUG varaiable name * Invoke ulimit stuff in a subshell. Thanks to Martin Völlinger. Closes: #431006 * Use debian/compat instead of DH_COMPAT * Build-Depend on debhelper 5 -- Marc Haber Sun, 12 Aug 2007 21:38:31 +0200 console-log (1.0-13) unstable; urgency=low * Add Portuguese (pt) debconf messages. Thanks to Joao Estevao and Rui Branco. Closes: #378886 * create /var/run/console-log in init script. Closes: #390153 * Remove console-tools from Depends:. Closes: #387125 * Fix postrm to issue a correct deluser call and to gracefully handle deluser absence. Thanks to Bill Allombert. Closes: #389351 * lsb-ize init script. Closes: #377026 * Wiggle around build-depends until lintian is happy * Standards-Version: 3.7.2 (no changes necessary) -- Marc Haber Mon, 2 Oct 2006 08:54:24 +0000 console-log (1.0-12) unstable; urgency=low * Add Spanish (es) debconf messages. Thanks to César Gómez Martín. Closes: #334553. -- Marc Haber Fri, 18 Nov 2005 12:43:51 +0000 console-log (1.0-11) unstable; urgency=low * Add Czech (cz) debconf messages. Thanks to Martin Sin. Closes: #306444. * Add Vietnamese (ci) debconf messages. Thanks to Clytie Siddall. Closes: #310061 * Add Swedish (sv) debconf messages. Thanks to Daniel Nylander. Closes: #333481 * fix syntax error in changelog. * eliminate possible bashism ([ .. -a .. ]) from console-log.config. * Standards-Version: 3.6.2 (no changes needed) -- Marc Haber Wed, 12 Oct 2005 11:41:08 +0000 console-log (1.0-10) unstable; urgency=low * fix find options in init.d script. Thanks to Andreas Metzler. Closes: #280226. * fix typo in console-log.conf. Thanks to Martin Schwarz. Closes: #284810. * add Italian debconf messages. Thanks to Luca Monducci. Closes: #277928. * introduce maxfilesize option. If a file to be pages exceeds the configured size, no pager is started. * set ulimit -v for the pager. Closes: #280528. * invoke debconf-updatepo in debian/rules clean. -- Marc Haber Thu, 16 Dec 2004 15:51:03 +0000 console-log (1.0-9) unstable; urgency=low * handle/ignore openvt errors to fail gracefully on headless systems. -- Marc Haber Sun, 8 Aug 2004 09:55:42 +0000 console-log (1.0-8) unstable; urgency=low * add "no upstream" clause in debian/control * add README.Debian-accountname * add German debconf messages. Thanks to Erik Schanze. Closes: #251106. * modify init script and logpager to invoke less with -Pw and allow more pager flexibility. Closes: #254078. * use dh_installman instead of dh_installmanpages -- Marc Haber Mon, 26 Jul 2004 15:07:30 +0000 console-log (1.0-7) unstable; urgency=low * adapt console-log.conf man page to the current situation, add a paragraph babbling about permission issues with exim 3's log files (see also #245516), fix broken formatting. -- Marc Haber Mon, 26 Apr 2004 10:35:54 +0000 console-log (1.0-6) unstable; urgency=low * do not try to invoke pager if file is not readable by the target user. Closes: #245321. -- Marc Haber Mon, 26 Apr 2004 09:26:28 +0000 console-log (1.0-5) unstable; urgency=low * add Dutch debconf messages. Thanks to Luk Claes. Closes: #241432. * add || true to unset found in init script. This has caused failures on woody. * do not try to invoke pager if file is not readable by the target user. Closes: #245321. -- Marc Haber Tue, 13 Apr 2004 19:48:32 +0000 console-log (1.0-4) unstable; urgency=low * add Danish debconf messages. Thanks to Claus Hindsgaul. Closes: #236860. * add Japanese debconf messages. Thanks to Hideki Yamane. Closes: #227201. * fix two typo in console-log.conf.pod. Closes: #229956. Thanks to Andreas Metzler. * change default config to /var/log/exim4/mainlog * Create user account in postinst and run logpager with that account. Versioned depend on shadow, because earlier addgroup doesn't like the group name. Closes: #226461. * Depend on console-tools | kbd. Thanks to Adeodato Simó. Closes: #230683. * Allow multiple files in the file line, less the first file found. Adapt docs. New /etc/console-log.conf with paths to exim, exim4, sendmail and postfix log files. Closes: #240461. -- Marc Haber Tue, 30 Mar 2004 08:52:56 +0000 console-log (1.0-3) unstable; urgency=low * add french debconf template from Christian Perrier (Closes: Bug#207053) -- Marc Haber Mon, 25 Aug 2003 06:00:21 +0000 console-log (1.0-2) unstable; urgency=low * fix typo in manpage (Closes: Bug#171358). * switch to gettext-based debconf templates by taking the Patch from Christian Perrier (Closes: Bug#205768) * have init script check for pager presence by taking the Patch from Dan Torop (Closes: Bug#206926) * make console-log.copyright copyright again, fix typo in license path. * Standards-Version: 3.6.1 -- Marc Haber Sun, 24 Aug 2003 10:42:22 +0000 console-log (1.0-1) unstable; urgency=low * no bug reports for 0.8-1 for a month, it's time for a release. -- Marc Haber Thu, 28 Nov 2002 17:48:17 +0000 console-log (0.8-1) unstable; urgency=low * is not a Debian native package any more. * introduce new config file format. * include conversion script. * give debconf warning on installation. * use invoke-rc.d in maintainer scripts (Closes: Bug#162694). * console-log.local replaced with individual local files. * new init script gives +F again (Closes: Bug#162640). * This version is considered a pre-release for a 1.0 version. -- Marc Haber Sat, 26 Oct 2002 09:38:03 +0000 console-log (0.7) unstable; urgency=low * ditch run, use daemon. * introduce /etc/console-log.local to allow the local admin to set environment variables for the logpager (Closes: Bug#158981). * move /usr/lib/console-log/logpager to /usr/share/console-log. * include man pages for the config files. -- Marc Haber Mon, 23 Sep 2002 10:18:54 +0000 console-log (0.6) unstable; urgency=low * Standards 3.5.6 * Upload with my own signature, unsponsored now. -- Marc Haber Sun, 2 Sep 2001 22:39:45 +0200 console-log (0.5) unstable; urgency=low * fixed init.d script breaking with sparse environment. * init.d script is now a bash script (Closes: Bug#87424). * added Build-Depends:. * Fixed quoting bug in init.d script (Closes: Bug#87641). * Made chvt optional (Closes: Bug#88983). * terminal is now cleared with TERM=vt100. This should work on the Linux console and nearly everywhere else. -- Marc Haber Thu, 1 Mar 2001 11:38:08 +0100 console-log (0.4) unstable; urgency=low * modified pager scripts to use short options because jless doesn't have long options (closes: Bug#64444) * console-log now Depends: on run (>= 0.9.2-4). (closes: Bug#75215) (closes: Bug#79050) (closes: Bug#64295) (closes: Bug#68398) * bashism removed from init script (closes: Bug#66821) * now starts in postinst * now stops in prerm * remove bashism "function" from init script * implement config file (closes: Bug#77654) (closes: Bug#71281). Generating that config file during installation is left as exercise to the reader. Debconf would be nice ;) * is now an architecture: all package -- Marc Haber Sat, 24 Jan 2001 13:58:31 +0100 console-log (0.3) unstable; urgency=low * applied patch given by Roman Hodek to make package compile on m68k (closes: Bug#64136) -- Marc Haber Mon, 15 May 2000 13:54:43 +0200 console-log (0.2) unstable; urgency=low * clear consoles after stop * set LESSSECURE to prevent shell escapes -- Marc Haber Wed, 26 Apr 2000 18:19:44 +0200 console-log (0.1) unstable; urgency=low * Initial release -- Marc Haber Wed, 26 Apr 2000 10:15:30 +0200 debian/control0000664000000000000000000000174512244400147010600 0ustar Source: console-log Section: admin Priority: optional Maintainer: Marc Haber Standards-Version: 3.9.5 Build-Depends: debhelper (>= 9), perl Homepage: http://git.debian.org/?p=collab-maint/console-log.git;a=summary Vcs-Git: git://git.debian.org/collab-maint/console-log.git Vcs-Browser: http://git.debian.org/?p=collab-maint/console-log.git;a=summary Package: console-log Architecture: all Depends: less, daemon, kbd, passwd (>= 1:4.0.3-23), adduser (>> 3.51), initscripts (>= 2.88dsf-13.3), ${misc:Depends} Description: Puts logfile pagers on virtual consoles console-log keeps logfile pagers open on virtual consoles. The default configuration puts exim's mainlog on tty8, and the syslog on tty9, in a less process. It can also make sure that this console is visible automatically after system boot so that a crashed system at least leaves the syslog readable on the console before reset. Using a pager makes searching, tagging and highlighting possible. debian/console-log.dirs0000664000000000000000000000004312244400147012267 0ustar /etc/init.d /usr/share/console-log debian/console-log.README.Debian0000664000000000000000000000341012244400147013445 0ustar console-log for Debian GNU/Linux -------------------------------- This package allows you to have arbitrary files tailed on ttys. This package was built during normal work hours at planNET Systems GmbH, Karlsruhe, Germany (http://www.planNET.de/). They paid me to do it, so I'll have to thank them. Marc Haber , Tue, 25 Apr 2000 17:06:00 +0200 I no longer work for them, but I continue to work on the package on my own time. Marc Haber , Tue, 30 Mar 2004 11:06:00 +0200 Release Notes ============= There is no support for more since more has "v" as a vi escape. This starts hard-coded /usr/bin/vi with the file currently viewed, and different files can be opened from there and written. Since the pager can potentially run as root, this might allow write access to root-only files, giving instant root to everybody with physical access to the system console. Since more sucks anyway, this is not a big loss. Before you file bugs because the user name is ugly ================================================== In late 2003, there was discussion on Debian-devel how to name accounts created by Debian packages. Unfortunately, no consensus was reached, and the exim4 packages (maintained by Andreas Metzler and myself) stepped ahead, choosing Debian-exim as user name. This has raised a gazillion of "user name is ugly" bugs, but it is extremely hard to change a user name once chosen. For console-log, I have decided to adopt exim4's scheme and called the account "Debian-console-log" to be in sync with current practice. Bug reports complaining about the choice of user name will be closed without comment until consensus about naming of Debian user accounts has been reached and this has been put down in Debian policy. debian/console-log.docs0000664000000000000000000000004112244400147012254 0ustar debian/README.Debian-accountname debian/console-log.conf.pod0000664000000000000000000001311112244400147013034 0ustar =head1 NAME console-log.conf - Main configuration file for console-log =head1 DESCRIPTION console-log keeps logfile pagers open on virtual consoles. /etc/console-log.conf is the configuration file controlling which log file is opened on which tty. Empty lines and lines starting with "#" are ignored. The rest of the file consists of stanzas consisting of lines formed as a single keyword and multiple values. Each stanza describes one pager being started. Stanzas are separated with blank lines. Other keywords preceded by $ are interpolated if the other keyword is set in the same stanza _before_ the current line. =over =item tty is the number of the tty the log pager should be started on. Choose a tty that has a virtual console. This is a mandatory setting. =item chvt If chvt is yes, the system's console will be switched to the tty of this stanza on startup. Default is no. =item file is a list of absolute paths to log files to display. The first file that is either a plain file or a symlink is displayed. The file name must not contain any spaces. This is a mandatory setting. =item user, group If user and/or group is/are given, uid/gid will be changed to the given values before invoking the log pager. User needs to be in group in /etc/group. If no user is given, the pager will be run as the default user/group set at build time. =item maxfilesize If the file to be paged exceeds the configured size, no pager is started to avoid memory overflow. Value given in bytes. Default is 7000000. Additionally, ulimit -v is set to twice this value. =item locscript is the absolute path to a bash shell script that will be sourced before the pager is being started. The script will receive the file path as a parameter and can set environment variables that can influence the pager. =item pager is the actual program that will be invoked to display the file. Currently less is the only pager supported and is therefore also the default. It gets invoked with secure settings and follow mode activated. If you want to use a different pager, you need to manually adapt /usr/share/console-log/logpager. Please submit patches that extend logpager's support for other pagers via the BTS. =back =head1 EXAMPLE The default config file tty 9 chvt yes file /var/log/syslog group adm tty 8 file /var/log/exim4/mainlog /var/log/exim/mainlog /var/log/mail.log group adm will start one log pager for the first file found from /var/log/exim4/mainlog, /var/log/exim/mainlog and /var/log/mail.log, and one log pager for /var/log/syslog, and will chvt to tty9. If a file cannot be read by the user specified in the config file, the init script will complain. You can either change the log file permissions or put the user account in the appropriate group. For example, if /var/log/exim/mainlog is only readable by group mail, you can either change the log file group to adm (make sure to adapt the log file creation/rotation process as well), run the pager as a user that can access the log file, or else put the user account into group mail. Making the file readable for the default account is the preferred way to solve this issue since it introduces the least security risk. =head1 CONFIGURING THE PAGER All configuration options are exported and therefore handed down to the logpager script. You can use this to configure your pager. For example, the logpager script set LESSSECURE to the value of the less_lessecure configuration option and LESS to the value off the less_opts configuration option. This mechanism can be used in any pager extension called from the logpager script. =head1 CONFIGURING THE LESS PAGER For configuring the less pager, the following options are implemented: =over =item less_lesssecure controls the value of the LESSSECURE environment variable for the less process. Default is 1 =item less_opts controls the value of the LESS environment variable for the less process. Default is "--LONG-PROMPT --chop-long-lines --jump-target=10 --max-forw-scroll=100 --window=-4". If you want your pager to automatically re-read the file after possible log rotation (#111272), you might want to add --follow-name to this default. --follow-name might get added to the default in later version. =item less_lesskey controls the value of the LESSKEY environment variable for the less process. Default is /usr/lib/console-log/lesskey, which does not exist in the package currently, and LESSKEY is only set if less_lesskey points to an existing file. =item less_term controls the value of the TERM environment variable for the less process. Default is linux. =back =head1 SUPPORTING YOUR FAVORITE PAGER If you fancy a different pager, please by all means extend the logpager script to support your pager by adding an appropriate part to the case "$PAGER" part of the script. If you want your pager to be configurable via console_log.conf, the convention is to prefix your pager's configuration variables with the name of your pager, e.g. mypager_mycooloption. Make sure to also make the init script unset each variable that gets used in your logpager patch inside the do_from_config function, or a variable set in a previous console-log.conf stanza will also be set in all following ones until you set a different value. Please consider submitting your patch for inclusion in the package via the Debian BTS. =head1 FILES /etc/console-log.conf /usr/share/console-log/logpager =head1 BUGS Many. Be prepared to debug. =head1 AUTHOR This manpage was written by Marc Haber for console-log in Debian/GNU Operating System. =head1 THANKS Thanks to Ivan Frederiks for pointing me towards less --follow-name. =head1 SEE ALSO /etc/init.d/console-log debian/compat0000664000000000000000000000000212244400147010364 0ustar 9 debian/console-log.init.d0000775000000000000000000001667112244400147012534 0ustar #! /bin/bash # # console-log init script for console-log ### BEGIN INIT INFO # Provides: console-log # Required-Start: $local_fs $remote_fs $syslog # Required-Stop: $local_fs $remote_fs $syslog # Should-Start: # Should-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Puts a logfile pager on virtual consoles # Description: console-log keeps logfile pagers open on virtual consoles. ### END INIT INFO PATH=/sbin:/bin:/usr/sbin:/usr/bin DESC="console-log" DEFAULTPAGER="less" LOGPAGER="/usr/share/console-log/logpager" PIDFILEDEFDIR="/run/console-log" CONFIGFILE="/etc/console-log.conf" USERNAME="Debian-console-log" MAXFILESIZE="7000000" set -e if [ -r "/lib/lsb/init-functions" ]; then . /lib/lsb/init-functions else echo "E: /lib/lsb/init-functions not found, lsb-base (>= 3.0-6) needed" exit 1 fi if [ -n "$CONLoGDEBUG" ]; then echo "now debugging $0 $@" set -x fi mkdir -p $PIDFILEDEFDIR # this is from madduck on IRC, 2006-07-06 # There should be a better possibility to give daemon error messages # and/or to log things log() { case "$1" in [[:digit:]]*) success=$1; shift;; *) :;; esac log_action_begin_msg "$1"; shift log_action_end_msg ${success:-0} "$*" } # WARNING! The pager might be run as root. /usr/share/console-log/logpager # is a wrapper for the actual pager that is supposed to configure the pager # in a secure way to not allow shell escapes. If you have extended the # pager wrapper to support other pagers, please submit your patches via # the BTS. start_pager() { TTY="$1" CHVT="$2" FILE="$3" USER="$4" GROUP="$5" MAXFILESIZE="$6" PAGER="$7" LOCSCRIPT="$8" if echo $TTY | grep "[[:digit:]]\+" >/dev/null; then PIDFILEDIR="$PIDFILEDEFDIR" DAEMONUSER="" if [ -n "$USER" ]; then DAEMONUSER="--user $USER" mkdir -p $PIDFILEDEFDIR/$USER chown $USER $PIDFILEDEFDIR/$USER PIDFILEDIR="$PIDFILEDEFDIR/$USER" if [ -n "$GROUP" ]; then DAEMONUSER="$DAEMONUSER.$GROUP" fi fi unset found for file in $FILE; do if [ -f "$file" ] || [ -L "$file" ]; then # check if file is readable by the given user if su --shell=$SHELL --command="head -n 1 $file" $USER > /dev/null 2>&1; then FILENAME="$TTY-${file//\//_-_}" if [ -f "$PIDFILEDIR/$FILENAME" ]; then log_progress_msg "$file (already running)" else if [ -x "$LOCSCRIPT" ]; then . $LOCSCRIPT $file fi if [ -x "$LOGPAGER" ]; then RET=0 (ulimit -S -v $(( $MAXFILESIZE / 1000 * 2 + 10000 )) openvt -f -c $TTY -- \ daemon --foreground --respawn --attempts=20 --delay=10 \ --name=$FILENAME --pidfile=$PIDFILEDIR/$FILENAME \ $DAEMONUSER $LOGPAGER -- $PAGER $file $MAXFILESIZE) || RET=$? if [ "$RET" = 2 ]; then log 1 "E: openvt failed. headless system?" exit 1 fi if [ -f /etc/console.noblank ]; then setterm -blank 0 > /dev/tty$TTY fi [ "$CHVT" == "yes" ] && chvt $TTY log_progress_msg "$file" else log 1 "W: $LOGPAGER is not executeable." fi fi else log 1 "W: $file not readable by $USER" fi found="1" break fi if [ -z "found" ]; then log 1 "W: no files in $FILE do exist" fi done else log 1 "E: illegal tty $TTY." exit 1 fi } check_pager() { USER="$1" shift TTY="$1" shift FILELIST="$@" cd $PIDFILEDEFDIR PIDFILEDIR="$PIDFILEDEFDIR" if [ -n "$USER" ]; then PIDFILEDIR="$PIDFILEDEFDIR/$USER" fi unset found CHECKRET=0 for FILE in $FILELIST; do if [ -f "$FILE" ] || [ -L "$FILE" ]; then log_progress_msg "$FILE" FILENAME="$TTY-${FILE//\//_-_}" if daemon --running $USER --name=$FILENAME --pidfile=$PIDFILEDIR/$FILENAME; then log_progress_msg "(running)" else log_progress_msg "(not running)" CHECKRET=3 fi found="1" break fi done if [ -z "found" ]; then log 1 "W: no files in $FILE do exist" fi return $CHECKRET } do_from_config() { mkdir -p $PIDFILEDEFDIR cd $PIDFILEDEFDIR ACTION="$1" ( while true; do unset tty chvt="no" unset file user="$USERNAME" unset group group="$USERNAME" unset locscript pager="$DEFAULTPAGER" unset maxfilesize maxfilesize="$MAXFILESIZE" # these variables need to be kept in sync with the ones the are used # in the logpager script: Unset them here before parsing config unset less_lesssecure unset less_opts unset less_lesskey unset less_term unset logpager_path COUNTER="" ELINE=0 while read KEY VALUE; do case "$KEY" in "#" | \#* ) continue ;; # comment "" ) ELINE=1 break ;; tty|chvt|file|user|group|pager|locscript|maxfilesize|logpager_*|less_*) eval $KEY=\"$VALUE\" export $KEY COUNTER=".$COUNTER" ;; *) log 1 "ERR: illegal key $KEY" exit 1 ;; esac done # do things only if configuration was read RET=0 if [ -n "$COUNTER" ]; then case "$ACTION" in start) start_pager "$tty" "$chvt" "$file" "$user" "$group" "$maxfilesize" "$pager" "$locscript" ;; check) check_pager "$user" "$tty" "$file" RET=$? ;; *) log 1 "E: illegal action to do_from_config" ;; esac fi # break out of loop if eof # if we get here without eof, then ELINE==1 [ "$ELINE" != "1" ] && break done ) < $CONFIGFILE return $RET } do_from_running() { ACTION="$1" cd $PIDFILEDEFDIR if [ "$ACTION" = "check" ]; then log_action_begin_msg "checking console-log" fi CHECKRET=0 for PIDPATH in $(find . -maxdepth 2 -type f); do FILENAME=$(echo $PIDPATH | sed -n 's/.*\/\(.*\)/\1/p') PIDFILEDIR=$(echo $PIDPATH | sed -n 's/^.*\/\(.*\)\/.*/\1/p') if [ -z "$PIDFILEDIR" ]; then USER="" PIDFILEDIR="$PWD" else USER="--user $PIDFILEDIR" PIDFILEDIR="$PWD/$PIDFILEDIR" fi OUTPUT="${FILENAME#*-}" OUTPUT="${OUTPUT//_-_//}" TTY=${FILENAME%%-*} RUNNING="no" if daemon --running $USER --name=$FILENAME --pidfile=$PIDFILEDIR/$FILENAME; then if [ "$ACTION" = "stop" ]; then daemon --stop $USER --name=$FILENAME --pidfile=$PIDFILEDIR/$FILENAME TERM=vt100 tput clear > /dev/tty$TTY fi RUNNING="yes" else CHECKRET=3 fi if [ -d $PIDFILEDIR ]; then rmdir --ignore-fail-on-non-empty $PIDFILEDIR fi # BUGS: This creates weird output if the log file name contains # the string "_-_". Go figure. log_progress_msg "$OUTPUT" if [ "$ACTION" = "check" ]; then if [ "$RUNNING" = "no" ]; then log_progress_msg "(not running)" else log_progress_msg "(running)" fi fi done if [ "$ACTION" = "check" ]; then log_end_msg 0 return $CHECKRET fi } case "$1" in start) log_daemon_msg "Starting $DESC" do_from_config start log_end_msg 0 ;; stop) log_daemon_msg "Stopping $DESC" do_from_running stop log_end_msg 0 ;; reload|force-reload|restart) log_daemon_msg "Stopping $DESC for restart" do_from_running stop log_end_msg 0 log_daemon_msg "Restarting $DESC" do_from_config start log_end_msg 0 ;; status) log_daemon_msg "Checking $DESC processes" do_from_config check log_end_msg 0 ;; *) N=/etc/init.d/$NAME echo >&2 "Usage: $N {start|stop|restart|reload|force-reload|status}" exit 1 ;; esac exit 0 debian/console-log.postinst0000775000000000000000000000052712244400147013223 0ustar #!/bin/sh -e # postinst USERNAME="Debian-console-log" [ -n "$CONLOGDEBUG" ] && set -x # Add user if [ "$1" = "configure" ]; then echo >&2 'Adding system user' adduser --system --group --home /nonexistent \ --no-create-home --disabled-login --force-badname $USERNAME adduser $USERNAME adm fi #DEBHELPER# # end of file debian/console-log.conf0000664000000000000000000000042712244400147012261 0ustar # /etc/console-log.conf -- configuration file for console-log. # see console-log.conf(5) for details tty 9 # uncomment next line if you want to chvt to the syslog on startup #chvt yes file /var/log/syslog group adm tty 8 file /var/log/exim4/mainlog /var/log/mail.log group adm debian/console-log.manpages0000664000000000000000000000003212244400147013117 0ustar debian/console-log.conf.5 debian/copyright0000664000000000000000000000252212244400147011122 0ustar This is console-log, putting logfile pagers on virtual consoles Copyright 2000-2013 by Marc Haber Initial development has been done as an employee of planNET Systems, Karlsruhe, Germany. Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: console-log Upstream-Contact: Marc Haber Source: maintained in the Debian archive Files: * Copyright: 2000-2013 by Marc Haber License: GPL-2+ 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; either version 2, or (at your option) any later version. . 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 program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. . On Debian systems, the complete text of the version of the GNU General Public License can be found in /usr/share/common-licenses/GPL-2 debian/source/0000775000000000000000000000000012244400147010466 5ustar debian/source/format0000664000000000000000000000001412244400147011674 0ustar 3.0 (quilt) debian/rules0000775000000000000000000000221512244400147010246 0ustar #!/usr/bin/make -f # -*- makefile -*- # Sample debian/rules that uses debhelper. # This file was originally written by Joey Hess and Craig Small. # As a special exception, when this file is copied by dh-make into a # dh-make output file, you may use that output file without restriction. # This special exception was added by Craig Small in version 0.37 of dh-make. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 %: dh $@ export USERNAME="Debian-console-log" override_dh_auto_clean: dh_auto_clean rm -rf debian/console-log.conf.5 override_dh_auto_install: dh_auto_install # installation install -D -m 644 debian/console-log.conf debian/console-log/etc/console-log.conf install -D -m 755 scripts/logpager debian/console-log/usr/share/console-log/logpager # manpages /usr/bin/pod2man --section=5 --release="console-log $(PKG_VER)" --lax \ --center="Debian GNU/Linux" debian/console-log.conf.pod > debian/console-log.conf.5 # maintainer scripts -for script in console-log.postinst console-log.postrm console-log.init.d; do \ perl -pi -e '! $$state && ($$state = s/^USERNAME=.*$$/USERNAME=$(USERNAME)/)' debian/$$script; \ done