From 1ad84c9af83f2dc3e54d8c958e33dd08141b529d Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Tue, 21 Feb 2023 15:23:15 +0100 Subject: [PATCH] mkosi: Reduce postinst script indentation --- mkosi.postinst | 82 ++++++++++++++++++++++++++------------------------ 1 file changed, 42 insertions(+), 40 deletions(-) diff --git a/mkosi.postinst b/mkosi.postinst index 0a6946e600..43cc818393 100755 --- a/mkosi.postinst +++ b/mkosi.postinst @@ -1,13 +1,16 @@ #!/bin/sh # SPDX-License-Identifier: LGPL-2.1-or-later -if [ "$1" = "final" ]; then - if [ -n "$SANITIZERS" ]; then - LD_PRELOAD=$(ldd /usr/lib/systemd/systemd | grep libasan.so | awk '{print $3}') +if [ "$1" = "build" ]; then + exit 0 +fi - mkdir -p /etc/systemd/system.conf.d +if [ -n "$SANITIZERS" ]; then + LD_PRELOAD=$(ldd /usr/lib/systemd/systemd | grep libasan.so | awk '{print $3}') - cat >/etc/systemd/system.conf.d/10-asan.conf </etc/systemd/system.conf.d/10-asan.conf </etc/systemd/system/systemd-journald.service.d/10-stdout-tty.conf </etc/systemd/system/systemd-journald.service.d/10-stdout-tty.conf </etc/systemd/system/console-getty.service.d/10-no-vhangup.conf </etc/systemd/system/console-getty.service.d/10-no-vhangup.conf < 50s when built with sanitizers so let's not run it by default. - systemctl mask systemd-hwdb-update.service - fi - - # Make sure dnsmasq.service doesn't start on boot on Debian/Ubuntu. - rm -f /etc/systemd/system/multi-user.target.wants/dnsmasq.service - - if [ -n "$IMAGE_ID" ] ; then - sed -n \ - -i \ - -e '/^IMAGE_ID=/!p' \ - -e "\$aIMAGE_ID=$IMAGE_ID" \ - /usr/lib/os-release - fi - - if [ -n "$IMAGE_VERSION" ] ; then - sed -n \ - -i \ - -e '/^IMAGE_VERSION=/!p' \ - -e "\$aIMAGE_VERSION=$IMAGE_VERSION" \ - /usr/lib/os-release - fi + # `systemd-hwdb update` takes > 50s when built with sanitizers so let's not run it by default. + systemctl mask systemd-hwdb-update.service +fi + +# Make sure dnsmasq.service doesn't start on boot on Debian/Ubuntu. +rm -f /etc/systemd/system/multi-user.target.wants/dnsmasq.service + +if [ -n "$IMAGE_ID" ] ; then + sed -n \ + -i \ + -e '/^IMAGE_ID=/!p' \ + -e "\$aIMAGE_ID=$IMAGE_ID" \ + /usr/lib/os-release +fi + +if [ -n "$IMAGE_VERSION" ] ; then + sed -n \ + -i \ + -e '/^IMAGE_VERSION=/!p' \ + -e "\$aIMAGE_VERSION=$IMAGE_VERSION" \ + /usr/lib/os-release fi