2021-01-19 06:50:56 +00:00
|
|
|
{ stdenv, lib, fetchurl, pkg-config, makeWrapper
|
2020-11-24 15:29:28 +00:00
|
|
|
, libusb1, tcl, util-linux, coreutils, bash }:
|
2010-04-16 15:56:28 +00:00
|
|
|
|
2014-07-18 16:11:16 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "usb-modeswitch";
|
2019-12-09 23:27:53 +00:00
|
|
|
version = "2.6.0";
|
2010-04-16 15:56:28 +00:00
|
|
|
|
2015-02-17 00:33:28 +00:00
|
|
|
src = fetchurl {
|
2019-08-15 12:41:18 +00:00
|
|
|
url = "http://www.draisberghof.de/usb_modeswitch/${pname}-${version}.tar.bz2";
|
2019-12-09 23:27:53 +00:00
|
|
|
sha256 = "18wbbxc5cfsmikba0msdvd5qlaga27b32nhrzicyd9mdddp265f2";
|
2010-04-16 15:56:28 +00:00
|
|
|
};
|
|
|
|
|
2019-05-05 08:23:32 +00:00
|
|
|
patches = [ ./configurable-usb-modeswitch.patch ];
|
|
|
|
|
|
|
|
# Remove attempts to write to /etc and /var/lib.
|
|
|
|
postPatch = ''
|
|
|
|
sed -i \
|
|
|
|
-e '/^\tinstall .* usb_modeswitch.conf/s,$(ETCDIR),$(out)/etc,' \
|
|
|
|
-e '\,^\tinstall -d .*/var/lib/usb_modeswitch,d' \
|
|
|
|
Makefile
|
|
|
|
'';
|
|
|
|
|
2017-02-18 03:35:02 +00:00
|
|
|
makeFlags = [
|
|
|
|
"PREFIX=$(out)"
|
2019-05-05 08:23:32 +00:00
|
|
|
"ETCDIR=/etc"
|
|
|
|
"USE_UPSTART=false"
|
|
|
|
"USE_SYSTEMD=true"
|
|
|
|
"SYSDIR=$(out)/lib/systemd/system"
|
|
|
|
"UDEVDIR=$(out)/lib/udev"
|
2017-02-18 03:35:02 +00:00
|
|
|
];
|
|
|
|
|
2019-05-05 08:23:32 +00:00
|
|
|
postFixup = ''
|
|
|
|
wrapProgram $out/bin/usb_modeswitch_dispatcher \
|
2020-11-24 15:29:28 +00:00
|
|
|
--set PATH ${lib.makeBinPath [ util-linux coreutils bash ]}
|
2010-04-16 15:56:28 +00:00
|
|
|
'';
|
|
|
|
|
2019-05-05 08:23:32 +00:00
|
|
|
buildInputs = [ libusb1 tcl ];
|
2021-01-19 06:50:56 +00:00
|
|
|
nativeBuildInputs = [ pkg-config makeWrapper ];
|
2010-04-16 15:56:28 +00:00
|
|
|
|
2021-01-23 12:26:19 +00:00
|
|
|
meta = with lib; {
|
2016-06-20 10:53:46 +00:00
|
|
|
description = "A mode switching tool for controlling 'multi-mode' USB devices";
|
2017-02-18 03:35:02 +00:00
|
|
|
license = licenses.gpl2;
|
|
|
|
maintainers = with maintainers; [ marcweber peterhoeg ];
|
|
|
|
platforms = platforms.linux;
|
2010-04-16 15:56:28 +00:00
|
|
|
};
|
|
|
|
}
|