Merge pull request #141782 from fufexan/tlp

authored by

Artturi and committed by
GitHub
b0f2a754 15f14d50

+22 -24
+2 -2
pkgs/tools/misc/tlp/default.nix
··· 23 , networkmanager 24 }: stdenv.mkDerivation rec { 25 pname = "tlp"; 26 - version = "1.3.1"; 27 28 src = fetchFromGitHub { 29 owner = "linrunner"; 30 repo = "TLP"; 31 rev = version; 32 - sha256 = "14fcnaz9pw534v4d8dddqq4wcvpf1kghr8zlrk62r5lrl46sp1p5"; 33 }; 34 35 # XXX: See patch files for relevant explanations.
··· 23 , networkmanager 24 }: stdenv.mkDerivation rec { 25 pname = "tlp"; 26 + version = "1.4.0"; 27 28 src = fetchFromGitHub { 29 owner = "linrunner"; 30 repo = "TLP"; 31 rev = version; 32 + sha256 = "sha256-Blwj4cqrrYXohnGyJYe+1NYifxqfS4DoVUHmxFf62i4="; 33 }; 34 35 # XXX: See patch files for relevant explanations.
+9 -8
pkgs/tools/misc/tlp/patches/fix-makefile-sed.patch
··· 1 - commit c44347b3b813e209fff537b4d46d23430727a5e2 2 - Author: Bernardo Meurer <meurerbernardo@gmail.com> 3 - Date: Tue Feb 25 21:27:39 2020 -0800 4 5 makefile: correctly sed paths 6 - 7 The default Makefile for tlp makes a mess with catenating `DESTDIR` to 8 everything, but then not actualy using the catenated (_ prefixed) 9 variables to sed it's `.in` files. 10 - 11 This patch makes sure that it correctly sets the paths, taking `DESTDIR` 12 in account where it makes sense (e.g. /bin where we want $out/bin) but 13 not where it doesn't (/etc/tlp.conf should be just that). 14 - 15 The reason DESTDIR is used at all, as opposed to the more appropriate 16 PREFIX, is covered in the nix formula, and is (also) due to the Makefile 17 being a bit "different." 18 19 diff --git a/Makefile b/Makefile 20 - index b5af74e..95122df 100644 21 --- a/Makefile 22 +++ b/Makefile 23 - @@ -47,17 +47,17 @@ _TPACPIBAT = $(DESTDIR)$(TPACPIBAT) 24 25 SED = sed \ 26 -e "s|@TLPVER@|$(TLPVER)|g" \ ··· 28 - -e "s|@TLP_TLIB@|$(TLP_TLIB)|g" \ 29 - -e "s|@TLP_FLIB@|$(TLP_FLIB)|g" \ 30 - -e "s|@TLP_ULIB@|$(TLP_ULIB)|g" \ 31 + -e "s|@TLP_SBIN@|$(_SBIN)|g" \ 32 + -e "s|@TLP_TLIB@|$(_TLIB)|g" \ 33 + -e "s|@TLP_FLIB@|$(_FLIB)|g" \ 34 + -e "s|@TLP_ULIB@|$(_ULIB)|g" \ 35 -e "s|@TLP_CONFUSR@|$(TLP_CONFUSR)|g" \ 36 -e "s|@TLP_CONFDIR@|$(TLP_CONFDIR)|g" \ 37 - -e "s|@TLP_CONFDEF@|$(TLP_CONFDEF)|g" \ 38 + -e "s|@TLP_CONFDEF@|$(_CONFDEF)|g" \ 39 -e "s|@TLP_CONF@|$(TLP_CONF)|g" \ 40 -e "s|@TLP_RUN@|$(TLP_RUN)|g" \ 41 -e "s|@TLP_VAR@|$(TLP_VAR)|g" \
··· 1 2 makefile: correctly sed paths 3 + 4 The default Makefile for tlp makes a mess with catenating `DESTDIR` to 5 everything, but then not actualy using the catenated (_ prefixed) 6 variables to sed it's `.in` files. 7 + 8 This patch makes sure that it correctly sets the paths, taking `DESTDIR` 9 in account where it makes sense (e.g. /bin where we want $out/bin) but 10 not where it doesn't (/etc/tlp.conf should be just that). 11 + 12 The reason DESTDIR is used at all, as opposed to the more appropriate 13 PREFIX, is covered in the nix formula, and is (also) due to the Makefile 14 being a bit "different." 15 16 diff --git a/Makefile b/Makefile 17 + index e9bbab4..6b66651 100644 18 --- a/Makefile 19 +++ b/Makefile 20 + @@ -51,19 +51,19 @@ _TPACPIBAT = $(DESTDIR)$(TPACPIBAT) 21 22 SED = sed \ 23 -e "s|@TLPVER@|$(TLPVER)|g" \ ··· 25 - -e "s|@TLP_TLIB@|$(TLP_TLIB)|g" \ 26 - -e "s|@TLP_FLIB@|$(TLP_FLIB)|g" \ 27 - -e "s|@TLP_ULIB@|$(TLP_ULIB)|g" \ 28 + - -e "s|@TLP_BATD@|$(TLP_BATD)|g" \ 29 + -e "s|@TLP_SBIN@|$(_SBIN)|g" \ 30 + -e "s|@TLP_TLIB@|$(_TLIB)|g" \ 31 + -e "s|@TLP_FLIB@|$(_FLIB)|g" \ 32 + -e "s|@TLP_ULIB@|$(_ULIB)|g" \ 33 + + -e "s|@TLP_BATD@|$(_BATD)|g" \ 34 -e "s|@TLP_CONFUSR@|$(TLP_CONFUSR)|g" \ 35 -e "s|@TLP_CONFDIR@|$(TLP_CONFDIR)|g" \ 36 - -e "s|@TLP_CONFDEF@|$(TLP_CONFDEF)|g" \ 37 + - -e "s|@TLP_CONFREN@|$(TLP_CONFREN)|g" \ 38 + -e "s|@TLP_CONFDEF@|$(_CONFDEF)|g" \ 39 + + -e "s|@TLP_CONFREN@|$(_CONFREN)|g" \ 40 -e "s|@TLP_CONF@|$(TLP_CONF)|g" \ 41 -e "s|@TLP_RUN@|$(TLP_RUN)|g" \ 42 -e "s|@TLP_VAR@|$(TLP_VAR)|g" \
+11 -14
pkgs/tools/misc/tlp/patches/tlp-sleep-service.patch
··· 1 - commit ca94cd56210067e2a55c1f413bd7713f7d338f9f 2 - Author: Bernardo Meurer <meurerbernardo@gmail.com> 3 - Date: Wed Feb 26 10:46:23 2020 -0800 4 5 tlp-sleep.service: reintroduce 6 - 7 This patch reintroduces tlp-sleep as a systemd unit as opposed to a 8 systemd system-sleep hook script. This is due to the recommendation by 9 systemd itself to not use the hook scripts. As per the manual: 10 - 11 > Note that scripts or binaries dropped in /usr/lib/systemd/system-sleep/ 12 > are intended for local use only and should be considered hacks. If 13 > applications want to react to system suspend/hibernation and resume, 14 > they should rather use the Inhibitor interface[1]. 15 16 diff --git a/Makefile b/Makefile 17 - index 95122df..0e9230a 100644 18 --- a/Makefile 19 +++ b/Makefile 20 - @@ -70,6 +70,7 @@ INFILES = \ 21 tlp.rules \ 22 tlp-readconfs \ 23 tlp-run-on \ ··· 25 tlp.service \ 26 tlp-stat \ 27 tlp.upstart \ 28 - @@ -99,7 +100,6 @@ SHFILES = \ 29 tlp-rdw-udev.in \ 30 tlp-rf.in \ 31 tlp-run-on.in \ ··· 33 tlp-sleep.elogind \ 34 tlp-stat.in \ 35 tlp-usb-udev.in 36 - @@ -147,7 +147,7 @@ ifneq ($(TLP_NO_INIT),1) 37 endif 38 ifneq ($(TLP_WITH_SYSTEMD),0) 39 install -D -m 644 tlp.service $(_SYSD)/tlp.service 40 - install -D -m 755 tlp-sleep $(_SDSL)/tlp 41 - + install -D -m 644 tlp-sleep.service $(_SYSD)/tlp-sleep.service 42 endif 43 ifneq ($(TLP_WITH_ELOGIND),0) 44 install -D -m 755 tlp-sleep.elogind $(_ELOD)/49-tlp-sleep 45 - @@ -204,7 +204,7 @@ uninstall-tlp: 46 rm $(_ULIB)/rules.d/85-tlp.rules 47 rm -f $(_SYSV)/tlp 48 rm -f $(_SYSD)/tlp.service 49 - rm -f $(_SDSL)/tlp-sleep 50 - + rm -f $(_SYSD)/tlp-sleep.service 51 rm -f $(_ELOD)/49-tlp-sleep 52 rm -f $(_SHCPL)/tlp-stat 53 rm -f $(_SHCPL)/bluetooth 54 diff --git a/tlp-sleep b/tlp-sleep 55 deleted file mode 100644 56 - index 3de85ce..0000000 57 --- a/tlp-sleep 58 +++ /dev/null 59 @@ -1,11 +0,0 @@ ··· 61 - 62 -# tlp - systemd suspend/resume hook 63 -# 64 - -# Copyright (c) 2020 Thomas Koch <linrunner at gmx.net> and others. 65 -# This software is licensed under the GPL v2 or later. 66 - 67 -case $1 in
··· 1 2 tlp-sleep.service: reintroduce 3 + 4 This patch reintroduces tlp-sleep as a systemd unit as opposed to a 5 systemd system-sleep hook script. This is due to the recommendation by 6 systemd itself to not use the hook scripts. As per the manual: 7 + 8 > Note that scripts or binaries dropped in /usr/lib/systemd/system-sleep/ 9 > are intended for local use only and should be considered hacks. If 10 > applications want to react to system suspend/hibernation and resume, 11 > they should rather use the Inhibitor interface[1]. 12 13 diff --git a/Makefile b/Makefile 14 + index e9bbab4..7d71e02 100644 15 --- a/Makefile 16 +++ b/Makefile 17 + @@ -76,6 +76,7 @@ INFILES = \ 18 tlp.rules \ 19 tlp-readconfs \ 20 tlp-run-on \ ··· 22 tlp.service \ 23 tlp-stat \ 24 tlp.upstart \ 25 + @@ -106,7 +107,6 @@ SHFILES = \ 26 tlp-rdw-udev.in \ 27 tlp-rf.in \ 28 tlp-run-on.in \ ··· 30 tlp-sleep.elogind \ 31 tlp-stat.in \ 32 tlp-usb-udev.in 33 + @@ -159,7 +159,7 @@ ifneq ($(TLP_NO_INIT),1) 34 endif 35 ifneq ($(TLP_WITH_SYSTEMD),0) 36 install -D -m 644 tlp.service $(_SYSD)/tlp.service 37 - install -D -m 755 tlp-sleep $(_SDSL)/tlp 38 + + install -D -m 644 tlp-sleep.service $(_SDSL)/tlp-sleep.service 39 endif 40 ifneq ($(TLP_WITH_ELOGIND),0) 41 install -D -m 755 tlp-sleep.elogind $(_ELOD)/49-tlp-sleep 42 + @@ -216,7 +216,7 @@ uninstall-tlp: 43 rm $(_ULIB)/rules.d/85-tlp.rules 44 rm -f $(_SYSV)/tlp 45 rm -f $(_SYSD)/tlp.service 46 - rm -f $(_SDSL)/tlp-sleep 47 + + rm -f $(_SDSL)/tlp-sleep.service 48 rm -f $(_ELOD)/49-tlp-sleep 49 rm -f $(_SHCPL)/tlp-stat 50 rm -f $(_SHCPL)/bluetooth 51 diff --git a/tlp-sleep b/tlp-sleep 52 deleted file mode 100644 53 + index e548d55..0000000 54 --- a/tlp-sleep 55 +++ /dev/null 56 @@ -1,11 +0,0 @@ ··· 58 - 59 -# tlp - systemd suspend/resume hook 60 -# 61 + -# Copyright (c) 2021 Thomas Koch <linrunner at gmx.net> and others. 62 -# This software is licensed under the GPL v2 or later. 63 - 64 -case $1 in