mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
kernel-install: rename $BOOT_DIR[_ABS] to $ENTRY_DIR[_ABS]
"BOOT" is misleading, because it sounds like this refers to /boot or $BOOT, when in fact it refers to some subdirectory. Those variable names are purely interal, so we can change them. $BOOT_DIR_ABS was used in NEWS, but it should not be (because it is an internal detail), so the old NEWS entry is reworded to use "entry directory".
This commit is contained in:
parent
7054308a8d
commit
d271c5d345
12
NEWS
12
NEWS
@ -1957,12 +1957,14 @@ CHANGES WITH 234:
|
||||
systemd-logind to be safe. See
|
||||
https://cgit.freedesktop.org/xorg/xserver/commit/?id=dc48bd653c7e101.)
|
||||
|
||||
* All kernel install plugins are called with the environment variable
|
||||
* All kernel-install plugins are called with the environment variable
|
||||
KERNEL_INSTALL_MACHINE_ID which is set to the machine ID given by
|
||||
/etc/machine-id. If the file is missing or empty, the variable is
|
||||
empty and BOOT_DIR_ABS is the path of a temporary directory which is
|
||||
removed after all the plugins exit. So, if KERNEL_INSTALL_MACHINE_ID
|
||||
is empty, all plugins should not put anything in BOOT_DIR_ABS.
|
||||
/etc/machine-id. If the machine ID could not be determined,
|
||||
$KERNEL_INSTALL_MACHINE_ID will be empty. Plugins should not put
|
||||
anything in the entry directory (passed as the second argument) if
|
||||
$KERNEL_INSTALL_MACHINE_ID is empty. For backwards compatiblity, a
|
||||
temporary directory is passed as the entry directory and removed
|
||||
after all the plugins exit.
|
||||
|
||||
Contributions from: Adrian Heine né Lang, Aggelos Avgerinos, Alexander
|
||||
Kurtz, Alexandros Frantzis, Alexey Brodkin, Alex Lu, Amir Pakdel, Amir
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
COMMAND="$1"
|
||||
KERNEL_VERSION="$2"
|
||||
BOOT_DIR_ABS="$3"
|
||||
ENTRY_DIR_ABS="$3"
|
||||
KERNEL_IMAGE="$4"
|
||||
INITRD_OPTIONS_START="5"
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
COMMAND="$1"
|
||||
KERNEL_VERSION="$2"
|
||||
BOOT_DIR_ABS="$3"
|
||||
ENTRY_DIR_ABS="$3"
|
||||
KERNEL_IMAGE="$4"
|
||||
INITRD_OPTIONS_START="5"
|
||||
|
||||
@ -12,14 +12,14 @@ if ! [[ $KERNEL_INSTALL_MACHINE_ID ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if ! [[ -d "$BOOT_DIR_ABS" ]]; then
|
||||
if ! [[ -d "$ENTRY_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}
|
||||
ENTRY_DIR="/$MACHINE_ID/$KERNEL_VERSION"
|
||||
BOOT_ROOT=${ENTRY_DIR_ABS%$ENTRY_DIR}
|
||||
|
||||
if [[ $COMMAND == remove ]]; then
|
||||
rm -f "$BOOT_ROOT/loader/entries/$MACHINE_ID-$KERNEL_VERSION.conf"
|
||||
@ -76,10 +76,10 @@ else
|
||||
LOADER_ENTRY="$BOOT_ROOT/loader/entries/$MACHINE_ID-$KERNEL_VERSION.conf"
|
||||
fi
|
||||
|
||||
cp "$KERNEL_IMAGE" "$BOOT_DIR_ABS/linux" &&
|
||||
chown root:root "$BOOT_DIR_ABS/linux" &&
|
||||
chmod 0644 "$BOOT_DIR_ABS/linux" || {
|
||||
echo "Could not copy '$KERNEL_IMAGE to '$BOOT_DIR_ABS/linux'." >&2
|
||||
cp "$KERNEL_IMAGE" "$ENTRY_DIR_ABS/linux" &&
|
||||
chown root:root "$ENTRY_DIR_ABS/linux" &&
|
||||
chmod 0644 "$ENTRY_DIR_ABS/linux" || {
|
||||
echo "Could not copy '$KERNEL_IMAGE to '$ENTRY_DIR_ABS/linux'." >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
@ -89,11 +89,11 @@ for initrd in "${INITRD_OPTIONS[@]}"; do
|
||||
if [[ -f "${initrd}" ]]; then
|
||||
initrd_basename="$(basename ${initrd})"
|
||||
[ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \
|
||||
echo "Installing $BOOT_DIR_ABS/${initrd_basename}"
|
||||
cp "${initrd}" "$BOOT_DIR_ABS/${initrd_basename}" &&
|
||||
chown root:root "$BOOT_DIR_ABS/${initrd_basename}" &&
|
||||
chmod 0644 "$BOOT_DIR_ABS/${initrd_basename}" || {
|
||||
echo "Could not copy '${initrd}' to '$BOOT_DIR_ABS/${initrd_basename}'." >&2
|
||||
echo "Installing $ENTRY_DIR_ABS/${initrd_basename}"
|
||||
cp "${initrd}" "$ENTRY_DIR_ABS/${initrd_basename}" &&
|
||||
chown root:root "$ENTRY_DIR_ABS/${initrd_basename}" &&
|
||||
chmod 0644 "$ENTRY_DIR_ABS/${initrd_basename}" || {
|
||||
echo "Could not copy '${initrd}' to '$ENTRY_DIR_ABS/${initrd_basename}'." >&2
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
@ -115,10 +115,10 @@ mkdir -p "${LOADER_ENTRY%/*}" || {
|
||||
echo "version $KERNEL_VERSION"
|
||||
echo "machine-id $MACHINE_ID"
|
||||
echo "options ${BOOT_OPTIONS[*]}"
|
||||
echo "linux $BOOT_DIR/linux"
|
||||
echo "linux $ENTRY_DIR/linux"
|
||||
for initrd in "${INITRD_OPTIONS[@]}"; do
|
||||
[[ -f $BOOT_DIR_ABS/$(basename ${initrd}) ]] && \
|
||||
echo "initrd $BOOT_DIR/$(basename ${initrd})"
|
||||
[[ -f $ENTRY_DIR_ABS/$(basename ${initrd}) ]] && \
|
||||
echo "initrd $ENTRY_DIR/$(basename ${initrd})"
|
||||
done
|
||||
:
|
||||
} > "$LOADER_ENTRY" || {
|
||||
|
@ -92,20 +92,20 @@ if [[ ! $COMMAND ]] || [[ ! $KERNEL_VERSION ]]; then
|
||||
fi
|
||||
|
||||
if ! [[ $MACHINE_ID ]]; then
|
||||
BOOT_DIR_ABS=$(mktemp -d /tmp/kernel-install.XXXXX) || exit 1
|
||||
trap "rm -rf '$BOOT_DIR_ABS'" EXIT INT QUIT PIPE
|
||||
ENTRY_DIR_ABS=$(mktemp -d /tmp/kernel-install.XXXXX) || exit 1
|
||||
trap "rm -rf '$ENTRY_DIR_ABS'" EXIT INT QUIT PIPE
|
||||
elif [[ -d /efi/loader/entries ]] || [[ -d /efi/$MACHINE_ID ]]; then
|
||||
BOOT_DIR_ABS="/efi/$MACHINE_ID/$KERNEL_VERSION"
|
||||
ENTRY_DIR_ABS="/efi/$MACHINE_ID/$KERNEL_VERSION"
|
||||
elif [[ -d /boot/loader/entries ]] || [[ -d /boot/$MACHINE_ID ]]; then
|
||||
BOOT_DIR_ABS="/boot/$MACHINE_ID/$KERNEL_VERSION"
|
||||
ENTRY_DIR_ABS="/boot/$MACHINE_ID/$KERNEL_VERSION"
|
||||
elif [[ -d /boot/efi/loader/entries ]] || [[ -d /boot/efi/$MACHINE_ID ]]; then
|
||||
BOOT_DIR_ABS="/boot/efi/$MACHINE_ID/$KERNEL_VERSION"
|
||||
ENTRY_DIR_ABS="/boot/efi/$MACHINE_ID/$KERNEL_VERSION"
|
||||
elif mountpoint -q /efi; then
|
||||
BOOT_DIR_ABS="/efi/$MACHINE_ID/$KERNEL_VERSION"
|
||||
ENTRY_DIR_ABS="/efi/$MACHINE_ID/$KERNEL_VERSION"
|
||||
elif mountpoint -q /boot/efi; then
|
||||
BOOT_DIR_ABS="/boot/efi/$MACHINE_ID/$KERNEL_VERSION"
|
||||
ENTRY_DIR_ABS="/boot/efi/$MACHINE_ID/$KERNEL_VERSION"
|
||||
else
|
||||
BOOT_DIR_ABS="/boot/$MACHINE_ID/$KERNEL_VERSION"
|
||||
ENTRY_DIR_ABS="/boot/$MACHINE_ID/$KERNEL_VERSION"
|
||||
fi
|
||||
|
||||
export KERNEL_INSTALL_MACHINE_ID=$MACHINE_ID
|
||||
@ -125,16 +125,16 @@ case $COMMAND in
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$BOOT_DIR_ABS" || {
|
||||
echo "Could not create boot directory '$BOOT_DIR_ABS'." >&2
|
||||
mkdir -p "$ENTRY_DIR_ABS" || {
|
||||
echo "Could not create boot directory '$ENTRY_DIR_ABS'." >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
for f in "${PLUGINS[@]}"; do
|
||||
if [[ -x $f ]]; then
|
||||
[ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \
|
||||
echo "+$f add $KERNEL_VERSION $BOOT_DIR_ABS $KERNEL_IMAGE ${INITRD_OPTIONS[@]}"
|
||||
"$f" add "$KERNEL_VERSION" "$BOOT_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
|
||||
ret=0
|
||||
@ -144,11 +144,11 @@ case $COMMAND in
|
||||
fi
|
||||
done
|
||||
|
||||
if ! [[ $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
|
||||
if ! [[ $MACHINE_ID ]] && ! rmdir "$ENTRY_DIR_ABS"; then
|
||||
echo "Warning: In kernel-install plugins, requiring ENTRY_DIR_ABS to be preset is deprecated." >&2
|
||||
echo " All plugins should not put anything in ENTRY_DIR_ABS if the environment" >&2
|
||||
echo " variable KERNEL_INSTALL_MACHINE_ID is empty." >&2
|
||||
rm -rf "$BOOT_DIR_ABS"
|
||||
rm -rf "$ENTRY_DIR_ABS"
|
||||
((ret+=$?))
|
||||
fi
|
||||
;;
|
||||
@ -157,8 +157,8 @@ case $COMMAND in
|
||||
for f in "${PLUGINS[@]}"; do
|
||||
if [[ -x $f ]]; then
|
||||
[ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \
|
||||
echo "+$f remove $KERNEL_VERSION $BOOT_DIR_ABS"
|
||||
"$f" remove "$KERNEL_VERSION" "$BOOT_DIR_ABS"
|
||||
echo "+$f remove $KERNEL_VERSION $ENTRY_DIR_ABS"
|
||||
"$f" remove "$KERNEL_VERSION" "$ENTRY_DIR_ABS"
|
||||
x=$?
|
||||
if [[ $x == $SKIP_REMAINING ]]; then
|
||||
ret=0
|
||||
@ -169,9 +169,9 @@ case $COMMAND in
|
||||
done
|
||||
|
||||
[ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \
|
||||
echo "Removing $BOOT_DIR_ABS"
|
||||
echo "Removing $ENTRY_DIR_ABS"
|
||||
|
||||
rm -rf "$BOOT_DIR_ABS"
|
||||
rm -rf "$ENTRY_DIR_ABS"
|
||||
((ret+=$?))
|
||||
;;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user