Codebase list uptimed / d035922
Rename all d…/uptimed.<something> dh files to d…/<something> This eases the package maintenance a lot wrt. to tab completion when working on these files. Also makes file listings more readable. Axel Beckert 2 years ago
27 changed file(s) with 309 addition(s) and 307 deletion(s). Raw diff Collapse all Expand all
55 values" which seems due to leap seconds. (Finally closes: #654830)
66 * Add a script to clean up broken duplicate entries due to #654830 and
77 run that script at upgrade time. (It does make database backups.)
8 * Rename all debian/uptimed.<something> debhelper files to
9 debian/<something> for easier maintenance.
810
911 -- Axel Beckert <abe@debian.org> Sun, 28 Nov 2021 23:31:14 +0100
1012
0 #! /usr/bin/perl -w
1
2 use strict;
3
4 use Debconf::Client::ConfModule ':all';
5
6 version('2.0');
7 my $capb = capb('backup');
8
9 my $sendmails = 0;
10 my $havemilestones = 0;
11
12 # Step 1: Put the current settings into the DebConf database
13 # Invalid values are ignored
14
15 if (open(CONFIG, '/etc/uptimed.conf')) {
16 while(<CONFIG>) {
17 chomp;
18 (/^UPDATE_INTERVAL=[0-9]*/) && do {
19 s/^UPDATE_INTERVAL=//;
20 set('uptimed/interval', $_); };
21 (/^LOG_MAXIMUM_ENTRIES=[0-9]*/) && do {
22 s/^LOG_MAXIMUM_ENTRIES=//;
23 set('uptimed/maxrecords', $_); };
24 (/^EMAIL=[a-zA-Z0-9.-]+@[a-zA-Z0-9.%-]+/) && do {
25 s/^EMAIL=//;
26 set('uptimed/mail/address', $_); };
27 (/^SEND_EMAIL=/) && do {
28 s/^SEND_EMAIL=//;
29 if($_ > 0) {
30 $sendmails = $_;
31 } else {
32 $sendmails = 0;
33 } };
34 };
35 if ($sendmails == 1) {
36 set('uptimed/mail/do_mail', 'Both');
37 } else {if ($sendmails == 2) {
38 set('uptimed/mail/do_mail', 'Milestone');
39 } else {if ($sendmails == 3) {
40 set('uptimed/mail/do_mail', 'Record');
41 } else {
42 set('uptimed/mail/do_mail', 'Never');
43 }; }; };
44 };
45
46 # Step 2: Ask the user whether he wants to change something
47
48 my $state = 1;
49
50
51 while(($state > 0) && ($state <= 5)) {
52 if ($state == 1) {
53 input('medium', 'uptimed/maxrecords');
54 };
55 ($state == 2) && input('medium', 'uptimed/mail/do_mail');
56 ($state == 3) && (get('uptimed/mail/do_mail') ne 'Never') &&
57 input('medium', 'uptimed/mail/address');
58 ($state == 4) && (get('uptimed/mail/do_mail') eq 'Both') &&
59 input('medium', 'uptimed/mail/milestones_info');
60 ($state == 5) && input('low', 'uptimed/interval');
61
62 my @ret = go;
63
64 if($ret[0] == 30) {
65 $state -= 1;
66 } else {
67 $state += 1;
68 }
69 }
70
71 stop;
0 usr/include
1 var/spool/uptimed
0 README.md
1 README.unsupported
2 TODO
0 #! /bin/sh
1 ### BEGIN INIT INFO
2 # Provides: uptimed
3 # Required-Start: $remote_fs
4 # Required-Stop: $remote_fs
5 # Should-Start: uptimed-init
6 # Default-Start: 2 3 4 5
7 # Default-Stop: 0 1 6
8 # Short-Description: Uptime daemon
9 ### END INIT INFO
10
11 PATH=/sbin:/bin:/usr/sbin:/usr/bin
12 DAEMON=/usr/sbin/uptimed
13 NAME=uptimed
14 DESC="uptime daemon"
15 USER="daemon"
16 PIDDIR=/run/uptimed
17 PIDFILE=$PIDDIR/uptimed.pid
18
19 test -f $DAEMON || exit 0
20
21 . /lib/lsb/init-functions
22
23 # Source defaults file; edit that file to configure this script.
24 if [ -e /etc/default/uptimed ]; then
25 . /etc/default/uptimed
26 fi
27
28
29 case "$1" in
30 start)
31 if [ ! -d $PIDDIR ]; then
32 mkdir $PIDDIR
33 chown $USER:$USER $PIDDIR
34 fi
35 echo -n "Starting $DESC: "
36 start-stop-daemon --start --quiet --user daemon --chuid daemon --pidfile $PIDFILE --exec $DAEMON
37 echo "$NAME."
38 ;;
39 stop)
40 echo -n "Stopping $DESC: "
41 start-stop-daemon --stop --quiet --user daemon --pidfile $PIDFILE --exec $DAEMON
42 echo "$NAME."
43 ;;
44 restart|force-reload)
45 $0 stop
46 sleep 2
47 $0 start
48 ;;
49 status)
50 status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
51 ;;
52 *)
53 N=/etc/init.d/$NAME
54 echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
55 exit 1
56 ;;
57 esac
58
59 exit 0
0 debian/uptimed.conf /usr/lib/tmpfiles.d
1 debian/fixup-duplicate-uprecords /usr/libexec/uptimed/
0 # lintian doesn't detect that we use that template
1 uptimed binary: unused-debconf-template uptimed/mail/milestones_info
2 # libuptimed0 is not used by any other package than uptimed, therefore
3 # binary and library are in the same package
4 uptimed: package-name-doesnt-match-sonames libuptimed0
5 # uptimed package includes the library and -dev package
6 uptimed: link-to-shared-library-in-wrong-package usr/lib/*/libuptimed.so.0.0.0 usr/lib/*/libuptimed.so
0 # Remove old bootid creating script.
1 rm_conffile /etc/init.d/uptimed.sh 1:0.3.16-3.1
0 debian/uptimed.conf.5
0 #! /bin/sh
1
2 . /usr/share/debconf/confmodule
3
4 db_version 2.0
5
6 set -e
7
8 # exit if the config file is not present
9 if [ ! -e /etc/uptimed.conf ]; then
10 exit 0
11 fi
12
13 if [ "$1" = "configure" ]; then
14 # Step 1: Assemble a sed(1) script that does the configuration changes we
15 # want
16 SEDSCRIPT=`mktemp /tmp/debconfXXXXXX`
17 db_get 'uptimed/interval'
18 echo >$SEDSCRIPT "s/^UPDATE_INTERVAL=.*/UPDATE_INTERVAL=$RET/"
19 db_get 'uptimed/maxrecords'
20 echo >>$SEDSCRIPT "s/^LOG_MAXIMUM_ENTRIES=.*/LOG_MAXIMUM_ENTRIES=$RET/"
21 db_get 'uptimed/mail/do_mail'
22 if [ "$RET" = "Never" ]; then
23 echo >>$SEDSCRIPT "s/^SEND_EMAIL=.*/SEND_EMAIL=0/"
24 elif [ "$RET" = "Record" ]; then
25 echo >>$SEDSCRIPT "s/^SEND_EMAIL=.*/SEND_EMAIL=3/"
26 elif [ "$RET" = "Milestone" ]; then
27 echo >>$SEDSCRIPT "s/^SEND_EMAIL=.*/SEND_EMAIL=2/"
28 else
29 echo >>$SEDSCRIPT "s/^SEND_EMAIL=.*/SEND_EMAIL=1/"
30 fi
31 if [ "$RET" != "Never" ]; then
32 db_get 'uptimed/mail/address'
33 echo >>$SEDSCRIPT "s/^EMAIL=.*/EMAIL=$RET/"
34 fi
35 # 0.1.6-4 commented these out. Leave until the yet unnamed distro
36 # after sid
37 echo >>$SEDSCRIPT "s/^#disabled#MILESTONE=/MILESTONE=/"
38
39 db_stop
40
41 # Step 2: Process the config file
42 TEMPFILE=`mktemp /tmp/debconfXXXXXX`
43 sed -f $SEDSCRIPT </etc/uptimed.conf >$TEMPFILE
44 rm $SEDSCRIPT
45
46 # Step 3: See if anything has changed. If so, install the new configuration
47 # and restart uptimed
48 if diff /etc/uptimed.conf $TEMPFILE >/dev/null; then
49 rm $TEMPFILE
50 else
51 mv /etc/uptimed.conf \
52 /etc/uptimed.conf.dpkg-old
53 mv $TEMPFILE /etc/uptimed.conf
54 fi
55 chmod 644 /etc/uptimed.conf
56 chown daemon:daemon /var/spool/uptimed
57
58 # Step 4: Fixup uptimed db files wrt. to #654830
59 invoke-rc.d uptimed stop
60 if dpkg --compare-versions "$2" '<<' '1:0.4.6-1~~'; then
61 /usr/libexec/uptimed/fixup-duplicate-uprecords
62 /usr/libexec/uptimed/fixup-duplicate-uprecords -b
63 fi
64 invoke-rc.d uptimed start
65 fi
66
67 #DEBHELPER#
0 #!/bin/sh
1
2 set -e
3
4 #DEBHELPER#
5
6 if [ "$1" = "purge" ]; then
7 if [ -f /var/spool/uptimed/records ]; then
8 echo -n "Deleting uptime record database..."
9 rm -f /var/spool/uptimed/records
10 echo "done."
11 fi
12 rm -f /var/spool/uptimed/records.old
13 rm -f /var/spool/uptimed/bootid
14 if [ -d /var/spool/uptimed ]; then
15 rmdir /var/spool/uptimed || true
16 fi
17 fi
0 #! /bin/sh
1
2 set -e
3
4 # Remove symlinks from rcS.
5 update-rc.d -f uptimed.sh remove
6
7 #DEBHELPER#
0 [Unit]
1 Description=uptime record daemon
2 After=time-sync.target ntp.service openntpd.service
3 Documentation=man:uptimed(8) man:uptimed.conf(5)
4
5 [Service]
6 ExecStart=/usr/sbin/uptimed -f
7 User=daemon
8
9 [Install]
10 WantedBy=multi-user.target
0 # These templates have been reviewed by the debian-l10n-english
1 # team
2 #
3 # If modifications/additions/rewording are needed, please ask
4 # debian-l10n-english@lists.debian.org for advice.
5 #
6 # Even minor modifications require translation updates and such
7 # changes should be coordinated with translators and reviewers.
8
9 Template: uptimed/interval
10 Type: string
11 Default: 3600
12 _Description: Delay between database updates (seconds):
13 Uptimed will update its database regularly so that the uptime
14 doesn't get lost in case of a system crash. You can set how frequently
15 this will happen (use higher values if you want to avoid disk activity,
16 for instance on a laptop).
17
18 Template: uptimed/maxrecords
19 Type: string
20 Default: 500
21 _Description: Number of records that should be kept:
22 Uptimed can limit the number of records to be kept to the highest n,
23 to keep an unlimited number of records set this value to 0
24 .
25 Be aware that uptime data will be lost if the limit has been reached and/or the number records is reduced.
26
27 Template: uptimed/mail/do_mail
28 Type: select
29 __Choices: Never, Record, Milestone, Both
30 Default: Never
31 _Description: Send mails if a milestone or record is reached:
32 Uptimed can be configured to send a mail each time a record is broken or a
33 "milestone" is reached. You can choose whether you:
34 .
35 * never want to receive these mails;
36 * want to be notified only when a record is broken;
37 * would like to know about milestones;
38 * are interested in both.
39
40 Template: uptimed/mail/address
41 Type: string
42 Default: root
43 _Description: Uptimed email recipient:
44 Since you have chosen to be sent emails, you should specify where to send
45 these mails.
46
47 Template: uptimed/mail/milestones_info
48 Type: note
49 _Description: Milestone configuration must be done manually
50 The milestones must
51 be configured manually in /etc/uptimed.conf. Since you have chosen to
52 receive emails for milestones you probably want to modify that file.
+0
-72
debian/uptimed.config less more
0 #! /usr/bin/perl -w
1
2 use strict;
3
4 use Debconf::Client::ConfModule ':all';
5
6 version('2.0');
7 my $capb = capb('backup');
8
9 my $sendmails = 0;
10 my $havemilestones = 0;
11
12 # Step 1: Put the current settings into the DebConf database
13 # Invalid values are ignored
14
15 if (open(CONFIG, '/etc/uptimed.conf')) {
16 while(<CONFIG>) {
17 chomp;
18 (/^UPDATE_INTERVAL=[0-9]*/) && do {
19 s/^UPDATE_INTERVAL=//;
20 set('uptimed/interval', $_); };
21 (/^LOG_MAXIMUM_ENTRIES=[0-9]*/) && do {
22 s/^LOG_MAXIMUM_ENTRIES=//;
23 set('uptimed/maxrecords', $_); };
24 (/^EMAIL=[a-zA-Z0-9.-]+@[a-zA-Z0-9.%-]+/) && do {
25 s/^EMAIL=//;
26 set('uptimed/mail/address', $_); };
27 (/^SEND_EMAIL=/) && do {
28 s/^SEND_EMAIL=//;
29 if($_ > 0) {
30 $sendmails = $_;
31 } else {
32 $sendmails = 0;
33 } };
34 };
35 if ($sendmails == 1) {
36 set('uptimed/mail/do_mail', 'Both');
37 } else {if ($sendmails == 2) {
38 set('uptimed/mail/do_mail', 'Milestone');
39 } else {if ($sendmails == 3) {
40 set('uptimed/mail/do_mail', 'Record');
41 } else {
42 set('uptimed/mail/do_mail', 'Never');
43 }; }; };
44 };
45
46 # Step 2: Ask the user whether he wants to change something
47
48 my $state = 1;
49
50
51 while(($state > 0) && ($state <= 5)) {
52 if ($state == 1) {
53 input('medium', 'uptimed/maxrecords');
54 };
55 ($state == 2) && input('medium', 'uptimed/mail/do_mail');
56 ($state == 3) && (get('uptimed/mail/do_mail') ne 'Never') &&
57 input('medium', 'uptimed/mail/address');
58 ($state == 4) && (get('uptimed/mail/do_mail') eq 'Both') &&
59 input('medium', 'uptimed/mail/milestones_info');
60 ($state == 5) && input('low', 'uptimed/interval');
61
62 my @ret = go;
63
64 if($ret[0] == 30) {
65 $state -= 1;
66 } else {
67 $state += 1;
68 }
69 }
70
71 stop;
+0
-2
debian/uptimed.dirs less more
0 usr/include
1 var/spool/uptimed
+0
-3
debian/uptimed.docs less more
0 README.md
1 README.unsupported
2 TODO
+0
-60
debian/uptimed.init less more
0 #! /bin/sh
1 ### BEGIN INIT INFO
2 # Provides: uptimed
3 # Required-Start: $remote_fs
4 # Required-Stop: $remote_fs
5 # Should-Start: uptimed-init
6 # Default-Start: 2 3 4 5
7 # Default-Stop: 0 1 6
8 # Short-Description: Uptime daemon
9 ### END INIT INFO
10
11 PATH=/sbin:/bin:/usr/sbin:/usr/bin
12 DAEMON=/usr/sbin/uptimed
13 NAME=uptimed
14 DESC="uptime daemon"
15 USER="daemon"
16 PIDDIR=/run/uptimed
17 PIDFILE=$PIDDIR/uptimed.pid
18
19 test -f $DAEMON || exit 0
20
21 . /lib/lsb/init-functions
22
23 # Source defaults file; edit that file to configure this script.
24 if [ -e /etc/default/uptimed ]; then
25 . /etc/default/uptimed
26 fi
27
28
29 case "$1" in
30 start)
31 if [ ! -d $PIDDIR ]; then
32 mkdir $PIDDIR
33 chown $USER:$USER $PIDDIR
34 fi
35 echo -n "Starting $DESC: "
36 start-stop-daemon --start --quiet --user daemon --chuid daemon --pidfile $PIDFILE --exec $DAEMON
37 echo "$NAME."
38 ;;
39 stop)
40 echo -n "Stopping $DESC: "
41 start-stop-daemon --stop --quiet --user daemon --pidfile $PIDFILE --exec $DAEMON
42 echo "$NAME."
43 ;;
44 restart|force-reload)
45 $0 stop
46 sleep 2
47 $0 start
48 ;;
49 status)
50 status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
51 ;;
52 *)
53 N=/etc/init.d/$NAME
54 echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
55 exit 1
56 ;;
57 esac
58
59 exit 0
+0
-2
debian/uptimed.install less more
0 debian/uptimed.conf /usr/lib/tmpfiles.d
1 debian/fixup-duplicate-uprecords /usr/libexec/uptimed/
+0
-7
debian/uptimed.lintian-overrides less more
0 # lintian doesn't detect that we use that template
1 uptimed binary: unused-debconf-template uptimed/mail/milestones_info
2 # libuptimed0 is not used by any other package than uptimed, therefore
3 # binary and library are in the same package
4 uptimed: package-name-doesnt-match-sonames libuptimed0
5 # uptimed package includes the library and -dev package
6 uptimed: link-to-shared-library-in-wrong-package usr/lib/*/libuptimed.so.0.0.0 usr/lib/*/libuptimed.so
+0
-2
debian/uptimed.maintscript less more
0 # Remove old bootid creating script.
1 rm_conffile /etc/init.d/uptimed.sh 1:0.3.16-3.1
+0
-1
debian/uptimed.manpages less more
0 debian/uptimed.conf.5
+0
-68
debian/uptimed.postinst less more
0 #! /bin/sh
1
2 . /usr/share/debconf/confmodule
3
4 db_version 2.0
5
6 set -e
7
8 # exit if the config file is not present
9 if [ ! -e /etc/uptimed.conf ]; then
10 exit 0
11 fi
12
13 if [ "$1" = "configure" ]; then
14 # Step 1: Assemble a sed(1) script that does the configuration changes we
15 # want
16 SEDSCRIPT=`mktemp /tmp/debconfXXXXXX`
17 db_get 'uptimed/interval'
18 echo >$SEDSCRIPT "s/^UPDATE_INTERVAL=.*/UPDATE_INTERVAL=$RET/"
19 db_get 'uptimed/maxrecords'
20 echo >>$SEDSCRIPT "s/^LOG_MAXIMUM_ENTRIES=.*/LOG_MAXIMUM_ENTRIES=$RET/"
21 db_get 'uptimed/mail/do_mail'
22 if [ "$RET" = "Never" ]; then
23 echo >>$SEDSCRIPT "s/^SEND_EMAIL=.*/SEND_EMAIL=0/"
24 elif [ "$RET" = "Record" ]; then
25 echo >>$SEDSCRIPT "s/^SEND_EMAIL=.*/SEND_EMAIL=3/"
26 elif [ "$RET" = "Milestone" ]; then
27 echo >>$SEDSCRIPT "s/^SEND_EMAIL=.*/SEND_EMAIL=2/"
28 else
29 echo >>$SEDSCRIPT "s/^SEND_EMAIL=.*/SEND_EMAIL=1/"
30 fi
31 if [ "$RET" != "Never" ]; then
32 db_get 'uptimed/mail/address'
33 echo >>$SEDSCRIPT "s/^EMAIL=.*/EMAIL=$RET/"
34 fi
35 # 0.1.6-4 commented these out. Leave until the yet unnamed distro
36 # after sid
37 echo >>$SEDSCRIPT "s/^#disabled#MILESTONE=/MILESTONE=/"
38
39 db_stop
40
41 # Step 2: Process the config file
42 TEMPFILE=`mktemp /tmp/debconfXXXXXX`
43 sed -f $SEDSCRIPT </etc/uptimed.conf >$TEMPFILE
44 rm $SEDSCRIPT
45
46 # Step 3: See if anything has changed. If so, install the new configuration
47 # and restart uptimed
48 if diff /etc/uptimed.conf $TEMPFILE >/dev/null; then
49 rm $TEMPFILE
50 else
51 mv /etc/uptimed.conf \
52 /etc/uptimed.conf.dpkg-old
53 mv $TEMPFILE /etc/uptimed.conf
54 fi
55 chmod 644 /etc/uptimed.conf
56 chown daemon:daemon /var/spool/uptimed
57
58 # Step 4: Fixup uptimed db files wrt. to #654830
59 invoke-rc.d uptimed stop
60 if dpkg --compare-versions "$2" '<<' '1:0.4.6-1~~'; then
61 /usr/libexec/uptimed/fixup-duplicate-uprecords
62 /usr/libexec/uptimed/fixup-duplicate-uprecords -b
63 fi
64 invoke-rc.d uptimed start
65 fi
66
67 #DEBHELPER#
+0
-18
debian/uptimed.postrm less more
0 #!/bin/sh
1
2 set -e
3
4 #DEBHELPER#
5
6 if [ "$1" = "purge" ]; then
7 if [ -f /var/spool/uptimed/records ]; then
8 echo -n "Deleting uptime record database..."
9 rm -f /var/spool/uptimed/records
10 echo "done."
11 fi
12 rm -f /var/spool/uptimed/records.old
13 rm -f /var/spool/uptimed/bootid
14 if [ -d /var/spool/uptimed ]; then
15 rmdir /var/spool/uptimed || true
16 fi
17 fi
+0
-8
debian/uptimed.preinst less more
0 #! /bin/sh
1
2 set -e
3
4 # Remove symlinks from rcS.
5 update-rc.d -f uptimed.sh remove
6
7 #DEBHELPER#
+0
-11
debian/uptimed.service less more
0 [Unit]
1 Description=uptime record daemon
2 After=time-sync.target ntp.service openntpd.service
3 Documentation=man:uptimed(8) man:uptimed.conf(5)
4
5 [Service]
6 ExecStart=/usr/sbin/uptimed -f
7 User=daemon
8
9 [Install]
10 WantedBy=multi-user.target
+0
-53
debian/uptimed.templates less more
0 # These templates have been reviewed by the debian-l10n-english
1 # team
2 #
3 # If modifications/additions/rewording are needed, please ask
4 # debian-l10n-english@lists.debian.org for advice.
5 #
6 # Even minor modifications require translation updates and such
7 # changes should be coordinated with translators and reviewers.
8
9 Template: uptimed/interval
10 Type: string
11 Default: 3600
12 _Description: Delay between database updates (seconds):
13 Uptimed will update its database regularly so that the uptime
14 doesn't get lost in case of a system crash. You can set how frequently
15 this will happen (use higher values if you want to avoid disk activity,
16 for instance on a laptop).
17
18 Template: uptimed/maxrecords
19 Type: string
20 Default: 500
21 _Description: Number of records that should be kept:
22 Uptimed can limit the number of records to be kept to the highest n,
23 to keep an unlimited number of records set this value to 0
24 .
25 Be aware that uptime data will be lost if the limit has been reached and/or the number records is reduced.
26
27 Template: uptimed/mail/do_mail
28 Type: select
29 __Choices: Never, Record, Milestone, Both
30 Default: Never
31 _Description: Send mails if a milestone or record is reached:
32 Uptimed can be configured to send a mail each time a record is broken or a
33 "milestone" is reached. You can choose whether you:
34 .
35 * never want to receive these mails;
36 * want to be notified only when a record is broken;
37 * would like to know about milestones;
38 * are interested in both.
39
40 Template: uptimed/mail/address
41 Type: string
42 Default: root
43 _Description: Uptimed email recipient:
44 Since you have chosen to be sent emails, you should specify where to send
45 these mails.
46
47 Template: uptimed/mail/milestones_info
48 Type: note
49 _Description: Milestone configuration must be done manually
50 The milestones must
51 be configured manually in /etc/uptimed.conf. Since you have chosen to
52 receive emails for milestones you probably want to modify that file.