]>
git.proxmox.com Git - systemd.git/blob - src/kernel-install/kernel-install
2 # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
3 # ex: ts=8 sw=4 sts=4 et filetype=sh
5 # This file is part of systemd.
7 # Copyright 2013 Harald Hoyer
9 # systemd is free software; you can redistribute it and/or modify it
10 # under the terms of the GNU Lesser General Public License as published by
11 # the Free Software Foundation; either version 2.1 of the License, or
12 # (at your option) any later version.
14 # systemd is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # General Public License for more details.
19 # You should have received a copy of the GNU Lesser General Public License
20 # along with systemd; If not, see <http://www.gnu.org/licenses/>.
25 echo " $0 add <kernel-version> <kernel-image>" >&2
26 echo " $0 remove <kernel-version> <kernel-image>" >&2
31 local suffix
=$1; shift
35 readarray
-t files
< <(
37 for i
in "$d/"*"$suffix"; do
38 if [[ -e "$i" ]]; then
45 for f
in "${files[@]}"; do
47 if [[ -e "$d/$f" ]]; then
57 if [[ "${0##*/}" == 'installkernel' ]]; then
67 if [[ -f /etc
/machine-id
]]; then
68 read MACHINE_ID
< /etc
/machine-id
71 if ! [[ $MACHINE_ID ]]; then
72 echo "Could not determine your machine ID from /etc/machine-id." >&2
73 echo "Please run 'systemd-machine-id-setup' as root. See man:machine-id(5)" >&2
77 if [[ ! $COMMAND ]] ||
[[ ! $KERNEL_VERSION ]]; then
82 BOOT_DIR_ABS
="/boot/$MACHINE_ID/$KERNEL_VERSION"
85 readarray
-t PLUGINS
< <(
86 dropindirs_sort
".install" \
87 "/etc/kernel/install.d" \
88 "/usr/lib/kernel/install.d"
93 if [[ ! $KERNEL_IMAGE ]]; then
98 mkdir
-p "$BOOT_DIR_ABS" ||
{
99 echo "Could not create boot directory '$BOOT_DIR_ABS'." >&2
103 for f
in "${PLUGINS[@]}"; do
105 "$f" add
"$KERNEL_VERSION" "$BOOT_DIR_ABS" "$KERNEL_IMAGE"
112 for f
in "${PLUGINS[@]}"; do
114 "$f" remove
"$KERNEL_VERSION" "$BOOT_DIR_ABS"
119 rm -rf "$BOOT_DIR_ABS"