On Sat, Apr 12, 2014 at 08:40:27PM +0200, Julian Andres Klode wrote: > On Sat, Apr 12, 2014 at 06:45:45PM +0200, Julian Andres Klode wrote: > > Package: systemd > > Severity: wishlist > > > > systemd ships kernel-install which can be used to install kernels > > for boot loaders conforming to the boot loader spec, such as gummiboot, > > barebox, and potentially others I am not aware of. > > > > This is implemented in: > > http://anonscm.debian.org/gitweb/?p=users/jak/systemd.git;a=summary > > > > git://anonscm.debian.org/git/users/jak/systemd.git > > > > Notably, I cherry-picked the upstream commits for src/kernel-install, > > and then changed all paths from /boot to /boot/efi, and added a > > kernel-install package. Finally, I enabled EFI support.
Rebased against systemd 208-5. Also attached the current patch set. Please consider merging them. Thank you. It breaks gummiboot (<< 45), as the next upload of gummiboot will add compatibility for kernel-install (disable its own kernel installation script if kernel-install is present). -- Julian Andres Klode - Debian Developer, Ubuntu Member See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/. Be friendly, do not top-post, and follow RFC 1855 "Netiquette". - If you don't I might ignore you.
>From 0a3ac155684ed7c90b8a97569c232e630e250304 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode <j...@debian.org> Date: Fri, 4 Jul 2014 17:07:47 +0200 Subject: [PATCH 1/3] Use /boot/efi instead of /boot where needed This is needed because d-i mounts the ESP to /boot/efi and because we install our kernels to /boot, so it cannot be shared between multiple installations. --- .../Use-boot-efi-instead-of-boot-everywhere.patch | 246 +++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 247 insertions(+) create mode 100644 debian/patches/Use-boot-efi-instead-of-boot-everywhere.patch diff --git a/debian/patches/Use-boot-efi-instead-of-boot-everywhere.patch b/debian/patches/Use-boot-efi-instead-of-boot-everywhere.patch new file mode 100644 index 0000000..e282db1 --- /dev/null +++ b/debian/patches/Use-boot-efi-instead-of-boot-everywhere.patch @@ -0,0 +1,246 @@ +From: Julian Andres Klode <j...@debian.org> +Date: Sat, 12 Apr 2014 17:44:33 +0200 +Subject: Use /boot/efi instead of /boot everywhere + +We install our kernels directly to /boot, so we need a different +location. d-i configures /boot/efi for EFI systems, so let's use +that (even for non-EFI ones). +--- + man/kernel-install.xml | 18 +++++++++--------- + man/systemd.directives.xml | 6 +++--- + shell-completion/bash/kernel-install | 4 ++-- + shell-completion/zsh/_kernel-install | 2 +- + src/boot/boot-loader.c | 4 ++-- + src/efi-boot-generator/efi-boot-generator.c | 14 +++++++------- + src/kernel-install/90-loaderentry.install | 2 +- + src/kernel-install/kernel-install | 2 +- + 8 files changed, 26 insertions(+), 26 deletions(-) + +diff --git a/man/kernel-install.xml b/man/kernel-install.xml +index 929ceef..a18279f 100644 +--- a/man/kernel-install.xml ++++ b/man/kernel-install.xml +@@ -44,7 +44,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. + + <refnamediv> + <refname>kernel-install</refname> +- <refpurpose>Add and remove kernel and initramfs images to and from /boot</refpurpose> ++ <refpurpose>Add and remove kernel and initramfs images to and from /boot/efi</refpurpose> + </refnamediv> + + <refsynopsisdiv> +@@ -60,7 +60,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. + <title>Description</title> + <para> + <command>kernel-install</command> is used to install and remove kernel and +- initramfs images to and from <filename>/boot</filename>. ++ initramfs images to and from <filename>/boot/efi</filename>. + </para> + + <para><command>kernel-install</command> will execute the files +@@ -85,13 +85,13 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. + <term><command>add <replaceable>KERNEL-VERSION</replaceable> <replaceable>KERNEL-IMAGE</replaceable></command></term> + <listitem> + <para><command>kernel-install</command> creates the directory +- <filename>/boot/<replaceable>MACHINE-ID</replaceable>/<replaceable>KERNEL-VERSION</replaceable>/</filename> ++ <filename>/boot/efi/<replaceable>MACHINE-ID</replaceable>/<replaceable>KERNEL-VERSION</replaceable>/</filename> + and calls every executable + <filename>/usr/lib/kernel/install.d/*.install</filename> and + <filename>/etc/kernel/install.d/*.install</filename> with + the arguments + <programlisting> +-add <replaceable>KERNEL-VERSION</replaceable> <filename>/boot/<replaceable>MACHINE-ID</replaceable>/<replaceable>KERNEL-VERSION</replaceable>/</filename> ++add <replaceable>KERNEL-VERSION</replaceable> <filename>/boot/efi/<replaceable>MACHINE-ID</replaceable>/<replaceable>KERNEL-VERSION</replaceable>/</filename> + </programlisting> + </para> + +@@ -99,9 +99,9 @@ add <replaceable>KERNEL-VERSION</replaceable> <filename>/boot/<replaceable>MACHI + + <para>The kernel-install plugin <filename>90-loaderentry.install</filename> copies + <replaceable>KERNEL-IMAGE</replaceable> to +- <filename>/boot/<replaceable>MACHINE-ID</replaceable>/<replaceable>KERNEL-VERSION</replaceable>/linux</filename>. ++ <filename>/boot/efi/<replaceable>MACHINE-ID</replaceable>/<replaceable>KERNEL-VERSION</replaceable>/linux</filename>. + It also creates a boot loader entry according to the boot loader specification in +- <filename>/boot/loader/entries/<replaceable>MACHINE-ID</replaceable>-<replaceable>KERNEL-VERSION</replaceable>.conf</filename>. ++ <filename>/boot/efi/loader/entries/<replaceable>MACHINE-ID</replaceable>-<replaceable>KERNEL-VERSION</replaceable>.conf</filename>. + The title of the entry is the <replaceable>PRETTY_NAME</replaceable> parameter specified in <filename>/etc/os-release</filename>, + or "Linux <replaceable>KERNEL-VERSION</replaceable>", if unset. + If the file <filename>initrd</filename> is found next to the +@@ -115,15 +115,15 @@ add <replaceable>KERNEL-VERSION</replaceable> <filename>/boot/<replaceable>MACHI + <para>Calls every executable <filename>/usr/lib/kernel/install.d/*.install</filename> + and <filename>/etc/kernel/install.d/*.install</filename> with the arguments + <programlisting> +-remove <replaceable>KERNEL-VERSION</replaceable> <filename>/boot/<replaceable>MACHINE-ID</replaceable>/<replaceable>KERNEL-VERSION</replaceable>/</filename> ++remove <replaceable>KERNEL-VERSION</replaceable> <filename>/boot/efi/<replaceable>MACHINE-ID</replaceable>/<replaceable>KERNEL-VERSION</replaceable>/</filename> + </programlisting> + </para> + + <para><command>kernel-install</command> removes the entire directory +- <filename>/boot/<replaceable>MACHINE-ID</replaceable>/<replaceable>KERNEL-VERSION</replaceable>/</filename> afterwards.</para> ++ <filename>/boot/efi/<replaceable>MACHINE-ID</replaceable>/<replaceable>KERNEL-VERSION</replaceable>/</filename> afterwards.</para> + + <para>The kernel-install plugin <filename>90-loaderentry.install</filename> removes the file +- <filename>/boot/loader/entries/<replaceable>MACHINE-ID</replaceable>-<replaceable>KERNEL-VERSION</replaceable>.conf</filename>.</para> ++ <filename>/boot/efi/loader/entries/<replaceable>MACHINE-ID</replaceable>-<replaceable>KERNEL-VERSION</replaceable>.conf</filename>.</para> + </listitem> + </varlistentry> + +diff --git a/man/systemd.directives.xml b/man/systemd.directives.xml +index 307cca1..f27fcf6 100644 +--- a/man/systemd.directives.xml ++++ b/man/systemd.directives.xml +@@ -1973,9 +1973,9 @@ + + <varlistentry><term><filename>/bin/sh</filename></term><listitem><para><citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry></para></listitem></varlistentry> + +-<varlistentry><term><filename>/boot</filename></term><listitem><para><citerefentry><refentrytitle>kernel-install</refentrytitle><manvolnum>8</manvolnum></citerefentry>, <citerefentry><refentrytitle>systemd-efi-boot-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry></para></listitem></varlistentry> ++<varlistentry><term><filename>/boot/efi</filename></term><listitem><para><citerefentry><refentrytitle>kernel-install</refentrytitle><manvolnum>8</manvolnum></citerefentry>, <citerefentry><refentrytitle>systemd-efi-boot-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry></para></listitem></varlistentry> + +-<varlistentry><term><filename>/boot/loader/entries/<replaceable>MACHINE-ID</replaceable>-<replaceable>KERNEL-VERSION</replaceable>.conf</filename></term><listitem><para><citerefentry><refentrytitle>kernel-install</refentrytitle><manvolnum>8</manvolnum></citerefentry></para></listitem></varlistentry> ++<varlistentry><term><filename>/boot/efi/loader/entries/<replaceable>MACHINE-ID</replaceable>-<replaceable>KERNEL-VERSION</replaceable>.conf</filename></term><listitem><para><citerefentry><refentrytitle>kernel-install</refentrytitle><manvolnum>8</manvolnum></citerefentry></para></listitem></varlistentry> + + <varlistentry><term><filename>/dev</filename></term><listitem><para><citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry>, <citerefentry><refentrytitle>systemd-remount-fs.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>, <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>, <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>, <citerefentry><refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum></citerefentry></para></listitem></varlistentry> + +@@ -2614,4 +2614,4 @@ + referring to 137 individual manual pages. + </para> + </refsect1> +-</refentry> +\ No newline at end of file ++</refentry> +diff --git a/shell-completion/bash/kernel-install b/shell-completion/bash/kernel-install +index 7cd2494..e269496 100644 +--- a/shell-completion/bash/kernel-install ++++ b/shell-completion/bash/kernel-install +@@ -31,8 +31,8 @@ _kernel_install() { + comps=$(cd /lib/modules; echo [0-9]*) + if [[ ${COMP_WORDS[1]} == "remove" ]] && [[ -f /etc/machine-id ]]; then + read MACHINE_ID < /etc/machine-id +- if [[ $MACHINE_ID ]] && ( [[ -d /boot/$MACHINE_ID ]] || [[ -L /boot/$MACHINE_ID ]] ); then +- comps=$(cd "/boot/$MACHINE_ID"; echo [0-9]*) ++ if [[ $MACHINE_ID ]] && ( [[ -d /boot/efi/$MACHINE_ID ]] || [[ -L /boot/efi/$MACHINE_ID ]] ); then ++ comps=$(cd "/boot/efi/$MACHINE_ID"; echo [0-9]*) + fi + fi + ;; +diff --git a/shell-completion/zsh/_kernel-install b/shell-completion/zsh/_kernel-install +index 0655188..a49bbde 100644 +--- a/shell-completion/zsh/_kernel-install ++++ b/shell-completion/zsh/_kernel-install +@@ -12,7 +12,7 @@ _kernels(){ + read _MACHINE_ID < /etc/machine-id + _kernel=( /lib/modules/[0-9]* ) + if [[ "$cmd" == "remove" && -n "$_MACHINE_ID" ]]; then +- _kernel=( /lib/modules/[0-9]* "/boot/$_MACHINE_ID"/[0-9]* ) ++ _kernel=( /lib/modules/[0-9]* "/boot/efi/$_MACHINE_ID"/[0-9]* ) + fi + _kernel=( ${_kernel##*/} ) + _describe "installed kernels" _kernel +diff --git a/src/boot/boot-loader.c b/src/boot/boot-loader.c +index d44fdb3..ff9dfed 100644 +--- a/src/boot/boot-loader.c ++++ b/src/boot/boot-loader.c +@@ -80,7 +80,7 @@ static char *loader_fragment_read_title(const char *fragment) { + + int boot_loader_read_entries(struct boot_info *info) { + _cleanup_strv_free_ char **files = NULL; +- static const char *loader_dir[] = { "/boot/loader/entries", NULL}; ++ static const char *loader_dir[] = { "/boot/efi/loader/entries", NULL}; + unsigned int count; + unsigned int i; + int err; +@@ -117,7 +117,7 @@ int boot_loader_find_active_entry(struct boot_info *info, const char *loader_act + if (info->loader_entries_count == 0) + return -ENOENT; + +- if (asprintf(&fn, "/boot/loader/entries/%s.conf", loader_active) < 0) ++ if (asprintf(&fn, "/boot/efi/loader/entries/%s.conf", loader_active) < 0) + return -ENOMEM; + + for (i = 0; i < info->loader_entries_count; i++) { +diff --git a/src/efi-boot-generator/efi-boot-generator.c b/src/efi-boot-generator/efi-boot-generator.c +index 05b95ed..293d4bc 100644 +--- a/src/efi-boot-generator/efi-boot-generator.c ++++ b/src/efi-boot-generator/efi-boot-generator.c +@@ -52,7 +52,7 @@ int main(int argc, char *argv[]) { + if (!is_efi_boot()) + return EXIT_SUCCESS; + +- if (dir_is_empty("/boot") <= 0) ++ if (dir_is_empty("/boot/efi") <= 0) + return EXIT_SUCCESS; + + r = efi_loader_get_device_part_uuid(&id); +@@ -63,7 +63,7 @@ int main(int argc, char *argv[]) { + return EXIT_FAILURE; + } + +- name = strjoin(arg_dest, "/boot.mount", NULL); ++ name = strjoin(arg_dest, "/boot-efi.mount", NULL); + if (!name) { + log_oom(); + return EXIT_FAILURE; +@@ -80,13 +80,13 @@ int main(int argc, char *argv[]) { + "[Unit]\n" + "Description=EFI System Partition\n\n" + "[Mount]\n" +- "Where=/boot\n" ++ "Where=/boot/efi\n" + "What=/dev/disk/by-partuuid/%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\n" + "Options=umask=0077\n", + SD_ID128_FORMAT_VAL(id)); + + free(name); +- name = strjoin(arg_dest, "/boot.automount", NULL); ++ name = strjoin(arg_dest, "/boot-efi.automount", NULL); + if (!name) { + log_oom(); + return EXIT_FAILURE; +@@ -103,10 +103,10 @@ int main(int argc, char *argv[]) { + "[Unit]\n" + "Description=EFI System Partition Automount\n\n" + "[Automount]\n" +- "Where=/boot\n", f); ++ "Where=/boot/efi\n", f); + + free(name); +- name = strjoin(arg_dest, "/local-fs.target.wants/boot.automount", NULL); ++ name = strjoin(arg_dest, "/local-fs.target.wants/boot-efi.automount", NULL); + if (!name) { + log_oom(); + return EXIT_FAILURE; +@@ -114,7 +114,7 @@ int main(int argc, char *argv[]) { + + mkdir_parents(name, 0755); + +- if (symlink("../boot.automount", name) < 0) { ++ if (symlink("../boot-efi.automount", name) < 0) { + log_error("Failed to create symlink %s: %m", name); + return EXIT_FAILURE; + } +diff --git a/src/kernel-install/90-loaderentry.install b/src/kernel-install/90-loaderentry.install +index a6a8abc..54a09bd 100644 +--- a/src/kernel-install/90-loaderentry.install ++++ b/src/kernel-install/90-loaderentry.install +@@ -16,7 +16,7 @@ if ! [[ $MACHINE_ID ]]; then + fi + + BOOT_DIR="/$MACHINE_ID/$KERNEL_VERSION" +-LOADER_ENTRY="/boot/loader/entries/$MACHINE_ID-$KERNEL_VERSION.conf" ++LOADER_ENTRY="/boot/efi/loader/entries/$MACHINE_ID-$KERNEL_VERSION.conf" + + if [[ $COMMAND == remove ]]; then + exec rm -f "$LOADER_ENTRY" +diff --git a/src/kernel-install/kernel-install b/src/kernel-install/kernel-install +index 9d3e75d..14ebea3 100644 +--- a/src/kernel-install/kernel-install ++++ b/src/kernel-install/kernel-install +@@ -79,7 +79,7 @@ if [[ ! $COMMAND ]] || [[ ! $KERNEL_VERSION ]]; then + exit 1 + fi + +-BOOT_DIR_ABS="/boot/$MACHINE_ID/$KERNEL_VERSION" ++BOOT_DIR_ABS="/boot/efi/$MACHINE_ID/$KERNEL_VERSION" + ret=0 + + readarray -t PLUGINS < <( diff --git a/debian/patches/series b/debian/patches/series index 2d51cec..bb03022 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -46,3 +46,4 @@ Add-run-initctl-support-to-SysV-compat-tools.patch login-make-sd_session_get_vt-actually-work.patch login-fix-invalid-free-in-sd_session_get_vt.patch core-transaction-fix-cycle-break-attempts-outside-tr.patch +Use-boot-efi-instead-of-boot-everywhere.patch -- 2.0.0
>From cf7254702c6078c6d0bf6ad18d6aadcb5b5a0e3c Mon Sep 17 00:00:00 2001 From: Julian Andres Klode <j...@debian.org> Date: Sat, 12 Apr 2014 17:57:06 +0200 Subject: [PATCH 2/3] Enable EFI support in systemd --- debian/rules | 1 - debian/systemd.install | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/rules b/debian/rules index 794a81a..1af9162 100755 --- a/debian/rules +++ b/debian/rules @@ -19,7 +19,6 @@ CONFFLAGS = \ --with-telinit=/lib/sysvinit/telinit \ --enable-tcpwrap \ --disable-coredump \ - --disable-efi \ --disable-myhostname \ --disable-vconsole \ --disable-silent-rules diff --git a/debian/systemd.install b/debian/systemd.install index a199a76..cc1f99d 100644 --- a/debian/systemd.install +++ b/debian/systemd.install @@ -26,6 +26,7 @@ usr/bin/systemd-run usr/bin/timedatectl usr/bin/localectl usr/bin/hostnamectl +usr/bin/bootctl usr/share/man/man1/ usr/share/man/man3/ usr/share/man/man5/ -- 2.0.0
>From 4616dcf9485a478f4eb976a5d4484025448c9a8e Mon Sep 17 00:00:00 2001 From: Julian Andres Klode <j...@debian.org> Date: Sat, 12 Apr 2014 17:14:18 +0200 Subject: [PATCH 3/3] Add a kernel-install package Note that the package pre-depends on systemd for proper setup of the machine-id file. --- debian/changelog | 6 +++ debian/control | 13 +++++ .../initramfs/post-update.d/zz-kernel-install | 59 ++++++++++++++++++++++ .../kernel/postinst.d/zz-kernel-install | 9 ++++ .../kernel/postrm.d/zz-kernel-install | 9 ++++ debian/kernel-install.install | 6 +++ debian/kernel-install.postinst | 20 ++++++++ debian/rules | 13 ++--- 8 files changed, 129 insertions(+), 6 deletions(-) create mode 100755 debian/kernel-install-hooks/initramfs/post-update.d/zz-kernel-install create mode 100755 debian/kernel-install-hooks/kernel/postinst.d/zz-kernel-install create mode 100755 debian/kernel-install-hooks/kernel/postrm.d/zz-kernel-install create mode 100644 debian/kernel-install.install create mode 100644 debian/kernel-install.postinst diff --git a/debian/changelog b/debian/changelog index 970f09b..8d48160 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +systemd (208-5jak1) UNRELEASED; urgency=medium + + * Add kernel-install and enable EFI support (Closes: #744301) + + -- Julian Andres Klode <j...@debian.org> Fri, 04 Jul 2014 16:20:13 +0200 + systemd (208-5) experimental; urgency=medium * Merge changes from unstable branch. diff --git a/debian/control b/debian/control index 63f639a..5e99571 100644 --- a/debian/control +++ b/debian/control @@ -97,6 +97,19 @@ Description: system and service manager - SysV links to replace sysvinit. Installing systemd-sysv will overwrite /sbin/init with a link to systemd. +Package: kernel-install +Architecture: all +Section: admin +Priority: optional +Pre-Depends: systemd +Enhances: gummiboot +Breaks: gummiboot (<< 0.45) +Description: kernel installation tool + Installs kernels into /boot/efi according to the freedesktop.org + bootloader specification. Despite the name of /boot/efi, this is useful + for non-EFI platforms too, if /boot/efi is a partition containing a + conforming boot loader. + Package: libpam-systemd Architecture: linux-any Multi-Arch: same diff --git a/debian/kernel-install-hooks/initramfs/post-update.d/zz-kernel-install b/debian/kernel-install-hooks/initramfs/post-update.d/zz-kernel-install new file mode 100755 index 0000000..a786415 --- /dev/null +++ b/debian/kernel-install-hooks/initramfs/post-update.d/zz-kernel-install @@ -0,0 +1,59 @@ +#!/bin/bash +# +# Copyright (C) 2014 Julian Andres Klode <j...@debian.org> +# +# Automatically install an updated initramfs to the boot loader spec directory. +# +# Based on kernel-install: +# Copyright 2013 Harald Hoyer +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. +# +# systemd is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with systemd; If not, see <http://www.gnu.org/licenses/>. + +usage() +{ + echo "Usage:" >&2 + echo " $0 <kernel-version>" >&2 +} + +export LC_COLLATE=C + +KERNEL_VERSION="$1" +INITRD_IMAGE="/boot/initrd.img-$KERNEL_VERSION" + +if [[ -f /etc/machine-id ]]; then + read MACHINE_ID < /etc/machine-id +fi + +if ! [[ $MACHINE_ID ]]; then + echo "Could not determine your machine ID from /etc/machine-id." >&2 + echo "Please run 'systemd-machine-id-setup' as root. See man:machine-id(5)" >&2 + exit 1 +fi + +if [[ ! $KERNEL_VERSION ]]; then + usage + exit 1 +fi + +BOOT_DIR_ABS="/boot/efi/$MACHINE_ID/$KERNEL_VERSION" + +mkdir -p "$BOOT_DIR_ABS" || { + echo "Could not create boot directory '$BOOT_DIR_ABS'." >&2 + exit 1 +} + +install -m 644 -o root -g root "$INITRD_IMAGE" "$BOOT_DIR_ABS/initrd" || { + echo "Could not copy '$INITRD_IMAGE to '$BOOT_DIR_ABS/initrd'." >&2 + exit 1 +} diff --git a/debian/kernel-install-hooks/kernel/postinst.d/zz-kernel-install b/debian/kernel-install-hooks/kernel/postinst.d/zz-kernel-install new file mode 100755 index 0000000..5705300 --- /dev/null +++ b/debian/kernel-install-hooks/kernel/postinst.d/zz-kernel-install @@ -0,0 +1,9 @@ +#!/bin/sh +# +# Copyright (C) 2014 Julian Andres Klode <j...@debian.org> +# + +KERNEL_VERSION="$1" +KERNEL_IMAGE="/boot/vmlinuz-$KERNEL_VERSION" + +exec kernel-install add "$KERNEL_VERSION" "$KERNEL_IMAGE" diff --git a/debian/kernel-install-hooks/kernel/postrm.d/zz-kernel-install b/debian/kernel-install-hooks/kernel/postrm.d/zz-kernel-install new file mode 100755 index 0000000..424f823 --- /dev/null +++ b/debian/kernel-install-hooks/kernel/postrm.d/zz-kernel-install @@ -0,0 +1,9 @@ +#!/bin/sh +# +# Copyright (C) 2014 Julian Andres Klode <j...@debian.org> +# + +KERNEL_VERSION="$1" +KERNEL_IMAGE="/boot/vmlinuz-$KERNEL_VERSION" + +exec kernel-install remove "$KERNEL_VERSION" "$KERNEL_IMAGE" diff --git a/debian/kernel-install.install b/debian/kernel-install.install new file mode 100644 index 0000000..ee719e1 --- /dev/null +++ b/debian/kernel-install.install @@ -0,0 +1,6 @@ +usr/share/man/man8/kernel-install.8 +usr/bin/kernel-install +usr/share/zsh/site-functions/_kernel-install +usr/share/bash-completion/completions/kernel-install +usr/lib/kernel +etc/kernel diff --git a/debian/kernel-install.postinst b/debian/kernel-install.postinst new file mode 100644 index 0000000..ac9be12 --- /dev/null +++ b/debian/kernel-install.postinst @@ -0,0 +1,20 @@ +#!/bin/sh +# postinst script for kernel-install + +set -e + +if [ "$1" = "configure" -a "$2" = "" ]; then + # Automatically install at existing kernels on first install + for kernel in /boot/vmlinuz-*; do + version=$(echo $kernel | cut -f2- -d-) + + if [ -e /boot/initrd.img-$version ]; then + /etc/initramfs/post-update.d/zz-kernel-install "$version" + fi + + kernel-install add "$version" "$kernel" + done +fi + + +#DEBHELPER# diff --git a/debian/rules b/debian/rules index 1af9162..30e943a 100755 --- a/debian/rules +++ b/debian/rules @@ -86,19 +86,17 @@ override_dh_install: rm -f debian/install/*/usr/share/doc/systemd/LICENSE.* rm -f debian/install/*/var/log/README rm -f debian/install/*/etc/init.d/README - rm -f debian/install/*/usr/share/man/man8/kernel-install.8 - rm -f debian/install/*/usr/bin/kernel-install - rm -f debian/install/*/usr/share/zsh/site-functions/_kernel-install - rm -f debian/install/*/usr/share/bash-completion/completions/kernel-install - rm -rf debian/install/*/usr/lib/kernel/install.d rm -rf debian/install/*/etc/rpm/ rm -rf debian/install/*/usr/lib/rpm/ - rm -rf debian/install/*/etc/kernel/ rm -f debian/install/*/usr/lib/sysctl.d/50-default.conf find debian/install/ -name '*.la' -delete dh_install -pudev-udeb -plibudev1-udeb --sourcedir=debian/install/udeb dh_install $(BOOTSTRAP_DH_FLAGS) -Nudev-udeb -Nlibudev1-udeb --sourcedir=debian/install/deb --fail-missing # install some files manually, --sourcedir makes that necessary + # kernel-install + mkdir -p debian/kernel-install/etc/ + cp -a debian/kernel-install-hooks/* debian/kernel-install/etc/ + chown -R root:root debian/kernel-install # udev-udeb install -D --mode=755 debian/extra/udev.startup \ debian/udev-udeb/lib/debian-installer/start-udev @@ -163,6 +161,9 @@ override_dh_install: rm debian/systemd/usr/share/man/man8/shutdown.8 rm debian/systemd/usr/share/man/man8/telinit.8 rm debian/systemd/usr/share/man/man8/runlevel.8 + # files shipped by kernel-install + rm -rf debian/install/systemd/etc/kernel/ + find debian/systemd -name "*kernel-install*" -delete # files shipped by libpam-systemd rm debian/systemd/usr/share/man/man8/pam_systemd.8 # files shipped by udev -- 2.0.0