parent
32f42705ff
commit
a4dbe5c10c
3 changed files with 75 additions and 1 deletions
|
@ -5,13 +5,17 @@
|
|||
, fetchurl
|
||||
, pkg-config
|
||||
, util-linux
|
||||
, coreutils
|
||||
, libuuid
|
||||
, libaio
|
||||
, substituteAll
|
||||
, enableCmdlib ? false
|
||||
, enableDmeventd ? false
|
||||
, udevSupport ? !stdenv.hostPlatform.isStatic, udev ? null
|
||||
, onlyLib ? stdenv.hostPlatform.isStatic
|
||||
, enableVDO ? false, vdo ? null
|
||||
, enableMdadm ? false, mdadm ? null
|
||||
, enableMultipath ? false, multipath-tools ? null
|
||||
, nixosTests
|
||||
}:
|
||||
|
||||
|
@ -82,13 +86,28 @@ stdenv.mkDerivation rec {
|
|||
substituteInPlace make.tmpl.in --replace "@systemdsystemunitdir@" "$out/lib/systemd/system"
|
||||
'' + lib.optionalString (lib.versionAtLeast version "2.03") ''
|
||||
substituteInPlace libdm/make.tmpl.in --replace "@systemdsystemunitdir@" "$out/lib/systemd/system"
|
||||
|
||||
substituteInPlace scripts/blk_availability_systemd_red_hat.service.in \
|
||||
--replace '/usr/bin/true' '${coreutils}/bin/true'
|
||||
'';
|
||||
|
||||
postConfigure = ''
|
||||
sed -i 's|^#define LVM_CONFIGURE_LINE.*$|#define LVM_CONFIGURE_LINE "<removed>"|g' ./include/configure.h
|
||||
'';
|
||||
|
||||
patches = lib.optionals (lib.versionOlder version "2.03.15") [
|
||||
patches = [
|
||||
# fixes paths to and checks for tools
|
||||
(substituteAll (let
|
||||
optionalTool = cond: pkg: if cond then pkg else "/run/current-system/sw";
|
||||
in {
|
||||
src = ./fix-blkdeactivate.patch;
|
||||
inherit coreutils;
|
||||
util_linux = util-linux;
|
||||
mdadm = optionalTool enableMdadm mdadm;
|
||||
multipath_tools = optionalTool enableMultipath multipath-tools;
|
||||
vdo = optionalTool enableVDO vdo;
|
||||
}))
|
||||
] ++ lib.optionals (lib.versionOlder version "2.03.15") [
|
||||
# Musl fixes from Alpine.
|
||||
./fix-stdio-usage.patch
|
||||
(fetchpatch {
|
||||
|
|
51
pkgs/os-specific/linux/lvm2/fix-blkdeactivate.patch
Normal file
51
pkgs/os-specific/linux/lvm2/fix-blkdeactivate.patch
Normal file
|
@ -0,0 +1,51 @@
|
|||
diff --git a/scripts/blkdeactivate.sh.in b/scripts/blkdeactivate.sh.in
|
||||
index 7c517b87b..e51a33778 100644
|
||||
--- a/scripts/blkdeactivate.sh.in
|
||||
+++ b/scripts/blkdeactivate.sh.in
|
||||
@@ -34,11 +34,11 @@ TOOL=blkdeactivate
|
||||
DEV_DIR="/dev"
|
||||
SYS_BLK_DIR="/sys/block"
|
||||
|
||||
-MDADM="/sbin/mdadm"
|
||||
-MOUNTPOINT="/bin/mountpoint"
|
||||
-MPATHD="/sbin/multipathd"
|
||||
-UMOUNT="/bin/umount"
|
||||
-VDO="/bin/vdo"
|
||||
+MDADM="@mdadm@/bin/mdadm"
|
||||
+MOUNTPOINT="@util_linux@/bin/mountpoint"
|
||||
+MPATHD="@multipath_tools@/bin/multipathd"
|
||||
+UMOUNT="@util_linux@/bin/umount"
|
||||
+VDO="@vdo@/bin/vdo"
|
||||
|
||||
sbindir="@SBINDIR@"
|
||||
DMSETUP="$sbindir/dmsetup"
|
||||
@@ -48,7 +48,7 @@ if "$UMOUNT" --help | grep -- "--all-targets" >"$DEV_DIR/null"; then
|
||||
UMOUNT_OPTS="--all-targets "
|
||||
else
|
||||
UMOUNT_OPTS=""
|
||||
- FINDMNT="/bin/findmnt -r --noheadings -u -o TARGET"
|
||||
+ FINDMNT="@util_linux@/bin/findmnt -r --noheadings -u -o TARGET"
|
||||
FINDMNT_READ="read -r mnt"
|
||||
fi
|
||||
DMSETUP_OPTS=""
|
||||
@@ -57,10 +57,10 @@ MDADM_OPTS=""
|
||||
MPATHD_OPTS=""
|
||||
VDO_OPTS=""
|
||||
|
||||
-LSBLK="/bin/lsblk -r --noheadings -o TYPE,KNAME,NAME,MOUNTPOINT"
|
||||
+LSBLK="@util_linux@/bin/lsblk -r --noheadings -o TYPE,KNAME,NAME,MOUNTPOINT"
|
||||
LSBLK_VARS="local devtype local kname local name local mnt"
|
||||
LSBLK_READ="read -r devtype kname name mnt"
|
||||
-SORT_MNT="/bin/sort -r -u -k 4"
|
||||
+SORT_MNT="@coreutils@/bin/sort -r -u -k 4"
|
||||
|
||||
# Do not show tool errors by default (only done/skipping summary
|
||||
# message provided by this script) and no verbose mode by default.
|
||||
@@ -102,6 +102,7 @@ declare -A SKIP_VG_LIST=()
|
||||
# (list is an associative array!)
|
||||
#
|
||||
declare -A SKIP_UMOUNT_LIST=(["/"]=1 \
|
||||
+ ["/nix"]=1 ["/nix/store"]=1 \
|
||||
["/lib"]=1 ["/lib64"]=1 \
|
||||
["/bin"]=1 ["/sbin"]=1 \
|
||||
["/var"]=1 ["/var/log"]=1 \
|
|
@ -22878,6 +22878,10 @@ with pkgs;
|
|||
# which depends on lvm2 again. But we only need the libudev part
|
||||
# which does not depend on cryptsetup.
|
||||
udev = systemdMinimal;
|
||||
# break the cyclic dependency:
|
||||
# util-linux (non-minimal) depends (optionally, but on by default) on systemd,
|
||||
# systemd (optionally, but on by default) on cryptsetup and cryptsetup depends on lvm2
|
||||
util-linux = util-linuxMinimal;
|
||||
};
|
||||
lvm2-2_02 = callPackage ../os-specific/linux/lvm2/2_02.nix {
|
||||
udev = systemdMinimal;
|
||||
|
|
Loading…
Reference in a new issue