From 6e6663423988d780011288e26a1ad9ec54db5c63 Mon Sep 17 00:00:00 2001 From: Shamrock Lee <44064051+ShamrockLee@users.noreply.github.com> Date: Mon, 25 Jul 2022 11:28:13 +0800 Subject: [PATCH] xrootd: fix missing etc contents and default externalEtc to "/etc" (#181971) --- pkgs/tools/networking/xrootd/default.nix | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/pkgs/tools/networking/xrootd/default.nix b/pkgs/tools/networking/xrootd/default.nix index 17e9f660ac0d..dda45fbce5b7 100644 --- a/pkgs/tools/networking/xrootd/default.nix +++ b/pkgs/tools/networking/xrootd/default.nix @@ -16,6 +16,9 @@ , voms , zlib , enableTests ? true + # If not null, the builder will + # move "$out/etc" to "$out/etc.orig" and symlink "$out/etc" to externalEtc. +, externalEtc ? "/etc" }: stdenv.mkDerivation rec { @@ -68,10 +71,31 @@ stdenv.mkDerivation rec { sed -i 's/set\((\s*CMAKE_INSTALL_[A-Z_]\+DIR\s\+"[^"]\+"\s*)\)/define_default\1/g' cmake/XRootDOSDefs.cmake ''; + # https://github.com/xrootd/xrootd/blob/master/packaging/rhel/xrootd.spec.in#L665-L675= + postInstall = '' + mkdir -p "$out/lib/tmpfiles.d" + install -m 644 -T ../packaging/rhel/xrootd.tmpfiles "$out/lib/tmpfiles.d/xrootd.conf" + mkdir -p "$out/etc/xrootd" + install -m 644 -t "$out/etc/xrootd" ../packaging/common/*.cfg + install -m 644 -t "$out/etc/xrootd" ../packaging/common/client.conf + mkdir -p "$out/etc/xrootd/client.plugins.d" + install -m 644 -t "$out/etc/xrootd/client.plugins.d" ../packaging/common/client-plugin.conf.example + mkdir -p "$out/etc/logrotate.d" + install -m 644 -T ../packaging/common/xrootd.logrotate "$out/etc/logrotate.d/xrootd" + '' + lib.optionalString stdenv.isLinux '' + mkdir -p "$out/lib/systemd/system" + install -m 644 -t "$out/lib/systemd/system" ../packaging/common/*.service ../packaging/common/*.socket + ''; + cmakeFlags = lib.optionals enableTests [ "-DENABLE_TESTS=TRUE" ]; + postFixup = lib.optionalString (externalEtc != null) '' + mv "$out"/etc{,.orig} + ln -s ${lib.escapeShellArg externalEtc} "$out/etc" + ''; + meta = with lib; { description = "High performance, scalable fault tolerant data access"; homepage = "https://xrootd.slac.stanford.edu";