From d075d69db15d4529827743dd6e6d9dffddbf340d Mon Sep 17 00:00:00 2001 From: Guido Berhoerster Date: Thu, 24 Aug 2023 10:42:11 +0200 Subject: Ensure parent of target directory exists before copying FAI config space debian-edu-faiinstall does not check whether the parent of the target directory /srv/fai/config existed before invoking cp -a on the config space. Thus if /srv/fai does no exist cp will copy /usr/share/debian-edu-fai/fai/config to /srv/fai instead of /srv/fai/config which is not detected until booting a client via PXE. Fix this by ensuring the parent directory of $FAI_CONFIGDIR_REAL exists. Additionally do not hardcode /srv/fai which ignores that FAI_CONFIGDIR is configurable. --- bin/debian-edu-faiinstall | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/debian-edu-faiinstall b/bin/debian-edu-faiinstall index 6864844..74a8ad7 100755 --- a/bin/debian-edu-faiinstall +++ b/bin/debian-edu-faiinstall @@ -197,8 +197,11 @@ for codename in ${codenames}; do # Copy FAI config space into /srv/fai/config if not already present if [ ! -d "${FAI_CONFIGDIR_REAL}" ]; then + # Ensure parent directory exists before copying config space + fai_configdir_parent="$(dirname "${FAI_CONFIGDIR_REAL}")" + mkdir -p "${fai_configdir_parent}" if [ -d /usr/share/debian-edu-fai/fai/config ]; then - cp -a /usr/share/debian-edu-fai/fai/config /srv/fai/ + cp -a /usr/share/debian-edu-fai/fai/config "${fai_configdir_parent}" else echo "ERROR: Package debian-edu-fai is not installed, please install it first" exit 1 -- cgit v1.2.3