]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
kernel-install: rename $BOOT_DIR[_ABS] to $ENTRY_DIR[_ABS]
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 8 Mar 2019 14:37:35 +0000 (15:37 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 12 Mar 2019 08:45:16 +0000 (09:45 +0100)
"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".

NEWS
src/kernel-install/50-depmod.install
src/kernel-install/90-loaderentry.install
src/kernel-install/kernel-install

diff --git a/NEWS b/NEWS
index f61262fd570c6c2777663b0f412a0afee2c5ee91..305bdf9f1075a4ea79c188699a9bfae4f6f82f61 100644 (file)
--- a/NEWS
+++ b/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
index 7421e93c19b1af14466f3f047e9bee8deadf1015..268b6ce0a5266dc6e1ab192d438f967f3f1cad1c 100644 (file)
@@ -4,7 +4,7 @@
 
 COMMAND="$1"
 KERNEL_VERSION="$2"
-BOOT_DIR_ABS="$3"
+ENTRY_DIR_ABS="$3"
 KERNEL_IMAGE="$4"
 INITRD_OPTIONS_START="5"
 
index c6b4ac14dac841c46d48544af9428ae6315ba23c..2fb0f5207b3339e1ee13d62f52582c50a531b08d 100644 (file)
@@ -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" || {
index 147908cf81f145d541afc78f6c54898e2a2d78c2..fcf36f181ff339171e068ae2b6d30a3bf75525d4 100644 (file)
@@ -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+=$?))
         ;;