public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "Maxim Yu. Osipov" <mosipov@ilbers.de>
To: isar-users@googlegroups.com
Subject: [PATCH 2/2] isar-bootstrap: exit if command fails under flock
Date: Fri, 10 Aug 2018 12:31:50 +0200	[thread overview]
Message-ID: <20180810103150.28342-3-mosipov@ilbers.de> (raw)
In-Reply-To: <20180810103150.28342-1-mosipov@ilbers.de>

If command under 'flock' fails, isar_bootstrap continues to execute.
This is wrong behaviour, which leads that the do_bootstrap task is
considered successfully done.

Signed-off-by: Maxim Yu. Osipov <mosipov@ilbers.de>
---
 .../recipes-core/isar-bootstrap/isar-bootstrap.inc | 28 +++++++++++-----------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
index 5c90713..60e5d10 100644
--- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
@@ -187,7 +187,7 @@ isar_bootstrap() {
                                          ${DEBOOTSTRAP_KEYRING} \
                                          "${@get_distro_suite(d, True)}" \
                                          "${ROOTFSDIR}" \
-                                         "${@get_distro_source(d, True)}"
+                                         "${@get_distro_source(d, True)}" || exit 1
 
             else
                  sudo -E "${DEBOOTSTRAP}" --verbose \
@@ -198,45 +198,45 @@ isar_bootstrap() {
                                           ${DEBOOTSTRAP_KEYRING} \
                                          "${@get_distro_suite(d, False)}" \
                                          "${ROOTFSDIR}" \
-                                         "${@get_distro_source(d, False)}"
+                                         "${@get_distro_source(d, False)}" || exit 1
             fi
 
             # Install apt config
             sudo mkdir -p "${ROOTFSDIR}/etc/apt/preferences.d"
             sudo install -v -m644 "${APTPREFS}" \
-                                  "${ROOTFSDIR}/etc/apt/preferences.d/bootstrap"
+                                  "${ROOTFSDIR}/etc/apt/preferences.d/bootstrap" || exit 1
             sudo mkdir -p "${ROOTFSDIR}/etc/apt/sources.list.d"
             sudo install -v -m644 "${APTSRCS}" \
-                                  "${ROOTFSDIR}/etc/apt/sources.list.d/bootstrap.list"
+                                  "${ROOTFSDIR}/etc/apt/sources.list.d/bootstrap.list" || exit 1
             sudo rm -f "${ROOTFSDIR}/etc/apt/sources.list"
             sudo mkdir -p "${ROOTFSDIR}/etc/apt/apt.conf.d"
             sudo install -v -m644 "${WORKDIR}/isar-apt.conf" \
-                                  "${ROOTFSDIR}/etc/apt/apt.conf.d/50isar.conf"
+                                  "${ROOTFSDIR}/etc/apt/apt.conf.d/50isar.conf" || exit 1
 
             if [ "${@get_distro_suite(d, True)}" = "stretch" ] && [ "${@get_host_release().split('.')[0]}" -lt "4" ]; then
                 sudo install -v -m644 "${WORKDIR}/isar-apt-fallback.conf" \
-                                      "${ROOTFSDIR}/etc/apt/apt.conf.d/55isar-fallback.conf"
+                                      "${ROOTFSDIR}/etc/apt/apt.conf.d/55isar-fallback.conf" || exit 1
             fi
 
             # Set locale
-            sudo install -v -m644 "${WORKDIR}/locale" "${ROOTFSDIR}/etc/locale"
+            sudo install -v -m644 "${WORKDIR}/locale" "${ROOTFSDIR}/etc/locale" || exit 1
 
             sudo sed -i '/en_US.UTF-8 UTF-8/s/^#//g' "${ROOTFSDIR}/etc/locale.gen"
-            sudo -E chroot "${ROOTFSDIR}" /usr/sbin/locale-gen
+            sudo -E chroot "${ROOTFSDIR}" /usr/sbin/locale-gen || exit 1
 
             # setup chroot
-            sudo install -v -m755 "${WORKDIR}/chroot-setup.sh" "${ROOTFSDIR}/chroot-setup.sh"
-            sudo "${ROOTFSDIR}/chroot-setup.sh" "setup" "${ROOTFSDIR}"
+            sudo install -v -m755 "${WORKDIR}/chroot-setup.sh" "${ROOTFSDIR}/chroot-setup.sh" || exit 1
+            sudo "${ROOTFSDIR}/chroot-setup.sh" "setup" "${ROOTFSDIR}" || exit 1
 
             # update APT
-            sudo mount -t devtmpfs -o mode=0755,nosuid devtmpfs ${ROOTFSDIR}/dev
-            sudo mount -t proc none ${ROOTFSDIR}/proc
+            sudo mount -t devtmpfs -o mode=0755,nosuid devtmpfs ${ROOTFSDIR}/dev || exit 1
+            sudo mount -t proc none ${ROOTFSDIR}/proc || exit 1
 
             E="${@bb.utils.export_proxies(d)}"
             export DEBIAN_FRONTEND=noninteractive
-            sudo -E chroot "${ROOTFSDIR}" /usr/bin/apt-get update -y
+            sudo -E chroot "${ROOTFSDIR}" /usr/bin/apt-get update -y || exit 1
             sudo -E chroot "${ROOTFSDIR}" /usr/bin/apt-get dist-upgrade -y \
-                                      -o Debug::pkgProblemResolver=yes
+                                      -o Debug::pkgProblemResolver=yes || exit 1
 
             # Finalize debootstrap by setting the link in deploy
             ln -Tfsr "${ROOTFSDIR}" "${DEPLOY_ISAR_BOOTSTRAP}"
-- 
2.11.0


  parent reply	other threads:[~2018-08-10 10:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-10 10:31 [PATCH 0/2] Various bug fixes Maxim Yu. Osipov
2018-08-10 10:31 ` [PATCH 1/2] isar-bootstrap: Fix gpg error file name too long Maxim Yu. Osipov
2018-08-13  8:16   ` Henning Schild
2018-08-27 22:07   ` Maxim Yu. Osipov
2018-08-10 10:31 ` Maxim Yu. Osipov [this message]
2018-08-11 15:52   ` [PATCH 2/2] isar-bootstrap: exit if command fails under flock Jan Kiszka
2018-08-12  8:46     ` Maxim Yu. Osipov
2018-08-13  8:34       ` Henning Schild

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180810103150.28342-3-mosipov@ilbers.de \
    --to=mosipov@ilbers.de \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox