--- a/Makefile +++ b/Makefile @@ -5,11 +5,10 @@ # definitions and absolute paths in scripts too! # Evaluate parameters -TLP_LIBDIR ?= /usr/lib TLP_SBIN ?= /usr/sbin TLP_BIN ?= /usr/bin -TLP_TLIB = $(TLP_LIBDIR)/tlp-pm -TLP_PLIB = $(TLP_LIBDIR)/pm-utils +TLP_TLIB ?= /usr/share/tlp-pm +TLP_PLIB ?= /usr/lib/pm-utils TLP_ULIB ?= /lib/udev TLP_ACPI ?= /etc/acpi TLP_NMDSP ?= /etc/NetworkManager/dispatcher.d --- a/tlp +++ b/tlp @@ -5,22 +5,21 @@ # This software is licensed under the GPL v2 or later. # --- Constants -readonly LIBDIRS="/usr/lib/tlp-pm /usr/lib64/tlp-pm" +readonly LIBDIR="/usr/share/tlp-pm" readonly LIBS="tlp-functions tlp-rf-func" # --- Locate and source libraries -for libdir in $LIBDIRS; do [ -d $libdir ] && break; done -if [ ! -d $libdir ]; then - echo "Error: missing library directory ($LIBDIRS)." 1>&2 +if [ ! -d $LIBDIR ]; then + echo "Error: missing library directory ($LIBDIR)." 1>&2 exit 1 fi for lib in $LIBS; do - if [ ! -f $libdir/$lib ]; then - echo "Error: missing function library \'$libdir/$lib\'." 1>&2 + if [ ! -f $LIBDIR/$lib ]; then + echo "Error: missing function library \'$LIBDIR/$lib\'." 1>&2 exit 1 fi - . $libdir/$lib + . $LIBDIR/$lib done # --- Subroutines --- a/tlp-functions +++ b/tlp-functions @@ -33,7 +33,7 @@ readonly SYSTEMD=systemd readonly SYSTEMCTL=systemctl readonly INITCTL=initctl -readonly TPACPIBAT=$libdir/tpacpi-bat # libdir is initialized by main program +readonly TPACPIBAT=$LIBDIR/tpacpi-bat # LIBDIR is initialized by main program readonly TPACPIDIR=/sys/devices/platform/thinkpad_acpi readonly SMAPIDIR=/sys/devices/platform/smapi --- a/tlp-rdw-nm +++ b/tlp-rdw-nm @@ -6,19 +6,18 @@ # This software is licensed under the GPL v2 or later. # --- Constants -readonly LIBDIRS="/usr/lib/tlp-pm /usr/lib64/tlp-pm" +readonly LIBDIR="/usr/share/tlp-pm" readonly LIBS="tlp-functions tlp-rf-func" readonly RDW_NM_LOCK="rdw_nm" readonly RDW_NM_LOCKTIME=2 # --- Locate and source libraries -for libdir in $LIBDIRS; do [ -d $libdir ] && break; done -[ -d $libdir ] || exit 0 +[ -d $LIBDIR ] || exit 0 for lib in $LIBS; do - [ -f $libdir/$lib ] || exit 0 - . $libdir/$lib + [ -f $LIBDIR/$lib ] || exit 0 + . $LIBDIR/$lib done # --- MAIN --- a/tlp-rdw-udev +++ b/tlp-rdw-udev @@ -5,19 +5,18 @@ # This software is licensed under the GPL v2 or later. # --- Constants -readonly LIBDIRS="/usr/lib/tlp-pm /usr/lib64/tlp-pm" +readonly LIBDIR="/usr/share/tlp-pm" readonly LIBS="tlp-functions tlp-rf-func" readonly RDW_DOCK_LOCK="rdw_dock_lock" readonly RDW_DOCK_LOCKTIME=2 # --- Locate and source libraries -for libdir in $LIBDIRS; do [ -d $libdir ] && break; done -[ -d $libdir ] || exit 0 +[ -d $LIBDIR ] || exit 0 for lib in $LIBS; do - [ -f $libdir/$lib ] || exit 0 - . $libdir/$lib + [ -f $LIBDIR/$lib ] || exit 0 + . $LIBDIR/$lib done # --- MAIN --- a/tlp-rf +++ b/tlp-rf @@ -5,16 +5,15 @@ # This software is licensed under the GPL v2 or later. # --- Constants -readonly LIBDIRS="/usr/lib/tlp-pm /usr/lib64/tlp-pm" +readonly LIBDIRS="/usr/share/tlp-pm" readonly LIBS="tlp-functions tlp-rf-func" # --- Locate and source libraries -for libdir in $LIBDIRS; do [ -d $libdir ] && break; done -[ -d $libdir ] || exit 0 +[ -d $LIBDIR ] || exit 0 for lib in $LIBS; do - [ -f $libdir/$lib ] || exit 0 - . $libdir/$lib + [ -f $LIBDIR/$lib ] || exit 0 + . $LIBDIR/$lib done # --- MAIN --- a/tlp-run-on +++ b/tlp-run-on @@ -5,22 +5,21 @@ # This software is licensed under the GPL v2 or later. # --- Constants -readonly LIBDIRS="/usr/lib/tlp-pm /usr/lib64/tlp-pm" +readonly LIBDIR="/usr/share/tlp-pm" readonly LIBS="tlp-functions" # --- Locate and source libraries -for libdir in $LIBDIRS; do [ -d $libdir ] && break; done -if [ ! -d $libdir ]; then - echo "Error: missing library directory ($LIBDIRS)." 1>&2 +if [ ! -d $LIBDIR ]; then + echo "Error: missing library directory ($LIBDIR)." 1>&2 exit 1 fi for lib in $LIBS; do - if [ ! -f $libdir/$lib ]; then - echo "Error: missing function library \'$libdir/$lib\'." 1>&2 + if [ ! -f $LIBDIR/$lib ]; then + echo "Error: missing function library \'$LIBDIR/$lib\'." 1>&2 exit 1 fi - . $libdir/$lib + . $LIBDIR/$lib done # --- MAIN --- a/tlp-stat +++ b/tlp-stat @@ -6,7 +6,7 @@ # --- Constants -readonly LIBDIRS="/usr/lib/tlp-pm /usr/lib64/tlp-pm" +readonly LIBDIR="/usr/share/tlp-pm" readonly LIBS="tlp-functions tlp-rf-func" readonly TLPUSB=tlp-usblist @@ -330,18 +330,17 @@ read_args () { # read command line argum # --- Locate and source libraries -for libdir in $LIBDIRS; do [ -d $libdir ] && break; done -if [ ! -d $libdir ]; then - echo "Error: missing library directory ($LIBDIRS)." 1>&2 +if [ ! -d $LIBDIR ]; then + echo "Error: missing library directory ($LIBDIR)." 1>&2 exit 1 fi for lib in $LIBS; do - if [ ! -f $libdir/$lib ]; then - echo "Error: missing function library \'$libdir/$lib\'." 1>&2 + if [ ! -f $LIBDIR/$lib ]; then + echo "Error: missing function library \'$LIBDIR/$lib\'." 1>&2 exit 1 fi - . $libdir/$lib + . $LIBDIR/$lib done # --- MAIN