Merge pull request #107294 from flokli/displaylink-simplify

displaylink: manually activate dlm.service
This commit is contained in:
Florian Klink 2020-12-27 22:30:34 +01:00 committed by GitHub
commit b19ae92d50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 33 deletions

View File

@ -0,0 +1 @@
ACTION=="add", SUBSYSTEM=="usb", DRIVERS=="usb", ATTRS{idVendor}=="17e9", ATTR{bInterfaceClass}=="ff", ATTR{bInterfaceProtocol}=="03", TAG+="systemd", ENV{SYSTEMD_WANTS}="dlm.service"

View File

@ -1,6 +1,14 @@
{ stdenv, lib, unzip, util-linux,
libusb1, evdi, systemd, makeWrapper, requireFile, substituteAll }:
{ stdenv
, lib
, unzip
, util-linux
, libusb1
, evdi
, systemd
, makeWrapper
, requireFile
, substituteAll
}:
let
arch =
if stdenv.hostPlatform.system == "x86_64-linux" then "x64"
@ -9,7 +17,8 @@ let
bins = "${arch}-ubuntu-1604";
libPath = lib.makeLibraryPath [ stdenv.cc.cc util-linux libusb1 evdi ];
in stdenv.mkDerivation rec {
in
stdenv.mkDerivation rec {
pname = "displaylink";
version = "5.3.1.34";
@ -39,20 +48,11 @@ in stdenv.mkDerivation rec {
./displaylink-driver-${version}.run --target . --noexec --nodiskspace
'';
patches = [ (substituteAll {
src = ./udev-installer.patch;
inherit systemd;
})];
installPhase = ''
sed -i "s,/opt/displaylink/udev.sh,$out/lib/udev/displaylink.sh,g" udev-installer.sh
( source udev-installer.sh
mkdir -p $out/lib/udev/rules.d
main systemd "$out/lib/udev/rules.d/99-displaylink.rules" "$out/lib/udev/displaylink.sh"
)
install -Dt $out/lib/displaylink *.spkg
install -Dm755 ${bins}/DisplayLinkManager $out/bin/DisplayLinkManager
mkdir -p $out/lib/udev/rules.d
cp ${./99-displaylink.rules} $out/lib/udev/rules.d/99-displaylink.rules
patchelf \
--set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) \
--set-rpath ${libPath} \

View File

@ -1,18 +0,0 @@
--- a/udev-installer.sh 2018-12-09 12:05:53.772318942 +0100
+++ b/udev-installer.sh 2018-12-09 12:06:19.939947629 +0100
@@ -21,12 +21,12 @@
cat <<'EOF'
start_service()
{
- systemctl start displaylink-driver
+ /run/current-system/systemd/bin/systemctl start --no-block dlm
}
stop_service()
{
- systemctl stop displaylink-driver
+ /run/current-system/systemd/bin/systemctl stop dlm
}
EOF