From 6e53d391ea47a9e6f40608dd9c12b0b48f3350c6 Mon Sep 17 00:00:00 2001
From: Ritesh Raj Sarraf <ritesh.sarraf@collabora.com>
Date: Tue, 21 May 2019 09:43:06 +0530
Subject: [PATCH] Import Apertis version 240-5co3

---
 debian/apertis/gitlab-ci.yml                  |   4 +
 debian/changelog                              |  30 +++
 debian/control                                |  15 ++
 debian/extra/zz_kernel-install                |  10 +
 ...ove-bashisms-from-the-depmod-wrapper.patch |  54 +++++
 ...isms-from-the-UEFI-entries-generator.patch | 131 ++++++++++++
 .../0003-Reworked-kernel-install-script.patch | 196 ++++++++++++++++++
 debian/patches/disable-failing-tests.patch    |  26 +++
 debian/patches/series                         |   4 +
 debian/systemd-boot.install                   |  13 ++
 debian/systemd-boot.links                     |   3 +
 debian/systemd.install                        |   4 -
 debian/tests/root-unittests                   |   5 +
 13 files changed, 491 insertions(+), 4 deletions(-)
 create mode 100644 debian/apertis/gitlab-ci.yml
 create mode 100755 debian/extra/zz_kernel-install
 create mode 100644 debian/patches/apertis/0001-Remove-bashisms-from-the-depmod-wrapper.patch
 create mode 100644 debian/patches/apertis/0002-Remove-bashisms-from-the-UEFI-entries-generator.patch
 create mode 100644 debian/patches/apertis/0003-Reworked-kernel-install-script.patch
 create mode 100644 debian/patches/disable-failing-tests.patch
 create mode 100644 debian/systemd-boot.install
 create mode 100644 debian/systemd-boot.links

diff --git a/debian/apertis/gitlab-ci.yml b/debian/apertis/gitlab-ci.yml
new file mode 100644
index 00000000..272299ca
--- /dev/null
+++ b/debian/apertis/gitlab-ci.yml
@@ -0,0 +1,4 @@
+include:
+  - project: 'infrastructure/ci-package-builder'
+    file: '/ci-package-builder.yml'
+
diff --git a/debian/changelog b/debian/changelog
index 3a62cfba..a026d66e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,33 @@
+systemd (240-5co3) apertis; urgency=medium
+
+  * d/patches/disable-failing-tests.patch
+    - Disable tests failing in Bosch's build environment (APERTIS-6048)
+    - test-netlink, test-stat-util
+
+ -- Ritesh Raj Sarraf <ritesh.sarraf@collabora.com>  Tue, 21 May 2019 09:43:06 +0530
+
+systemd (240-5co2) apertis; urgency=medium
+
+  * Uncomment code for initramfs compatibility.
+    Forgot to uncomment this code by occasion.
+
+ -- Denis Pynkin <denis.pynkin@collabora.com>  Thu, 14 Feb 2019 13:58:11 +0000
+
+systemd (240-5co1) apertis; urgency=medium
+
+  * Add patches removing bashisms from kernel-install.
+    Adapt kernel-install and parts for /bin/sh.
+  * Call `kernel-install` on kernel install and remove.
+    Set appropriate symlinks for kernel-install script to copy the kernel
+    and initramfs to EFI partition with generation of EFI loader entry
+    during kernel package install anr remove them on deinstallation.
+  * Add systemd-boot binary package.
+    Move all stuff related to EFI boot into separate package.
+  * Call `kernel-install` on changes in initramfs.
+    Allow to update the EFI loader entry on changes in initramfs.
+
+ -- Denis Pynkin <denis.pynkin@collabora.com>  Wed, 13 Feb 2019 16:43:19 +0000
+
 systemd (240-5) unstable; urgency=medium
 
   [ Felipe Sateler ]
diff --git a/debian/control b/debian/control
index f6930a26..ead882c9 100644
--- a/debian/control
+++ b/debian/control
@@ -65,6 +65,7 @@ Priority: important
 Recommends: libpam-systemd,
             dbus
 Suggests: systemd-container,
+          systemd-boot [amd64 arm64],
           policykit-1
 Pre-Depends: ${shlibs:Pre-Depends},
              ${misc:Pre-Depends}
@@ -394,3 +395,17 @@ Description: libudev shared library
  This library provides access to udev device information.
  .
  This is a minimal version, only for use in the installation system.
+
+Package: systemd-boot
+Architecture: amd64 arm64
+Multi-Arch: foreign
+Section: admin
+Priority: optional
+Depends: ${shlibs:Depends},
+         ${misc:Depends}
+Breaks: systemd (<< 232-25co4),
+        gummiboot
+Replaces: systemd (<< 232-25co4),
+          gummiboot
+Description: systemd EFI boot management
+ This package provides systemd's tools and binaries for EFI boot management.
diff --git a/debian/extra/zz_kernel-install b/debian/extra/zz_kernel-install
new file mode 100755
index 00000000..1bb9e008
--- /dev/null
+++ b/debian/extra/zz_kernel-install
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+case "$DPKG_MAINTSCRIPT_PACKAGE" in
+    linux-image-*)
+        exit 0
+        ;;
+    *)
+        kernel-install add "$1"
+        ;;
+esac
diff --git a/debian/patches/apertis/0001-Remove-bashisms-from-the-depmod-wrapper.patch b/debian/patches/apertis/0001-Remove-bashisms-from-the-depmod-wrapper.patch
new file mode 100644
index 00000000..bfbd417a
--- /dev/null
+++ b/debian/patches/apertis/0001-Remove-bashisms-from-the-depmod-wrapper.patch
@@ -0,0 +1,54 @@
+From fedc892fb38e059a2f675f33770ddd9e4cad235f Mon Sep 17 00:00:00 2001
+From: Denis Pynkin <denis.pynkin@collabora.com>
+Date: Thu, 24 Jan 2019 22:40:46 +0300
+Subject: [PATCH 1/3] Remove bashisms from the depmod wrapper
+
+- Use [ not [[ and -n to test for non-emptiness
+- Use for loop instead of comma expansion
+
+Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
+[ Rebased to the latest master, amended the rm call ]
+Signed-off-by: Andrej Shadura <andrew.shadura@collabora.co.uk>
+---
+ src/kernel-install/50-depmod.install | 19 +++++++++++++++----
+ 1 file changed, 15 insertions(+), 4 deletions(-)
+
+diff --git a/src/kernel-install/50-depmod.install b/src/kernel-install/50-depmod.install
+index 88f550a486..78fdf6b7ea 100644
+--- a/src/kernel-install/50-depmod.install
++++ b/src/kernel-install/50-depmod.install
+@@ -1,16 +1,27 @@
+-#!/bin/bash
++#!/bin/sh
+ # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+ # ex: ts=8 sw=4 sts=4 et filetype=sh
+ 
+-[[ $2 ]] || exit 1
++[ -n "$2" ] || exit 1
+ 
+ case "$1" in
+     add)
+-        [[ -d /lib/modules/"$2"/kernel ]] || exit 0
++        [ -d "/lib/modules/$2/kernel" ] || exit 0
+         exec depmod -a "$2"
+         ;;
+     remove)
+-        exec rm -f /lib/modules/"$2"/modules.{alias{,.bin},builtin.bin,dep{,.bin},devname,softdep,symbols{,.bin}}
++        for d in alias \
++            alias.bin \
++            builtin.bin \
++            dep \
++            dep.bin \
++            devname \
++            softdep \
++            symbols \
++            symbols.bin
++        do
++            rm -f "/lib/modules/$2/modules.$d"
++        done
+         ;;
+     *)
+         exit 0
+-- 
+2.19.2
+
diff --git a/debian/patches/apertis/0002-Remove-bashisms-from-the-UEFI-entries-generator.patch b/debian/patches/apertis/0002-Remove-bashisms-from-the-UEFI-entries-generator.patch
new file mode 100644
index 00000000..1ae4c833
--- /dev/null
+++ b/debian/patches/apertis/0002-Remove-bashisms-from-the-UEFI-entries-generator.patch
@@ -0,0 +1,131 @@
+From efbd303a1450ebf4ad4bbfec2b2070c0518d6cc5 Mon Sep 17 00:00:00 2001
+From: Denis Pynkin <denis.pynkin@collabora.com>
+Date: Thu, 14 Feb 2019 00:04:13 +0300
+Subject: [PATCH 2/3] Remove bashisms from the UEFI entries generator
+
+- Use [ not [[ and -n to test for non-emptiness
+- Use shell lists instead of arrays
+
+Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
+---
+ src/kernel-install/90-loaderentry.install | 55 ++++++++++++-----------
+ 1 file changed, 29 insertions(+), 26 deletions(-)
+
+diff --git a/src/kernel-install/90-loaderentry.install b/src/kernel-install/90-loaderentry.install
+index 39ec8a69c6..087dd78a99 100644
+--- a/src/kernel-install/90-loaderentry.install
++++ b/src/kernel-install/90-loaderentry.install
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/bin/sh
+ # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+ # ex: ts=8 sw=4 sts=4 et filetype=sh
+ 
+@@ -7,66 +7,69 @@ KERNEL_VERSION="$2"
+ BOOT_DIR_ABS="$3"
+ KERNEL_IMAGE="$4"
+ 
+-if ! [[ $KERNEL_INSTALL_MACHINE_ID ]]; then
+-    exit 0
++if ! [ -n "$KERNEL_INSTALL_MACHINE_ID" ]; then
++    if ! [ -f /etc/machine-id ]; then
++        exit 0
++    fi
++    read KERNEL_INSTALL_MACHINE_ID </etc/machine-id
+ fi
+ 
+-if ! [[ -d "$BOOT_DIR_ABS" ]]; then
++if ! [ -d "$BOOT_DIR_ABS" ]; then
+     exit 0
+ fi
+ 
+ MACHINE_ID=$KERNEL_INSTALL_MACHINE_ID
+ 
+ BOOT_DIR="/$MACHINE_ID/$KERNEL_VERSION"
+-BOOT_ROOT=${BOOT_DIR_ABS%$BOOT_DIR}
++BOOT_ROOT="${BOOT_DIR_ABS%$BOOT_DIR}"
+ 
+-if [[ $COMMAND == remove ]]; then
++if [ "$COMMAND" = "remove" ]; then
+     rm -f "$BOOT_ROOT/loader/entries/$MACHINE_ID-$KERNEL_VERSION.conf"
+     rm -f "$BOOT_ROOT/loader/entries/$MACHINE_ID-$KERNEL_VERSION+"*".conf"
+     exit 0
+ fi
+ 
+-if ! [[ $COMMAND == add ]]; then
++if ! [ "$COMMAND" = "add" ]; then
+     exit 1
+ fi
+ 
+-if ! [[ $KERNEL_IMAGE ]]; then
++if [ -z "$KERNEL_IMAGE" ]; then
+     exit 1
+ fi
+ 
+-if [[ -f /etc/os-release ]]; then
++if [ -f /etc/os-release ]; then
+     . /etc/os-release
+-elif [[ -f /usr/lib/os-release ]]; then
++elif [ -f /usr/lib/os-release ]; then
+     . /usr/lib/os-release
+ fi
+ 
+-if ! [[ $PRETTY_NAME ]]; then
++if [ -z "$PRETTY_NAME" ]; then
+     PRETTY_NAME="Linux $KERNEL_VERSION"
+ fi
+ 
+-declare -a BOOT_OPTIONS
+-
+-if [[ -f /etc/kernel/cmdline ]]; then
+-    read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
++if [ -f /etc/kernel/cmdline ]; then
++    read -r BOOT_OPTIONS < /etc/kernel/cmdline
+ fi
+ 
+-if ! [[ ${BOOT_OPTIONS[*]} ]]; then
+-    read -r -d '' -a line < /proc/cmdline
+-    for i in "${line[@]}"; do
+-        [[ "${i#initrd=*}" != "$i" ]] && continue
+-        BOOT_OPTIONS+=("$i")
+-    done
++if [ -z "${BOOT_OPTIONS}" ] && [ -f "/proc/cmdline" ]; then
++    BOOT_OPTIONS=$(
++        cat /proc/cmdline | tr ' ' '\n' | \
++        while read -r i; do
++            [ "${i#initrd=*}" != "$i" ] && continue
++            echo -n " $i"
++        done
++    )
+ fi
+ 
+-if ! [[ ${BOOT_OPTIONS[*]} ]]; then
++if [ -z "${BOOT_OPTIONS}" ]; then
+     echo "Could not determine the kernel command line parameters." >&2
+     echo "Please specify the kernel command line in /etc/kernel/cmdline!" >&2
+     exit 1
+ fi
+ 
+-if [[ -f /etc/kernel/tries ]]; then
++if [ -f /etc/kernel/tries ]; then
+     read -r TRIES </etc/kernel/tries
+-    if ! [[ "$TRIES" =~ ^[0-9]+$ ]] ; then
++    if [ -z "${TRIES##*[!0-9]*}" ] ; then
+         echo "/etc/kernel/tries does not contain an integer." >&2
+         exit 1
+     fi
+@@ -91,9 +94,9 @@ mkdir -p "${LOADER_ENTRY%/*}" || {
+     echo "title      $PRETTY_NAME"
+     echo "version    $KERNEL_VERSION"
+     echo "machine-id $MACHINE_ID"
+-    echo "options    ${BOOT_OPTIONS[*]}"
++    echo "options    $BOOT_OPTIONS"
+     echo "linux      $BOOT_DIR/linux"
+-    [[ -f $BOOT_DIR_ABS/initrd ]] && \
++    [ -f $BOOT_DIR_ABS/initrd ] && \
+         echo "initrd     $BOOT_DIR/initrd"
+     :
+ } > "$LOADER_ENTRY" || {
+-- 
+2.19.2
+
diff --git a/debian/patches/apertis/0003-Reworked-kernel-install-script.patch b/debian/patches/apertis/0003-Reworked-kernel-install-script.patch
new file mode 100644
index 00000000..580bca59
--- /dev/null
+++ b/debian/patches/apertis/0003-Reworked-kernel-install-script.patch
@@ -0,0 +1,196 @@
+From 846fbb18270c33ebe4c11c32ea65ab0d6a114fbf Mon Sep 17 00:00:00 2001
+From: Denis Pynkin <denis.pynkin@collabora.com>
+Date: Thu, 14 Feb 2019 00:46:48 +0300
+Subject: [PATCH 3/3] Reworked kernel-install script
+
+- Removed bashisms -- script is adapted for running with `/bin/sh`
+- Add support of calling the script without passing the kernel image.
+- Allow to use name prefix while detecting the action.
+  If the name of (sym)link to 'kernel-install' script ends with
+  'installkernel' or 'removekernel' -- the action 'add' or 'remove' is
+  assumed. This change allow to use file names like `zz_installkernel`
+  to force it to run last during the kernel installing or removing.
+
+Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
+---
+ src/kernel-install/kernel-install | 77 ++++++++++++++++---------------
+ 1 file changed, 41 insertions(+), 36 deletions(-)
+
+diff --git a/src/kernel-install/kernel-install b/src/kernel-install/kernel-install
+index 732d584bbe..1dffc5ea23 100644
+--- a/src/kernel-install/kernel-install
++++ b/src/kernel-install/kernel-install
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/bin/sh
+ # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+ # ex: ts=8 sw=4 sts=4 et filetype=sh
+ # SPDX-License-Identifier: LGPL-2.1+
+@@ -31,22 +31,18 @@ usage()
+ dropindirs_sort()
+ {
+     local suffix=$1; shift
+-    local -a files
+     local f d i
+ 
+-    readarray -t files <<<"$(
+-        for d in "$@"; do
+-            for i in "$d/"*"$suffix"; do
+-                if [[ -e "$i" ]]; then
+-                    echo "${i##*/}"
+-                fi
+-            done
+-        done | sort -Vu
+-    )"
+-
+-    for f in "${files[@]}"; do
++    for d in "$@"; do
++        for i in "$d/"*"$suffix"; do
++            if [ -e "$i" ]; then
++                echo "${i##*/}"
++            fi
++        done
++    done | sort -u | \
++    while read f; do
+         for d in "$@"; do
+-            if [[ -e "$d/$f" ]]; then
++            if [ -e "$d/$f" ]; then
+                 echo "$d/$f"
+                 continue 2
+             fi
+@@ -57,14 +53,16 @@ dropindirs_sort()
+ export LC_COLLATE=C
+ 
+ for i in "$@"; do
+-    if [ "$i" == "--help" -o "$i" == "-h" ]; then
++    if [ "$i" = "--help" ] || [ "$i" = "-h" ]; then
+         usage
+         exit 0
+     fi
+ done
+ 
+-if [[ "${0##*/}" == 'installkernel' ]]; then
++if [ "${0%installkernel}" != "${0}" ]; then
+     COMMAND='add'
++elif [ "${0%removekernel}" != "${0}" ]; then
++    COMMAND='remove'
+ else
+     COMMAND="$1"
+     shift
+@@ -73,23 +71,28 @@ fi
+ KERNEL_VERSION="$1"
+ KERNEL_IMAGE="$2"
+ 
+-if [[ -f /etc/machine-id ]]; then
++if [ -f /etc/machine-id ]; then
+     read MACHINE_ID < /etc/machine-id
+ fi
+ 
+-if [[ ! $COMMAND ]] || [[ ! $KERNEL_VERSION ]]; then
++if [ -z "$COMMAND" ] || [ -z "$KERNEL_VERSION" ]; then
+     echo "Not enough arguments" >&2
+     exit 1
+ fi
+ 
+-if ! [[ $MACHINE_ID ]]; then
++# According to man page 2-nd parameter could be skipped
++if [ -z "$KERNEL_IMAGE" ]; then
++    KERNEL_IMAGE="/boot/vmlinuz-$KERNEL_VERSION"
++fi
++
++if [ -z "$MACHINE_ID" ]; then
+     BOOT_DIR_ABS=$(mktemp -d /tmp/kernel-install.XXXXX) || exit 1
+     trap "rm -rf '$BOOT_DIR_ABS'" EXIT INT QUIT PIPE
+-elif [[ -d /efi/loader/entries ]] || [[ -d /efi/$MACHINE_ID ]]; then
++elif [ -d /efi/loader/entries ] || [ -d /efi/$MACHINE_ID ]; then
+     BOOT_DIR_ABS="/efi/$MACHINE_ID/$KERNEL_VERSION"
+-elif [[ -d /boot/loader/entries ]] || [[ -d /boot/$MACHINE_ID ]]; then
++elif [ -d /boot/loader/entries ] || [ -d /boot/$MACHINE_ID ]; then
+     BOOT_DIR_ABS="/boot/$MACHINE_ID/$KERNEL_VERSION"
+-elif [[ -d /boot/efi/loader/entries ]] || [[ -d /boot/efi/$MACHINE_ID ]]; then
++elif [ -d /boot/efi/loader/entries ] || [ -d /boot/efi/$MACHINE_ID ]; then
+     BOOT_DIR_ABS="/boot/efi/$MACHINE_ID/$KERNEL_VERSION"
+ elif mountpoint -q /efi; then
+     BOOT_DIR_ABS="/efi/$MACHINE_ID/$KERNEL_VERSION"
+@@ -103,15 +106,16 @@ export KERNEL_INSTALL_MACHINE_ID=$MACHINE_ID
+ 
+ ret=0
+ 
+-readarray -t PLUGINS <<<"$(
++
++plugins_list(){
+     dropindirs_sort ".install" \
+         "/etc/kernel/install.d" \
+         "/usr/lib/kernel/install.d"
+-)"
++}
+ 
+ case $COMMAND in
+     add)
+-        if [[ ! "$KERNEL_IMAGE" ]]; then
++        if [ -z "$KERNEL_IMAGE" ]; then
+             echo "Command 'add' requires an argument" >&2
+             exit 1
+         fi
+@@ -121,42 +125,42 @@ case $COMMAND in
+             exit 1
+         }
+ 
+-        for f in "${PLUGINS[@]}"; do
+-            if [[ -x $f ]]; then
++        plugins_list | while read f; do
++            if [ -x "$f" ]; then
+                 "$f" add "$KERNEL_VERSION" "$BOOT_DIR_ABS" "$KERNEL_IMAGE"
+                 x=$?
+-                if [[ $x == $SKIP_REMAINING ]]; then
++                if [ "$x" = "$SKIP_REMAINING" ]; then
+                     ret=0
+                     break
+                 fi
+-                ((ret+=$x))
++                ret=`expr $ret + $x`
+             fi
+         done
+ 
+-        if ! [[ $MACHINE_ID ]] && ! rmdir "$BOOT_DIR_ABS"; then
++        if [ -z "$MACHINE_ID" ] && ! rmdir "$BOOT_DIR_ABS"; then
+             echo "Warning: In kernel-install plugins, requiring BOOT_DIR_ABS to be preset is deprecated." >&2
+             echo "         All plugins should not put anything in BOOT_DIR_ABS if the environment" >&2
+             echo "         variable KERNEL_INSTALL_MACHINE_ID is empty." >&2
+             rm -rf "$BOOT_DIR_ABS"
+-            ((ret+=$?))
++            ret=`expr $ret + $?`
+         fi
+         ;;
+ 
+     remove)
+-        for f in "${PLUGINS[@]}"; do
+-            if [[ -x $f ]]; then
++        plugins_list | while read f; do
++            if [ -x "$f" ]; then
+                 "$f" remove "$KERNEL_VERSION" "$BOOT_DIR_ABS"
+                 x=$?
+-                if [[ $x == $SKIP_REMAINING ]]; then
++                if [ "$x" = "$SKIP_REMAINING" ]; then
+                     ret=0
+                     break
+                 fi
+-                ((ret+=$x))
++                ret=`expr $ret + $x`
+             fi
+         done
+ 
+         rm -rf "$BOOT_DIR_ABS"
+-        ((ret+=$?))
++        ret=`expr $ret + $?`
+         ;;
+ 
+     *)
+@@ -166,3 +170,4 @@ case $COMMAND in
+ esac
+ 
+ exit $ret
++
+-- 
+2.19.2
+
diff --git a/debian/patches/disable-failing-tests.patch b/debian/patches/disable-failing-tests.patch
new file mode 100644
index 00000000..552f67aa
--- /dev/null
+++ b/debian/patches/disable-failing-tests.patch
@@ -0,0 +1,26 @@
+Disable tests: test-stat-util, test-netlink
+These tests are reported to fail in Bosch's build setup
+--- a/src/test/meson.build
++++ b/src/test/meson.build
+@@ -280,10 +280,6 @@
+          [],
+          []],
+ 
+-        [['src/test/test-stat-util.c'],
+-         [],
+-         []],
+-
+         [['src/test/test-os-util.c'],
+          [],
+          []],
+@@ -919,10 +915,6 @@
+          [],
+          []],
+ 
+-        [['src/libsystemd/sd-netlink/test-netlink.c'],
+-         [],
+-         []],
+-
+         [['src/libsystemd/sd-netlink/test-local-addresses.c'],
+          [],
+          []],
diff --git a/debian/patches/series b/debian/patches/series
index 9a7e241d..32b5a71c 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -58,3 +58,7 @@ debian/Let-graphical-session-pre.target-be-manually-started.patch
 debian/Add-env-variable-for-machine-ID-path.patch
 debian/Revert-udev-rules-Permission-changes-for-dev-dri-renderD.patch
 debian/Drop-seccomp-system-call-filter-for-udev.patch
+apertis/0001-Remove-bashisms-from-the-depmod-wrapper.patch
+apertis/0002-Remove-bashisms-from-the-UEFI-entries-generator.patch
+apertis/0003-Reworked-kernel-install-script.patch
+disable-failing-tests.patch
diff --git a/debian/systemd-boot.install b/debian/systemd-boot.install
new file mode 100644
index 00000000..5f22b44c
--- /dev/null
+++ b/debian/systemd-boot.install
@@ -0,0 +1,13 @@
+etc/kernel
+usr/bin/bootctl
+usr/bin/kernel-install
+usr/lib/systemd/boot
+usr/share/man/man1/bootctl*
+usr/share/man/man8/kernel-install*
+usr/share/bash-completion/completions/bootctl
+usr/share/bash-completion/completions/kernel-install
+usr/share/zsh/vendor-completions/_bootctl
+usr/share/zsh/vendor-completions/_kernel-install
+usr/lib/kernel
+../../extra/kernel-install.d/* usr/lib/kernel/install.d
+../../extra/zz_kernel-install etc/initramfs/post-update.d
diff --git a/debian/systemd-boot.links b/debian/systemd-boot.links
new file mode 100644
index 00000000..20fe0bb5
--- /dev/null
+++ b/debian/systemd-boot.links
@@ -0,0 +1,3 @@
+# Links for adding/removing kernel and initramfs
+/usr/bin/kernel-install /etc/kernel/postinst.d/zz_installkernel
+/usr/bin/kernel-install /etc/kernel/postrm.d/zz_removekernel
\ No newline at end of file
diff --git a/debian/systemd.install b/debian/systemd.install
index f0fa42cb..5ad45119 100644
--- a/debian/systemd.install
+++ b/debian/systemd.install
@@ -32,8 +32,6 @@ usr/bin/systemd-socket-activate
 usr/bin/systemd-mount
 usr/bin/systemd-umount
 usr/bin/systemd-id128
-usr/bin/kernel-install
-usr/bin/bootctl
 usr/bin/busctl
 usr/bin/timedatectl
 usr/bin/localectl
@@ -60,7 +58,6 @@ usr/lib/sysusers.d/basic.conf
 usr/lib/sysusers.d/systemd.conf
 usr/lib/systemd/
 usr/lib/tmpfiles.d/
-usr/lib/kernel
 usr/share/locale/
 var/lib
 ../../extra/init-functions.d lib/lsb/
@@ -68,5 +65,4 @@ var/lib
 ../../extra/systemd-sysv-install lib/systemd/
 ../../extra/units/* lib/systemd/system/
 ../../extra/dhclient-exit-hooks.d/ etc/dhcp/
-../../extra/kernel-install.d/* usr/lib/kernel/install.d
 ../../extra/pam.d etc/
diff --git a/debian/tests/root-unittests b/debian/tests/root-unittests
index 96416e28..64208cb1 100644
--- a/debian/tests/root-unittests
+++ b/debian/tests/root-unittests
@@ -6,6 +6,11 @@ EXFAIL=""
 res=0
 for t in /usr/lib/systemd/tests/test-*; do
     tname=$(basename $t)
+
+    # Don't run tests that are failing in Bosch's environment
+    [ "$tname" != test-stat-util ] || continue
+    [ "$tname" != test-netlink ] || continue
+
     # test-udev needs special prep and has its own test
     [ "$tname" != test-udev ] || continue
     echo "====== $tname ======="
-- 
GitLab