diff options
| author | Guido Berhoerster <guido+freiesoftware@berhoerster.name> | 2023-08-24 10:42:11 +0200 |
|---|---|---|
| committer | Mike Gabriel <sunweaver@debian.org> | 2023-09-07 18:45:35 +0000 |
| commit | d075d69db15d4529827743dd6e6d9dffddbf340d (patch) | |
| tree | ca1b2cd3ea36710263df48f95eddd512944043c3 | |
| parent | 80deeb585a65177298d9b0623b135232d7661534 (diff) | |
| download | debian-edu-fai+itzks-d075d69db15d4529827743dd6e6d9dffddbf340d.tar.gz debian-edu-fai+itzks-d075d69db15d4529827743dd6e6d9dffddbf340d.tar.bz2 debian-edu-fai+itzks-d075d69db15d4529827743dd6e6d9dffddbf340d.zip | |
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.
| -rwxr-xr-x | bin/debian-edu-faiinstall | 5 |
1 files changed, 4 insertions, 1 deletions
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 |
