From 23b302624e4fc3aefe29b897c7c5f4dfaa58edd6 Mon Sep 17 00:00:00 2001
From: Ritesh Raj Sarraf <ritesh.sarraf@collabora.com>
Date: Fri, 7 Apr 2023 15:25:35 +0530
Subject: [PATCH] Drop Apertis patches

Most are now integrated in this upstream release

Signed-off-by: Ritesh Raj Sarraf <ritesh.sarraf@collabora.com>
---
 ...th-to-bootable-binaries-in-efi-entry.patch |  36 ---
 ...isms-from-the-UEFI-entries-generator.patch | 161 -------------
 ...ove-bashisms-from-the-depmod-wrapper.patch |  60 -----
 ...isms-from-the-entry-directory-plugin.patch |  39 ---
 .../Reworked-kernel-install-script.patch      | 226 ------------------
 ...-linux-Sync-if_arp.h-with-Linux-5.14.patch |  23 --
 ...tall-allow-to-create-BOOT-MACHINE_ID.patch |  44 ----
 ...c-is-not-installed-with-meson-0.57.2.patch |  53 ----
 ...operator-combining-bools-from-to-and.patch |  32 ---
 ...flush-Add-a-requirement-on-var.mount.patch |  43 ----
 debian/patches/series                         |  10 -
 11 files changed, 727 deletions(-)
 delete mode 100644 debian/patches/apertis/Fix-the-path-to-bootable-binaries-in-efi-entry.patch
 delete mode 100644 debian/patches/apertis/Remove-bashisms-from-the-UEFI-entries-generator.patch
 delete mode 100644 debian/patches/apertis/Remove-bashisms-from-the-depmod-wrapper.patch
 delete mode 100644 debian/patches/apertis/Remove-bashisms-from-the-entry-directory-plugin.patch
 delete mode 100644 debian/patches/apertis/Reworked-kernel-install-script.patch
 delete mode 100644 debian/patches/apertis/basic-linux-Sync-if_arp.h-with-Linux-5.14.patch
 delete mode 100644 debian/patches/apertis/kernel-install-allow-to-create-BOOT-MACHINE_ID.patch
 delete mode 100644 debian/patches/apertis/meson-do-not-fail-if-rsync-is-not-installed-with-meson-0.57.2.patch
 delete mode 100644 debian/patches/apertis/meson.build-change-operator-combining-bools-from-to-and.patch
 delete mode 100644 debian/patches/apertis/systemd-journal-flush-Add-a-requirement-on-var.mount.patch

diff --git a/debian/patches/apertis/Fix-the-path-to-bootable-binaries-in-efi-entry.patch b/debian/patches/apertis/Fix-the-path-to-bootable-binaries-in-efi-entry.patch
deleted file mode 100644
index d83378ef..00000000
--- a/debian/patches/apertis/Fix-the-path-to-bootable-binaries-in-efi-entry.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From eddc14ee54896149a9b6293255352185669abcd6 Mon Sep 17 00:00:00 2001
-From: Denis Pynkin <denis.pynkin@collabora.com>
-Date: Mon, 3 May 2021 23:04:26 +0000
-Subject: Fix the path to bootable binaries in efi entry
-
-`stat` doesn't work well due `coreutils-gplv2`
-created by Debos returning "?" instead of mount point.
-Fall back to the provided directory, since we have separate
-partition for "/boot/efi".
-This change allow to use correct paths for kernel and initrd
-for entry generation.
-
-Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
----
- src/kernel-install/90-loaderentry.install | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/src/kernel-install/90-loaderentry.install b/src/kernel-install/90-loaderentry.install
-index 0c73007..c61bf2b 100644
---- a/src/kernel-install/90-loaderentry.install
-+++ b/src/kernel-install/90-loaderentry.install
-@@ -20,6 +20,11 @@ MACHINE_ID=$KERNEL_INSTALL_MACHINE_ID
- 
- BOOT_ROOT=${ENTRY_DIR_ABS%/$MACHINE_ID/$KERNEL_VERSION}
- BOOT_MNT=$(stat -c %m $BOOT_ROOT)
-+# stat doesn't work well due `coreutils-gplv2`
-+# returning "?" instead of mount point.
-+# Fall back to the provided directory, since we have separate
-+# partition for "/boot/efi"
-+mountpoint "$BOOT_MNT" || BOOT_MNT="$BOOT_ROOT"
- ENTRY_DIR=${ENTRY_DIR_ABS#$BOOT_MNT}
- 
- if [ $COMMAND = "remove" ]; then
--- 
-2.20.1
-
diff --git a/debian/patches/apertis/Remove-bashisms-from-the-UEFI-entries-generator.patch b/debian/patches/apertis/Remove-bashisms-from-the-UEFI-entries-generator.patch
deleted file mode 100644
index ae422890..00000000
--- a/debian/patches/apertis/Remove-bashisms-from-the-UEFI-entries-generator.patch
+++ /dev/null
@@ -1,161 +0,0 @@
-From 48877ecd94ff71c03e3d880601fb0ba067f11a35 Mon Sep 17 00:00:00 2001
-From: Denis Pynkin <denis.pynkin@collabora.com>
-Date: Mon, 3 May 2021 02:28:43 +0300
-Subject: Remove bashisms from the UEFI entries generator
-
-- Use [ not [[ and -z to test for non-emptiness
-- Use shell lists instead of arrays
-
-Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
-Signed-off-by: Frederic Dalleau <frederic.dalleau@collabora.com>
----
- src/kernel-install/90-loaderentry.install | 75 +++++++++++++----------
- 1 file changed, 42 insertions(+), 33 deletions(-)
-
-diff --git a/src/kernel-install/90-loaderentry.install b/src/kernel-install/90-loaderentry.install
-index d096745..12d7b6e 100644
---- a/src/kernel-install/90-loaderentry.install
-+++ b/src/kernel-install/90-loaderentry.install
-@@ -1,4 +1,4 @@
--#!/usr/bin/env bash
-+#!/bin/sh
- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
- # ex: ts=8 sw=4 sts=4 et filetype=sh
- 
-@@ -8,11 +8,11 @@ ENTRY_DIR_ABS="$3"
- KERNEL_IMAGE="$4"
- INITRD_OPTIONS_START="5"
- 
--if ! [[ $KERNEL_INSTALL_MACHINE_ID ]]; then
-+if [ -z "$KERNEL_INSTALL_MACHINE_ID" ]; then
-     exit 0
- fi
- 
--if ! [[ -d "$ENTRY_DIR_ABS" ]]; then
-+if ! [ -d "$ENTRY_DIR_ABS" ]; then
-     exit 0
- fi
- 
-@@ -22,48 +22,47 @@ BOOT_ROOT=${ENTRY_DIR_ABS%/$MACHINE_ID/$KERNEL_VERSION}
- BOOT_MNT=$(stat -c %m $BOOT_ROOT)
- ENTRY_DIR=${ENTRY_DIR_ABS#$BOOT_MNT}
- 
--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
- 
--if [[ -f /etc/kernel/cmdline ]]; then
--    read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
--elif [[ -f /usr/lib/kernel/cmdline ]]; then
--    read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline
--else
--    declare -a BOOT_OPTIONS
--
--    read -r -d '' -a line < /proc/cmdline
--    for i in "${line[@]}"; do
--        [[ "${i#initrd=*}" != "$i" ]] && continue
--        [[ "${i#BOOT_IMAGE=*}" != "$i" ]] && continue
--        BOOT_OPTIONS+=("$i")
--    done
-+if [ -f /etc/kernel/cmdline ]; then
-+    read -r BOOT_OPTIONS < /etc/kernel/cmdline
-+elif [ -f /usr/lib/kernel/cmdline ]; then
-+    read -r BOOT_OPTIONS < /usr/lib/kernel/cmdline
-+elif [ -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 [[ -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
-@@ -79,11 +78,20 @@ cp "$KERNEL_IMAGE" "$ENTRY_DIR_ABS/linux" &&
-     exit 1
- }
- 
--INITRD_OPTIONS=( "${@:${INITRD_OPTIONS_START}}" )
-+shift $INITRD_OPTIONS_START
-+INITRD_OPTIONS=""
-+while [ $# -gt 0 ] ; do
-+ if [ -z "$INITRD_OPTIONS" ] ; then
-+   INITRD_OPTIONS="$1"
-+ else
-+   INITRD_OPTIONS="$INITRD_OPTIONS\n$1"
-+ fi
-+ shift
-+done
- 
--for initrd in "${INITRD_OPTIONS[@]}"; do
--    if [[ -f "${initrd}" ]]; then
--        initrd_basename="$(basename ${initrd})"
-+echo "${INITRD_OPTIONS}" | while read initrd; do
-+    if [ -f "${initrd}" ]; then
-+        initrd_basename=$(basename "${initrd}")
-         [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \
-             echo "Installing $ENTRY_DIR_ABS/${initrd_basename}"
-         cp "${initrd}" "$ENTRY_DIR_ABS/${initrd_basename}" &&
-@@ -97,7 +105,7 @@ done
- 
- # If no initrd option is supplied, fall back to "initrd" which is
- # the name used by dracut when generating it in its kernel-install hook
--[[ ${#INITRD_OPTIONS[@]} == 0 ]] && INITRD_OPTIONS=( initrd )
-+[ -z "${INITRD_OPTIONS}" ] && INITRD_OPTIONS=initrd
- 
- mkdir -p "${LOADER_ENTRY%/*}" || {
-     echo "Could not create loader entry directory '${LOADER_ENTRY%/*}'." >&2
-@@ -110,11 +118,12 @@ 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      $ENTRY_DIR/linux"
--    for initrd in "${INITRD_OPTIONS[@]}"; do
--        [[ -f $ENTRY_DIR_ABS/$(basename ${initrd}) ]] && \
--            echo "initrd     $ENTRY_DIR/$(basename ${initrd})"
-+    echo "${INITRD_OPTIONS}" | while read initrd; do
-+        initrd_basename=$(basename "${initrd}")
-+        [ -f "$ENTRY_DIR_ABS/${initrd_basename}" ] && \
-+            echo "initrd     $ENTRY_DIR/${initrd_basename}"
-     done
-     :
- } > "$LOADER_ENTRY" || {
--- 
-2.29.3
-
diff --git a/debian/patches/apertis/Remove-bashisms-from-the-depmod-wrapper.patch b/debian/patches/apertis/Remove-bashisms-from-the-depmod-wrapper.patch
deleted file mode 100644
index 20b77a86..00000000
--- a/debian/patches/apertis/Remove-bashisms-from-the-depmod-wrapper.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-From: Denis Pynkin <denis.pynkin@collabora.com>
-Date: Thu, 24 Jan 2019 22:40:46 +0300
-Subject: 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 | 21 ++++++++++++++++-----
- 1 file changed, 16 insertions(+), 5 deletions(-)
-
-diff --git a/src/kernel-install/50-depmod.install b/src/kernel-install/50-depmod.install
-index 3850eac..2b026da 100644
---- a/src/kernel-install/50-depmod.install
-+++ b/src/kernel-install/50-depmod.install
-@@ -1,4 +1,4 @@
--#!/usr/bin/env bash
-+#!/bin/sh
- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
- # ex: ts=8 sw=4 sts=4 et filetype=sh
- 
-@@ -8,11 +8,11 @@ ENTRY_DIR_ABS="$3"
- KERNEL_IMAGE="$4"
- INITRD_OPTIONS_START="5"
- 
--[[ $KERNEL_VERSION ]] || exit 1
-+[ -n $KERNEL_VERSION ] || exit 1
- 
- case "$COMMAND" in
-     add)
--        [[ -d "/lib/modules/${KERNEL_VERSION}/kernel" ]] || exit 0
-+        [ -d "/lib/modules/${KERNEL_VERSION}/kernel" ] || exit 0
-         [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \
-             echo "Running depmod -a ${KERNEL_VERSION}"
-         exec depmod -a "${KERNEL_VERSION}"
-@@ -20,8 +20,19 @@ case "$COMMAND" in
-     remove)
-         [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \
-             echo "Removing /lib/modules/${KERNEL_VERSION}/modules.dep and associated files"
--        exec rm -f /lib/modules/"${KERNEL_VERSION}"/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
- esac
diff --git a/debian/patches/apertis/Remove-bashisms-from-the-entry-directory-plugin.patch b/debian/patches/apertis/Remove-bashisms-from-the-entry-directory-plugin.patch
deleted file mode 100644
index 00c46583..00000000
--- a/debian/patches/apertis/Remove-bashisms-from-the-entry-directory-plugin.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From 2b89d2fe0193b36fa892ccc368e81efa8e854bb9 Mon Sep 17 00:00:00 2001
-From: Denis Pynkin <denis.pynkin@collabora.com>
-Date: Mon, 26 Apr 2021 23:00:48 +0300
-Subject: Remove bashisms from the entry directory plugin
-
-- Use [ not [[ and -z to test for non-emptiness
-
-Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
----
- src/kernel-install/00-entry-directory.install | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/src/kernel-install/00-entry-directory.install b/src/kernel-install/00-entry-directory.install
-index 21c09fa..e2fc396 100644
---- a/src/kernel-install/00-entry-directory.install
-+++ b/src/kernel-install/00-entry-directory.install
-@@ -1,4 +1,4 @@
--#!/usr/bin/env bash
-+#/bin/sh
- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
- # ex: ts=8 sw=4 sts=4 et filetype=sh
- 
-@@ -8,11 +8,11 @@ ENTRY_DIR_ABS="$3"
- KERNEL_IMAGE="$4"
- INITRD_OPTIONS_START="5"
- 
--if ! [[ $KERNEL_INSTALL_MACHINE_ID ]]; then
-+if [ -z "$KERNEL_INSTALL_MACHINE_ID" ]; then
-     exit 0
- fi
- 
--if [[ $COMMAND != add ]]; then
-+if [ "$COMMAND" != "add" ]; then
-      exit 0
- fi
- 
--- 
-2.20.1
-
diff --git a/debian/patches/apertis/Reworked-kernel-install-script.patch b/debian/patches/apertis/Reworked-kernel-install-script.patch
deleted file mode 100644
index 54f8e34b..00000000
--- a/debian/patches/apertis/Reworked-kernel-install-script.patch
+++ /dev/null
@@ -1,226 +0,0 @@
-From 2b3c1bccc61217f9800fa6b6f7af1007dd6c27e3 Mon Sep 17 00:00:00 2001
-From: Denis Pynkin <denis.pynkin@collabora.com>
-Date: Mon, 3 May 2021 03:12:29 +0300
-Subject: 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>
-Signed-off-by: Frederic Dalleau <frederic.dalleau@collabora.com>
----
- src/kernel-install/kernel-install | 100 +++++++++++++++++-------------
- 1 file changed, 56 insertions(+), 44 deletions(-)
-
-diff --git a/src/kernel-install/kernel-install b/src/kernel-install/kernel-install
-index e7457e9..6729168 100755
---- a/src/kernel-install/kernel-install
-+++ b/src/kernel-install/kernel-install
-@@ -1,4 +1,4 @@
--#!/usr/bin/env 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-or-later
-@@ -33,22 +33,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
-@@ -59,51 +55,64 @@ dropindirs_sort()
- export LC_COLLATE=C
- 
- for i in "$@"; do
--    if [ "$i" == "--help" -o "$i" == "-h" ]; then
-+    if [ "$i" = "--help" -o "$i" = "-h" ]; then
-         usage
-         exit 0
-     fi
- done
- 
- KERNEL_INSTALL_VERBOSE=0
--if [ "$1" == "--verbose" -o "$1" == "-v" ]; then
-+if [ "$1" = "--verbose" -o "$1" = "-v" ]; then
-     shift
-     KERNEL_INSTALL_VERBOSE=1
- fi
- export KERNEL_INSTALL_VERBOSE
- 
--if [[ "${0##*/}" == 'installkernel' ]]; then
-+INITRD_OPTIONS=""
-+if [ "${0%installkernel}" != "${0}" ]; then
-     COMMAND='add'
-     # make install doesn't pass any parameter wrt initrd handling
--    INITRD_OPTIONS=()
-+    KERNEL_VERSION="$1"
-+    KERNEL_IMAGE="$2"
-+elif [ "${0%removekernel}" != "${0}" ]; then
-+    COMMAND='remove'
-+    KERNEL_VERSION="$1"
-+    KERNEL_IMAGE="$2"
- else
-     COMMAND="$1"
-     shift
--    INITRD_OPTIONS=( "${@:3}" )
-+    KERNEL_VERSION="$1"
-+    KERNEL_IMAGE="$2"
-+    while [ $# -gt 2 ] ; do
-+        if [ -z "$INITRD_OPTIONS" ] ; then
-+            INITRD_OPTIONS="$3"
-+        else
-+            INITRD_OPTIONS="$INITRD_OPTIONS\n$3"
-+        fi
-+        shift
-+    done
- fi
- 
--KERNEL_VERSION="$1"
--KERNEL_IMAGE="$2"
- 
- # Reuse directory created without a machine ID present if it exists.
--if [[ -d /efi/Default ]] || [[ -d /boot/Default ]] || [[ -d /boot/efi/Default ]]; then
-+if [ -d /efi/Default ] || [ -d /boot/Default ] || [ -d /boot/efi/Default ]; then
-     MACHINE_ID="Default"
--elif [[ -f /etc/machine-id ]]; then
-+elif [ -f /etc/machine-id ]; then
-     read MACHINE_ID < /etc/machine-id
- else
-     MACHINE_ID="Default"
- fi
- 
--if [[ ! $COMMAND ]] || [[ ! $KERNEL_VERSION ]]; then
-+if [ -z "$COMMAND" ] || [ -z "$KERNEL_VERSION" ]; then
-     echo "Not enough arguments" >&2
-     exit 1
- fi
- 
--if [[ -d /efi/loader/entries ]] || [[ -d /efi/$MACHINE_ID ]]; then
-+if [ -d /efi/loader/entries ] || [ -d /efi/$MACHINE_ID ]; then
-     ENTRY_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
-     ENTRY_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
-     ENTRY_DIR_ABS="/boot/efi/$MACHINE_ID/$KERNEL_VERSION"
- elif mountpoint -q /efi; then
-     ENTRY_DIR_ABS="/efi/$MACHINE_ID/$KERNEL_VERSION"
-@@ -117,51 +126,53 @@ 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
--            echo "Command 'add' requires an argument" >&2
--            exit 1
-+        # According to man page 2-nd parameter could be skipped
-+        if [ -z "$KERNEL_IMAGE" ]; then
-+            KERNEL_IMAGE="/boot/vmlinuz-$KERNEL_VERSION"
-         fi
- 
--        if [[ ! -f "$KERNEL_IMAGE" ]]; then
-+        if [ ! -f "$KERNEL_IMAGE" ]; then
-             echo "Kernel image argument ${KERNEL_IMAGE} not a file" >&2
-             exit 1
-         fi
- 
--        for f in "${PLUGINS[@]}"; do
--            if [[ -x $f ]]; then
-+        plugins_list | while read f; do
-+            if [ -x "$f" ]; then
-+
-                 [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \
--                    echo "+$f add $KERNEL_VERSION $ENTRY_DIR_ABS $KERNEL_IMAGE ${INITRD_OPTIONS[@]}"
--                "$f" add "$KERNEL_VERSION" "$ENTRY_DIR_ABS" "$KERNEL_IMAGE" "${INITRD_OPTIONS[@]}"
-+                    echo "+$f add $KERNEL_VERSION $ENTRY_DIR_ABS $KERNEL_IMAGE ${INITRD_OPTIONS}"
-+                "$f" add "$KERNEL_VERSION" "$ENTRY_DIR_ABS" "$KERNEL_IMAGE" "${INITRD_OPTIONS}"
-                 x=$?
--                if [[ $x == $SKIP_REMAINING ]]; then
-+                if [ $x = $SKIP_REMAINING ]; then
-                     ret=0
-                     break
-                 fi
--                ((ret+=$x))
-+                ret=`expr $ret + $?`
-             fi
-         done
-         ;;
- 
-     remove)
--        for f in "${PLUGINS[@]}"; do
--            if [[ -x $f ]]; then
-+        plugins_list | while read f; do
-+            if [ -x "$f" ]; then
-                 [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \
-                     echo "+$f remove $KERNEL_VERSION $ENTRY_DIR_ABS"
-                 "$f" remove "$KERNEL_VERSION" "$ENTRY_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
- 
-@@ -169,7 +180,7 @@ case $COMMAND in
-             echo "Removing $ENTRY_DIR_ABS"
- 
-         rm -rf "$ENTRY_DIR_ABS"
--        ((ret+=$?))
-+        ret=`expr $ret + $?`
-         ;;
- 
-     *)
-@@ -179,3 +190,4 @@ case $COMMAND in
- esac
- 
- exit $ret
-+
--- 
-2.29.3
-
diff --git a/debian/patches/apertis/basic-linux-Sync-if_arp.h-with-Linux-5.14.patch b/debian/patches/apertis/basic-linux-Sync-if_arp.h-with-Linux-5.14.patch
deleted file mode 100644
index 5a8d9810..00000000
--- a/debian/patches/apertis/basic-linux-Sync-if_arp.h-with-Linux-5.14.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-From: Chris Packham <chris.packham@alliedtelesis.co.nz>
-Date: Fri, 10 Sep 2021 09:51:36 +1200
-Subject: basic/linux: Sync if_arp.h with Linux 5.14
-
-ARPHRD_MCTP was added in 5.14. Sync if_arp.h to pick up the definition
-
-Fixes #20694
----
- src/basic/linux/if_arp.h | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/src/basic/linux/if_arp.h b/src/basic/linux/if_arp.h
-index c3cc5a9..4783af9 100644
---- a/src/basic/linux/if_arp.h
-+++ b/src/basic/linux/if_arp.h
-@@ -54,6 +54,7 @@
- #define ARPHRD_X25	271		/* CCITT X.25			*/
- #define ARPHRD_HWX25	272		/* Boards with X.25 in firmware	*/
- #define ARPHRD_CAN	280		/* Controller Area Network      */
-+#define ARPHRD_MCTP	290
- #define ARPHRD_PPP	512
- #define ARPHRD_CISCO	513		/* Cisco HDLC	 		*/
- #define ARPHRD_HDLC	ARPHRD_CISCO
diff --git a/debian/patches/apertis/kernel-install-allow-to-create-BOOT-MACHINE_ID.patch b/debian/patches/apertis/kernel-install-allow-to-create-BOOT-MACHINE_ID.patch
deleted file mode 100644
index ad44b338..00000000
--- a/debian/patches/apertis/kernel-install-allow-to-create-BOOT-MACHINE_ID.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From f462882b9f851adb9bd0a420f2b3e5912bbfb712 Mon Sep 17 00:00:00 2001
-From: Denis Pynkin <denis.pynkin@collabora.com>
-Date: Sun, 2 May 2021 21:47:16 +0300
-Subject: kernel-install: allow to create $BOOT/$MACHINE_ID
-
-Commit cf73f650890 provides script `00-entry-directory.install` which
-creates the entry directory only if `$BOOT/$MACHINE_ID` folder exists.
-This part was moved out of `kernel-install` script and may introduce
-the problem during upgrade since before Apertis v2022dev2 we do kernel
-install with `$MACHINE_ID` generated in a build time. Later we remove
-`/etc/machine-id` file allowing to generate an unique machine ID during
-first boot, so there will be no directory `$BOOT/$MACHINE_ID` with a new
-ID preventing from new entry generation during kernel upgrade in runtime.
-Hence remove the part checking the `$BOOT/$MACHINE_ID` existence and
-allow to create the proper entry in any case, returning the previous
-`kernel-install` behaviour.
-
-Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
----
- src/kernel-install/00-entry-directory.install | 8 --------
- 1 file changed, 8 deletions(-)
-
-diff --git a/src/kernel-install/00-entry-directory.install b/src/kernel-install/00-entry-directory.install
-index e2fc396..f753794 100644
---- a/src/kernel-install/00-entry-directory.install
-+++ b/src/kernel-install/00-entry-directory.install
-@@ -16,14 +16,6 @@ if [ "$COMMAND" != "add" ]; then
-      exit 0
- fi
- 
--# If the boot dir exists (e.g. $ESP/<machine-id>),
--# create the entry directory ($ESP/<machine-id>/<kernel-version>).
--# This is the only function of this plugin.
--MACHINE_ID_DIR="${ENTRY_DIR_ABS%/*}"
--if ! [ -d "$MACHINE_ID_DIR" ]; then
--    exit 0
--fi
--
- if [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ]; then
-     echo "+mkdir -v -p $ENTRY_DIR_ABS"
-     exec mkdir -v -p "$ENTRY_DIR_ABS"
--- 
-2.29.3
-
diff --git a/debian/patches/apertis/meson-do-not-fail-if-rsync-is-not-installed-with-meson-0.57.2.patch b/debian/patches/apertis/meson-do-not-fail-if-rsync-is-not-installed-with-meson-0.57.2.patch
deleted file mode 100644
index f05e33c0..00000000
--- a/debian/patches/apertis/meson-do-not-fail-if-rsync-is-not-installed-with-meson-0.57.2.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 7c5fd25119a495009ea62f79e5daec34cc464628 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
-Date: Mon, 12 Apr 2021 14:03:32 +0200
-Subject: [PATCH] meson: do not fail if rsync is not installed with meson
- 0.57.2
-
-https://github.com/mesonbuild/meson/issues/8641
-
-Our CI started to fail. Even if the change is reverted in meson,
-we need a quick workaround here.
----
- man/meson.build | 25 ++++++++++++++-----------
- 1 file changed, 14 insertions(+), 11 deletions(-)
-
-diff --git a/man/meson.build b/man/meson.build
-index 3cae8446cd..f9c4b83dc8 100644
---- a/man/meson.build
-+++ b/man/meson.build
-@@ -184,17 +184,20 @@ html = custom_target(
-         depends : html_pages,
-         command : ['echo'])
- 
--run_target(
--        'doc-sync',
--        depends : man_pages + html_pages,
--        command : ['rsync', '-rlv',
--                   '--delete-excluded',
--                   '--include=man',
--                   '--include=*.html',
--                   '--exclude=*',
--                   '--omit-dir-times',
--                   meson.current_build_dir(),
--                   get_option('www-target')])
-+rsync = find_program('rsync', required : false)
-+if rsync.found()
-+        run_target(
-+                'doc-sync',
-+                depends : man_pages + html_pages,
-+                command : [rsync, '-rlv',
-+                           '--delete-excluded',
-+                           '--include=man',
-+                           '--include=*.html',
-+                           '--exclude=*',
-+                           '--omit-dir-times',
-+                           meson.current_build_dir(),
-+                           get_option('www-target')])
-+endif
- 
- ############################################################
- 
--- 
-2.30.2
-
diff --git a/debian/patches/apertis/meson.build-change-operator-combining-bools-from-to-and.patch b/debian/patches/apertis/meson.build-change-operator-combining-bools-from-to-and.patch
deleted file mode 100644
index 5a3fb986..00000000
--- a/debian/patches/apertis/meson.build-change-operator-combining-bools-from-to-and.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From c29537f39e4f413a6cbfe9669fa121bdd6d8b36f Mon Sep 17 00:00:00 2001
-From: Dan Streetman <ddstreet@canonical.com>
-Date: Fri, 3 Sep 2021 12:43:33 -0400
-Subject: [PATCH] meson.build: change operator combining bools from + to and
-
-upstream meson stopped allowing combining boolean with the plus
-operator, and now requires using the logical and operator
-
-reference:
-https://github.com/mesonbuild/meson/commit/43302d3296baff6aeaf8e03f5d701b0402e37a6c
-
-Fixes: #20632
----
- meson.build | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/meson.build b/meson.build
-index 6e1a8b1e50..0fe996adba 100644
---- a/meson.build
-+++ b/meson.build
-@@ -35,7 +35,7 @@ conf.set10('BUILD_MODE_DEVELOPER', get_option('mode') == 'developer',
- 
- want_ossfuzz = get_option('oss-fuzz')
- want_libfuzzer = get_option('llvm-fuzz')
--if want_ossfuzz + want_libfuzzer > 1
-+if want_ossfuzz and want_libfuzzer
-         error('only one of oss-fuzz or llvm-fuzz can be specified')
- endif
- 
--- 
-2.30.2
-
diff --git a/debian/patches/apertis/systemd-journal-flush-Add-a-requirement-on-var.mount.patch b/debian/patches/apertis/systemd-journal-flush-Add-a-requirement-on-var.mount.patch
deleted file mode 100644
index 39c60127..00000000
--- a/debian/patches/apertis/systemd-journal-flush-Add-a-requirement-on-var.mount.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From: Detlev Casanova <detlev.casanova@collabora.com>
-Date: Wed, 26 Jan 2022 15:30:42 -0500
-Subject: systemd-journal-flush: Add a requirement on var.mount.
-
-On some systems (like ostree), /var is already mounted (bind) when systemd
-starts and is not in /etc/fstab, so there is no var.mount file (fragment)
-generated by systemd-fstab-generator
-
-var.mount unit still exists: it instantiated via /proc/self/mountinfo
-
-RequiresMountsFor= does not add Requires= dependencies for .mount units if
-there is no corresponding fragment file (it still adds them After=, though -
-see unit_add_mount_dependencies() in unit.c)
-=> systemd-journal-flush.service will have After=var.mount but no
-   Requires=var.mount.
-=> On shutdown, nothing causes systemd-journal-flush.service to be stopped as
-   it does not require var.mount.
-
-See https://github.com/systemd/systemd/issues/867#issuecomment-890768048
-for details
-
-This patch adds the Require= for var.mount. It fixes the unmounting of
-/var at shutdown and doesn't influence systems that let systemd mount
-/var.
-
-Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>
----
- units/systemd-journal-flush.service | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/units/systemd-journal-flush.service b/units/systemd-journal-flush.service
-index 1a71592..e258866 100644
---- a/units/systemd-journal-flush.service
-+++ b/units/systemd-journal-flush.service
-@@ -11,7 +11,7 @@
- Description=Flush Journal to Persistent Storage
- Documentation=man:systemd-journald.service(8) man:journald.conf(5)
- DefaultDependencies=no
--Requires=systemd-journald.service
-+Requires=systemd-journald.service var.mount
- After=systemd-journald.service systemd-remount-fs.service
- Before=systemd-tmpfiles-setup.service
- RequiresMountsFor=/var/log/journal
diff --git a/debian/patches/series b/debian/patches/series
index 3e98fe1e..c0372943 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -19,13 +19,3 @@ debian/systemctl-do-not-shutdown-immediately-on-scheduled-shutdo.patch
 debian/Downgrade-a-couple-of-warnings-to-debug.patch
 debian/Skip-flaky-test_resolved_domain_restricted_dns-in-network.patch
 apertis/Add-usr-to-non-unmountable-list.patch
-apertis/Remove-bashisms-from-the-depmod-wrapper.patch
-apertis/Remove-bashisms-from-the-UEFI-entries-generator.patch
-apertis/Reworked-kernel-install-script.patch
-apertis/Remove-bashisms-from-the-entry-directory-plugin.patch
-apertis/kernel-install-allow-to-create-BOOT-MACHINE_ID.patch
-apertis/Fix-the-path-to-bootable-binaries-in-efi-entry.patch
-apertis/basic-linux-Sync-if_arp.h-with-Linux-5.14.patch
-apertis/systemd-journal-flush-Add-a-requirement-on-var.mount.patch
-apertis/meson.build-change-operator-combining-bools-from-to-and.patch
-apertis/meson-do-not-fail-if-rsync-is-not-installed-with-meson-0.57.2.patch
-- 
GitLab