Package: freedombox-setup
Severity: normal
Tags: patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Dear Maintainer,

Currently, if an important step in the setup process fails, it is logged
by the setup process continues.  This means that we are having to look
at the logs after each build (for each target) manually to find out if
a particular step as failed.  It is better for the build to fail than a
small step failing silently and causing an incorrect build that is hard
to detect.

Doing this is not likely to cause build failures right away because we
have been monitoring the build logs and didn't see any failure during
last release.  Also, the number of scripts present are quite small now.

Attached patch fixes the problem.



- -- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, armhf

Kernel: Linux 4.6.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

-----BEGIN PGP SIGNATURE-----

iQIuBAEBCgAYBQJXweELERxzdW5pbEBtZWRoYXMub3JnAAoJEEPqHP8Kp8XyhGkP
/0ACA/jQI1kKIajl0hFjzAuwZwMa8PuHj7q6cEEZJld/yCf79qKekI76fNrvcepo
XVzTKfIeqtbXXq1ddjGf61mTFaThi4RxKd6VF3b/2U/osZje0SFAOkZ2pHLAU2dV
3S4GyZ9dwjcVdQt4VCWLjNyiNDjPiXzCGywmII1G5NYqWq2zybWsevPWQ3xJhErp
T0BKWI0Eu0Hj07SL7qYtfRvi50uYdNU+JhqtSFkKT6qcZw5pPsAI87SvFaVh2l+T
HUHLR8gyVc3j0ZULoJQQExU7Yy9inZTqH5nwdsVC8p6b4PY0IIMrhPap9e00b+/9
RU6sdtR61QuH3hRJt7NhkwNU8txFEAdb03aPiFGKANg1NhkiPsqPFaO/Vn5VOP/O
3RZ0Eet0IAKuukOAOJWfRNPF+fQKdFDn840O6kUO1a3EabMYG2Qfai/LvvH2QSj/
wLcA/YsIBD1s0oq7gD6aALiqZlsLUo4MmtHeXrsYtGp6vtPQJkoI9X+ypMwNIZRx
C4X8VdL5sN0d/ePTE0OK5GLcCtYCm8EOnTXiIE27hHSqH7EAgvDs6/qCuBZMCMDf
ubvzC08Db4jP5OErmY0Q1GLR4WRjYfPU7PD46EUrNyK1da/+WNH4fCSajHOCNr5K
qie0j2ZwxCH18x7OXGJnJqp4tt1LlSn0nvHcntI7Pc3I
=qYz6
-----END PGP SIGNATURE-----
>From bc94368fd1ebafc492a9b40a57328401cdd00350 Mon Sep 17 00:00:00 2001
From: Sunil Mohan Adapa <su...@medhas.org>
Date: Sun, 28 Aug 2016 00:09:44 +0530
Subject: [PATCH] Exit or error with error code

Currently, if an important step in the setup process fails, it is logged
by the setup process continues.  This means that we are having to look
at the logs after each build (for each target) manually to find out if
a particular step as failed.  It is better for the build to fail than a
small step failing silently and causing an incorrect build that is hard
to detect.

Doing this is not likely to cause build failures right away because we
have been monitoring the build logs and didn't see any failure during
last release.  Also, the number of scripts present are quite small now.
---
 first-run.d/05_network       | 2 ++
 first-run.d/10_ssh-keys      | 2 ++
 first-run.d/40_apache2       | 2 ++
 setup.d/01_etckeeper-pre     | 2 ++
 setup.d/90_apache2           | 2 ++
 setup.d/98_next-is-first-run | 2 ++
 setup.d/99_etckeeper         | 2 ++
 setup.d/99_provide-source    | 2 ++
 setup.d/99_zmessage          | 2 ++
 9 files changed, 18 insertions(+)

diff --git a/first-run.d/05_network b/first-run.d/05_network
index 4335989..c019e2d 100755
--- a/first-run.d/05_network
+++ b/first-run.d/05_network
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+set -e
+
 # Configure networking for all wired and wireless devices.
 #
 # Creates network-manager connections.
diff --git a/first-run.d/10_ssh-keys b/first-run.d/10_ssh-keys
index 83bec4c..aeacb96 100755
--- a/first-run.d/10_ssh-keys
+++ b/first-run.d/10_ssh-keys
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+set -e
+
 . /lib/lsb/init-functions
 
 log_action_begin_msg "Creating SSH keys"
diff --git a/first-run.d/40_apache2 b/first-run.d/40_apache2
index 67c939e..ff77c0d 100755
--- a/first-run.d/40_apache2
+++ b/first-run.d/40_apache2
@@ -3,4 +3,6 @@
 # Make sure every machine have their own unique SSL certificate, even
 # if it is a snake oil one.
 
+set -e
+
 make-ssl-cert generate-default-snakeoil --force-overwrite
diff --git a/setup.d/01_etckeeper-pre b/setup.d/01_etckeeper-pre
index bb45a82..0aef4b4 100755
--- a/setup.d/01_etckeeper-pre
+++ b/setup.d/01_etckeeper-pre
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+set -e
+
 # Avoid etckeeper problem (refuses to commit) because git picked a
 # email address with an empty domain.
 if which etckeeper > /dev/null 2>&1 && \
diff --git a/setup.d/90_apache2 b/setup.d/90_apache2
index 2e00ccc..696b620 100755
--- a/setup.d/90_apache2
+++ b/setup.d/90_apache2
@@ -2,6 +2,8 @@
 #
 # Configure Apache for FBX.
 
+set -e
+
 echo "Configuring Apache..."
 
 # enable non-multithreaded Apache worker model as there a many PHP
diff --git a/setup.d/98_next-is-first-run b/setup.d/98_next-is-first-run
index bf3a0ba..81ae649 100755
--- a/setup.d/98_next-is-first-run
+++ b/setup.d/98_next-is-first-run
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+set -e
+
 # Tell init.d/first-run to do its stuff on the next boot.
 mkdir -p /var/lib/freedombox
 touch /var/lib/freedombox/first-run-enable
diff --git a/setup.d/99_etckeeper b/setup.d/99_etckeeper
index 9ef57fc..1e86b92 100755
--- a/setup.d/99_etckeeper
+++ b/setup.d/99_etckeeper
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+set -e
+
 if type etckeeper > /dev/null 2>&1 ; then
     etckeeper commit -m "Status after freedombox-setup run."
 fi
diff --git a/setup.d/99_provide-source b/setup.d/99_provide-source
index 45558a6..fbb8d8e 100755
--- a/setup.d/99_provide-source
+++ b/setup.d/99_provide-source
@@ -4,6 +4,8 @@
 # source to be available, by providing the source of every package
 # used.
 
+set -e
+
 if [ 'true' = "$SOURCE" ] ; then
     echo "Adding source packages to file system"
 else
diff --git a/setup.d/99_zmessage b/setup.d/99_zmessage
index f63bfe2..df821bd 100755
--- a/setup.d/99_zmessage
+++ b/setup.d/99_zmessage
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+set -e
+
 cat <<EOF
 
 ===================================================================
-- 
2.9.3

Reply via email to