2021-01-11 08:54:33 +01:00
|
|
|
{ lib, stdenv, fetchFromGitLab, makeWrapper, nixosTests,
|
2018-05-26 20:47:52 +02:00
|
|
|
# optional dependencies, the command(s) they provide
|
|
|
|
coreutils, # mktemp
|
|
|
|
grub2, # grub-mount and grub-probe
|
|
|
|
cryptsetup, # cryptsetup
|
|
|
|
libuuid, # blkid and blockdev
|
2018-07-17 22:11:16 +02:00
|
|
|
udev, # udevadm udevinfo
|
2020-01-02 21:48:06 +01:00
|
|
|
ntfs3g, # ntfs3g
|
2020-01-03 07:31:43 +01:00
|
|
|
dmraid, # dmraid
|
2020-01-02 21:48:06 +01:00
|
|
|
lvm2 # lvs
|
2016-12-25 20:43:46 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2021-01-31 01:03:46 +01:00
|
|
|
version = "1.78";
|
2019-06-09 20:02:40 +02:00
|
|
|
pname = "os-prober";
|
|
|
|
src = fetchFromGitLab {
|
|
|
|
domain = "salsa.debian.org";
|
|
|
|
owner = "installer-team";
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2021-01-31 01:03:46 +01:00
|
|
|
sha256 = "sha256-mfv1b40n/opXdyj6IXWVf/32sWlS+/DbXIRwE1zX4KM=";
|
2016-12-25 20:43:46 +01:00
|
|
|
};
|
|
|
|
|
2021-02-07 10:17:39 +01:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2016-12-25 20:43:46 +01:00
|
|
|
installPhase = ''
|
|
|
|
# executables
|
2018-05-26 20:47:52 +02:00
|
|
|
install -Dt $out/bin os-prober linux-boot-prober
|
|
|
|
install -Dt $out/lib newns
|
|
|
|
install -Dt $out/share common.sh
|
2016-12-25 20:43:46 +01:00
|
|
|
|
|
|
|
# probes
|
2018-08-20 21:11:29 +02:00
|
|
|
case "${stdenv.hostPlatform.system}" in
|
2016-12-25 20:43:46 +01:00
|
|
|
i686*|x86_64*) ARCH=x86;;
|
|
|
|
powerpc*) ARCH=powerpc;;
|
|
|
|
arm*) ARCH=arm;;
|
|
|
|
*) ARCH=other;;
|
|
|
|
esac;
|
|
|
|
for probes in os-probes os-probes/mounted os-probes/init linux-boot-probes linux-boot-probes/mounted; do
|
2018-05-26 20:47:52 +02:00
|
|
|
install -Dt $out/lib/$probes $probes/common/*;
|
2016-12-25 20:43:46 +01:00
|
|
|
if [ -e "$probes/$ARCH" ]; then
|
|
|
|
mkdir -p $out/lib/$probes
|
|
|
|
cp -r $probes/$ARCH/* $out/lib/$probes;
|
|
|
|
fi;
|
|
|
|
done
|
|
|
|
if [ $ARCH = "x86" ]; then
|
|
|
|
cp -r os-probes/mounted/powerpc/20macosx $out/lib/os-probes/mounted;
|
|
|
|
fi;
|
|
|
|
'';
|
|
|
|
postFixup = ''
|
|
|
|
for file in $(find $out -type f ! -name newns) ; do
|
|
|
|
substituteInPlace $file \
|
|
|
|
--replace /usr/share/os-prober/ $out/share/ \
|
|
|
|
--replace /usr/lib/os-probes/ $out/lib/os-probes/ \
|
|
|
|
--replace /usr/lib/linux-boot-probes/ $out/lib/linux-boot-probes/ \
|
|
|
|
--replace /usr/lib/os-prober/ $out/lib/
|
|
|
|
done;
|
|
|
|
for file in $out/bin/*; do
|
|
|
|
wrapProgram $file \
|
2021-01-15 10:19:50 +01:00
|
|
|
--suffix PATH : ${lib.makeBinPath [ grub2 udev coreutils cryptsetup libuuid ntfs3g lvm2 dmraid ]} \
|
2016-12-25 20:43:46 +01:00
|
|
|
--run "[ -d /var/lib/os-prober ] || mkdir /var/lib/os-prober"
|
|
|
|
done;
|
|
|
|
'';
|
|
|
|
|
2019-06-09 20:26:05 +02:00
|
|
|
passthru.tests = {
|
|
|
|
os-prober = nixosTests.os-prober;
|
|
|
|
};
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2016-12-25 20:43:46 +01:00
|
|
|
description = "Utility to detect other OSs on a set of drives";
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "http://packages.debian.org/source/sid/os-prober";
|
2018-05-26 20:49:47 +02:00
|
|
|
license = licenses.gpl2Plus;
|
|
|
|
maintainers = with maintainers; [ symphorien ];
|
2016-12-25 20:43:46 +01:00
|
|
|
};
|
|
|
|
}
|