2017-01-30 12:25:07 +00:00
|
|
|
{ stdenv, fetchurl, makeWrapper,
|
2018-05-26 19:47:52 +01: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 21:11:16 +01:00
|
|
|
udev, # udevadm udevinfo
|
2018-05-26 19:47:52 +01:00
|
|
|
ntfs3g # ntfs3g
|
2016-12-25 19:43:46 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2018-03-09 13:58:14 +00:00
|
|
|
version = "1.76";
|
2016-12-25 19:43:46 +00:00
|
|
|
name = "os-prober-${version}";
|
|
|
|
src = fetchurl {
|
2018-05-26 19:46:30 +01:00
|
|
|
url = "https://salsa.debian.org/philh/os-prober/-/archive/${version}/os-prober-${version}.tar.bz2";
|
|
|
|
sha256 = "07rw3092pckh21vx6y4hzqcn3wn4cqmwxaaiq100lncnhmszg11g";
|
2016-12-25 19:43:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [ makeWrapper ];
|
|
|
|
installPhase = ''
|
|
|
|
# executables
|
2018-05-26 19:47:52 +01:00
|
|
|
install -Dt $out/bin os-prober linux-boot-prober
|
|
|
|
install -Dt $out/lib newns
|
|
|
|
install -Dt $out/share common.sh
|
2016-12-25 19:43:46 +00:00
|
|
|
|
|
|
|
# probes
|
2018-08-20 20:11:29 +01:00
|
|
|
case "${stdenv.hostPlatform.system}" in
|
2016-12-25 19:43:46 +00: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 19:47:52 +01:00
|
|
|
install -Dt $out/lib/$probes $probes/common/*;
|
2016-12-25 19:43:46 +00: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 \
|
2018-07-17 21:11:16 +01:00
|
|
|
--suffix PATH : ${stdenv.lib.makeBinPath [ grub2 udev coreutils cryptsetup libuuid ntfs3g ]} \
|
2016-12-25 19:43:46 +00:00
|
|
|
--run "[ -d /var/lib/os-prober ] || mkdir /var/lib/os-prober"
|
|
|
|
done;
|
|
|
|
'';
|
|
|
|
|
2018-05-26 19:49:47 +01:00
|
|
|
meta = with stdenv.lib; {
|
2016-12-25 19:43:46 +00:00
|
|
|
description = "Utility to detect other OSs on a set of drives";
|
|
|
|
homepage = http://packages.debian.org/source/sid/os-prober;
|
2018-05-26 19:49:47 +01:00
|
|
|
license = licenses.gpl2Plus;
|
|
|
|
maintainers = with maintainers; [ symphorien ];
|
2016-12-25 19:43:46 +00:00
|
|
|
};
|
|
|
|
}
|