diff options
Diffstat (limited to 'sys-kernel/installkernel-systemd/files/installkernel-systemd-2-r2-00-00machineid-directory.install')
-rw-r--r-- | sys-kernel/installkernel-systemd/files/installkernel-systemd-2-r2-00-00machineid-directory.install | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/sys-kernel/installkernel-systemd/files/installkernel-systemd-2-r2-00-00machineid-directory.install b/sys-kernel/installkernel-systemd/files/installkernel-systemd-2-r2-00-00machineid-directory.install new file mode 100644 index 000000000000..54871f9e70eb --- /dev/null +++ b/sys-kernel/installkernel-systemd/files/installkernel-systemd-2-r2-00-00machineid-directory.install @@ -0,0 +1,32 @@ +#!/usr/bin/env sh + +# this file is installed by sys-kernel/installkernel-systemd + +COMMAND="${1}" +ENTRY_DIR_ABS="${3}" + +# this is exported by kernel-install +if [ -z "${KERNEL_INSTALL_MACHINE_ID}" ]; then + exit 0 +fi + +if [ "${KERNEL_INSTALL_LAYOUT}" = "uki" ]; then + exit 0 +fi + +if [ "${COMMAND}" != "add" ]; then + exit 0 +fi + +# If the machine-id dir does not exist (e.g. $ESP/<machine-id>) +# create it. It receives values directly from kernel-install. +# This is the only function of this plugin. +MACHINE_ID_DIR="${ENTRY_DIR_ABS%/*}" +if ! [ -d "${MACHINE_ID_DIR}" ]; then + if [ "${KERNEL_INSTALL_VERBOSE}" = "1" ]; then + echo "+mkdir -v -p ${MACHINE_ID_DIR}" + mkdir -v -p "${MACHINE_ID_DIR}" + else + mkdir -p "${MACHINE_ID_DIR}" + fi +fi |