summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2017-09-01 11:17:18 +0100
committerColin Watson <cjwatson@debian.org>2017-09-01 11:17:18 +0100
commit01b1cfd05d46cc2fc6679749da26e7e3a478b6ee (patch)
treec220f5cb689719ebbd6e695faff051583a0fe73b
parent30d326ff9a02a10d0aa2cad1a5cd9d05554e78fd (diff)
Give up and use systemctl to start haveged if running under systemd; this shouldn't be necessary, but I can't seem to get things working in the Ubuntu autopkgtest environment otherwise.
-rw-r--r--debian/changelog3
-rwxr-xr-xdebian/tests/regress28
2 files changed, 22 insertions, 9 deletions
diff --git a/debian/changelog b/debian/changelog
index f2f442576..4184a8508 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,9 @@
1openssh (1:7.5p1-10) UNRELEASED; urgency=medium 1openssh (1:7.5p1-10) UNRELEASED; urgency=medium
2 2
3 * Tell haveged to create the pid file we expect. 3 * Tell haveged to create the pid file we expect.
4 * Give up and use systemctl to start haveged if running under systemd;
5 this shouldn't be necessary, but I can't seem to get things working in
6 the Ubuntu autopkgtest environment otherwise.
4 7
5 -- Colin Watson <cjwatson@debian.org> Fri, 01 Sep 2017 02:41:04 +0100 8 -- Colin Watson <cjwatson@debian.org> Fri, 01 Sep 2017 02:41:04 +0100
6 9
diff --git a/debian/tests/regress b/debian/tests/regress
index c6e3a15db..e89e1940a 100755
--- a/debian/tests/regress
+++ b/debian/tests/regress
@@ -3,13 +3,20 @@ set -ex
3 3
4if [ "$(id -un)" != openssh-tests ]; then 4if [ "$(id -un)" != openssh-tests ]; then
5 TMP="$ADTTMP/user" 5 TMP="$ADTTMP/user"
6 STARTED_HAVEGED=false
6 7
7 cleanup () { 8 cleanup () {
8 if [ -e "$TMP/haveged.pid" ]; then 9 if $STARTED_HAVEGED; then
9 start-stop-daemon --stop --quiet \ 10 if [ -d /run/systemd/system ] && \
10 --retry=TERM/30/KILL/5 \ 11 which systemctl >/dev/null 2>&1; then
11 --pidfile "$TMP/haveged.pid" \ 12 systemctl disable haveged || true
12 --name haveged 13 systemctl stop haveged || true
14 else
15 start-stop-daemon --stop --quiet \
16 --retry=TERM/30/KILL/5 \
17 --pidfile "$TMP/haveged.pid" \
18 --name haveged
19 fi
13 fi 20 fi
14 rm -rf "$TMP" 21 rm -rf "$TMP"
15 rm -f /etc/sudoers.d/openssh-tests 22 rm -f /etc/sudoers.d/openssh-tests
@@ -29,13 +36,16 @@ EOF
29 chown -R openssh-tests:openssh-tests "$TMP" 36 chown -R openssh-tests:openssh-tests "$TMP"
30 37
31 # If we're running in a container, haveged may not have started 38 # If we're running in a container, haveged may not have started
32 # automatically. Do this by hand rather than via systemctl or 39 # automatically.
33 # similar, since autopkgtests shouldn't depend on a particular init 40 if [ -d /run/systemd/system ] && which systemctl >/dev/null 2>&1; then
34 # system. 41 systemctl enable haveged || true
35 if ! pidof haveged >/dev/null; then 42 systemctl start haveged || true
43 STARTED_HAVEGED=:
44 elif ! pidof haveged >/dev/null; then
36 start-stop-daemon --start --quiet \ 45 start-stop-daemon --start --quiet \
37 --pidfile "$TMP/haveged.pid" \ 46 --pidfile "$TMP/haveged.pid" \
38 --exec /usr/sbin/haveged -- -p "$TMP/haveged.pid" 47 --exec /usr/sbin/haveged -- -p "$TMP/haveged.pid"
48 STARTED_HAVEGED=:
39 fi 49 fi
40 50
41 sudo -u openssh-tests env TMP="$TMP" "$0" "$@" 51 sudo -u openssh-tests env TMP="$TMP" "$0" "$@"