Merge pull request #258667 from returntoreality/indi-udev

indilib: fix udev rules
This commit is contained in:
Weijia Wang
2023-10-19 01:42:56 +02:00
committed by GitHub
3 changed files with 48 additions and 4 deletions
@@ -1,9 +1,11 @@
{ stdenv
, lib
, fetchFromGitHub
, bash
, cmake
, cfitsio
, libusb1
, kmod
, zlib
, boost
, libev
@@ -58,6 +60,15 @@ stdenv.mkDerivation rec {
# Socket address collisions between tests
enableParallelChecking = false;
postFixup = lib.optionalString stdenv.isLinux ''
for f in $out/lib/udev/rules.d/*.rules
do
substituteInPlace $f --replace "/bin/sh" "${bash}/bin/sh" \
--replace "/sbin/modprobe" "${kmod}/sbin/modprobe"
done
'';
meta = with lib; {
homepage = "https://www.indilib.org/";
description = "Implementation of the INDI protocol for POSIX operating systems";
@@ -1,6 +1,8 @@
{ stdenv
, lib
, bash
, cmake
, coreutils
, cfitsio
, libusb1
, zlib
@@ -24,6 +26,10 @@
, firmware ? null
}:
let
libusb-with-fxload = libusb1.override { withExamples = true;};
in
stdenv.mkDerivation rec {
pname = "indi-3rdparty";
@@ -68,6 +74,19 @@ stdenv.mkDerivation rec {
"-DWITH_SBIG=off"
];
postFixup = lib.optionalString stdenv.isLinux ''
for f in $out/lib/udev/rules.d/*.rules
do
substituteInPlace $f --replace "/sbin/fxload" "${libusb-with-fxload}/sbin/fxload" \
--replace "/lib/firmware/" "$out/lib/firmware/" \
--replace "/bin/sleep" "${coreutils}/bin/sleep" \
--replace "/bin/cat" "${coreutils}/bin/cat" \
--replace "/bin/echo" "${coreutils}/bin/echo" \
--replace "/bin/sh" "${bash}/bin/sh"
done
'';
meta = with lib; {
homepage = "https://www.indilib.org/";
description = "Third party drivers for the INDI astronomical software suite";
@@ -1,7 +1,9 @@
{ stdenv
, lib
, bash
, cmake
, cfitsio
, coreutils
, libusb1
, zlib
, boost
@@ -21,7 +23,9 @@
, src
, autoPatchelfHook
}:
let
libusb-with-fxload = libusb1.override { withExamples = true;};
in
stdenv.mkDerivation rec {
pname = "indi-firmware";
@@ -39,7 +43,8 @@ stdenv.mkDerivation rec {
"-DCMAKE_INSTALL_LIBDIR=lib"
"-DUDEVRULES_INSTALL_DIR=lib/udev/rules.d"
"-DRULES_INSTALL_DIR=lib/udev/rules.d"
"-DFIRMWARE_INSTALL_DIR=\${CMAKE_INSTALL_PREFIX}/lib/firmware"
"-DFIRMWARE_INSTALL_DIR=lib/firmware"
"-DQHY_FIRMWARE_INSTALL_DIR=\${CMAKE_INSTALL_PREFIX}/lib/firmware/qhy"
"-DCONF_DIR=etc"
"-DBUILD_LIBS=1"
"-DWITH_PENTAX=off"
@@ -52,8 +57,17 @@ stdenv.mkDerivation rec {
done
'';
postFixup = ''
rm $out/lib/udev/rules.d/99-fli.rules
postFixup = lib.optionalString stdenv.isLinux ''
for f in $out/lib/udev/rules.d/*.rules
do
substituteInPlace "$f" --replace "/sbin/fxload" "${libusb-with-fxload}/sbin/fxload" \
--replace "/bin/sleep" "${coreutils}/bin/sleep" \
--replace "/bin/cat" "${coreutils}/bin/cat" \
--replace "/bin/echo" "${coreutils}/bin/echo" \
--replace "/bin/sh" "${bash}/bin/sh" \
--replace "/lib/firmware/" "$out/lib/firmware/"
sed -e 's|-D $env{DEVNAME}|-p $env{BUSNUM},$env{DEVNUM}|' -i "$f"
done
'';
meta = with lib; {