#!/usr/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
#
# This file is part of systemd.
#
# 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 .
skip_remaining=77
set -e
usage()
{
echo "Usage:"
echo " kernel-install [OPTIONS...] add KERNEL-VERSION KERNEL-IMAGE [INITRD-FILE...]"
echo " kernel-install [OPTIONS...] remove KERNEL-VERSION"
echo " kernel-install [OPTIONS...] inspect"
echo "Options:"
echo " -h, --help Print this help and exit"
echo " --version Print version string and exit"
echo " -v, --verbose Increase verbosity"
}
dropindirs_sort()
{
suffix="$1"
shift
for d; do
for i in "$d/"*"$suffix"; do
[ -e "$i" ] && echo "${i##*/}"
done
done | sort -Vu | while read -r f; do
for d; do
if [ -e "$d/$f" ]; then
[ -x "$d/$f" ] && echo "$d/$f"
continue 2
fi
done
done
}
export LC_COLLATE=C
for i; do
if [ "$i" = "--help" ] || [ "$i" = "-h" ]; then
usage
exit 0
fi
done
for i; do
if [ "$i" = "--version" ]; then
echo "kernel-install 252 (252-18.el9)"
exit 0
fi
done
if [ "$KERNEL_INSTALL_BYPASS" = "1" ]; then
echo "kernel-install: Skipping execution because KERNEL_INSTALL_BYPASS=1"
exit 0
fi
export KERNEL_INSTALL_VERBOSE=0
if [ "$1" = "--verbose" ] || [ "$1" = "-v" ]; then
shift
export KERNEL_INSTALL_VERBOSE=1
log_verbose() { printf "%s\n" "$*"; }
else
log_verbose() { :; }
fi
if [ "${0##*/}" = "installkernel" ]; then
COMMAND=add
# kernel's install.sh invokes us as
# /sbin/installkernel