summaryrefslogtreecommitdiff
path: root/sys-kernel/installkernel-systemd-boot/files/00-00machineid-directory.install
blob: 70b966fbf4b3192114cde6d46435eba90141b035 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env bash

# this file is installed by sys-kernel/installkernel-systemd-boot

COMMAND="${1}"
ENTRY_DIR_ABS="${3}"

# this is exported by kernel-install
if ! [[ $KERNEL_INSTALL_MACHINE_ID ]]; 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}" -gt 0 ]]; then
    		echo "+mkdir -v -p ${MACHINE_ID_DIR}"
    		mkdir -v -p "${MACHINE_ID_DIR}"
	else
    		mkdir -p "${MACHINE_ID_DIR}"
	fi
fi