Skip to content

Commit

Permalink
Move libs to /usr/share/tlp-pm
Browse files Browse the repository at this point in the history
FHS states architecture independent "data" (i.e. scripts) belongs in /usr/share.

Remove /usr/lib64 stuff: once used in Fedora packaging (pm-utils put scripts into
/usr/lib64/pm-utils despite being architecture independent), this is no longer
necessary.
  • Loading branch information
linrunner committed Aug 27, 2015
1 parent ea927da commit 30373b7
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 80 deletions.
9 changes: 4 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Makefile for TLP

# 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
Expand Down Expand Up @@ -106,7 +105,7 @@ install-rdw: all
install -D -m 755 tlp-rdw-nm $(_NMDSP)/99tlp-rdw-nm

install-man:
# Package manpages
# manpages
install -d -m 755 $(_MAN)/man1
install -m 644 {bluetooth,run-on-ac,run-on-bat,wifi,wwan}.1 $(_MAN)/man1/
install -d -m 755 $(_MAN)/man8
Expand Down Expand Up @@ -147,7 +146,7 @@ uninstall-rdw:
rm $(_NMDSP)/99tlp-rdw-nm

uninstall-man:
# Package manpages
# manpages
rm $(_MAN)/man1/{bluetooth,run-on-ac,run-on-bat,wifi,wwan}.1
rm $(_MAN)/man8/{tlp,tlp-stat}.8

Expand Down
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
tlp (0.8.900-1) unstable; urgency=low

* Development package

-- Thomas Koch <[email protected]> Tue, 25 Aug 2015 19:41:15 +0200

tlp (0.8-1) unstable; urgency=low

* New upstream release
Expand Down
2 changes: 1 addition & 1 deletion thinkpad-radiosw.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Copyright (c) 2015 Thomas Koch <linrunner at gmx.net>
# This software is licensed under the GPL v2 or later.

readonly LIBDIRS="/usr/lib/tlp-pm /usr/lib64/tlp-pm @TLP_TLIB@"
readonly LIBDIR="@TLP_TLIB@"
readonly LIBS="tlp-functions tlp-rf-func"

for libdir in $LIBDIRS; do [ -d $libdir ] && break; done
Expand Down
2 changes: 1 addition & 1 deletion tlp-functions.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# ----------------------------------------------------------------------------
# Constants

readonly TLPVER="0.8"
readonly TLPVER="0.8.900"

readonly CONFFILE=@TLP_CONF@
readonly RUNDIR=/var/run/tlp
Expand Down
33 changes: 15 additions & 18 deletions tlp-nop.in
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
#!/bin/sh
# tlp - if tlp is enabled, override corresponding script
# in /usr/lib*/pm-utils/power.d/
# tlp - if tlp is enabled, override corresponding pm-utils script
# in /usr/lib/pm-utils/power.d/

CONFFILE=@TLP_CONF@
LIBDIRS='/usr/lib/pm-utils /usr/lib64/pm-utils @TLP_PLIB@'
LIBDIR='@TLP_PLIB@'

for d in ${LIBDIRS}; do
if [ -d "${d}/power.d" ]; then
blocked="${d}/power.d/${0##*/}"
break
fi
done
if [ -d "$LIBDIR/power.d" ]; then
# pm-utils script dir exists
blocked="$LIBDIR/power.d/${0##*/}"

if [ -n "$blocked" ] && [ -x "$blocked" ]; then
# else nothing to disable -> don't read $CONFFILE

if [ -e "$CONFFILE" ] && . "$CONFFILE" && [ "$TLP_ENABLE" = '1' ]; then
# TLP is enabled -> disable $blocked
echo "Notice: '${blocked}' disabled by TLP."
else
exec "$blocked" $*
fi
if [ -x "$blocked" ]; then
# overridable pm-utils script exists --> check if TLP enabled
if [ -e "$CONFFILE" ] && . "$CONFFILE" && [ "$TLP_ENABLE" = '1' ]; then
# TLP is enabled --> disable $blocked
echo "Notice: '${blocked}' disabled by TLP."
else
exec "$blocked" $*
fi
fi # else: nothing to disable -> don't read $CONFFILE
fi

exit 0
14 changes: 7 additions & 7 deletions tlp-rdw-nm.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
# This software is licensed under the GPL v2 or later.

# --- Constants
readonly LIBDIRS="/usr/lib/tlp-pm /usr/lib64/tlp-pm @TLP_TLIB@"
readonly LIBDIR="@TLP_TLIB@"
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

# --- Source libraries
for lib in $LIBS; do
[ -f $libdir/$lib ] || exit 0
. $libdir/$lib
if [ ! -f $LIBDIR/$lib ]; then
echo "Error: missing function library \'$LIBDIR/$lib\'." 1>&2
exit 1
fi
. $LIBDIR/$lib
done

# --- MAIN
Expand Down
14 changes: 7 additions & 7 deletions tlp-rdw-udev.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
# This software is licensed under the GPL v2 or later.

# --- Constants
readonly LIBDIRS="/usr/lib/tlp-pm /usr/lib64/tlp-pm @TLP_TLIB@"
readonly LIBDIR="@TLP_TLIB@"
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

# --- Source libraries
for lib in $LIBS; do
[ -f $libdir/$lib ] || exit 0
. $libdir/$lib
if [ ! -f $LIBDIR/$lib ]; then
echo "Error: missing function library \'$LIBDIR/$lib\'." 1>&2
exit 1
fi
. $LIBDIR/$lib
done

# --- MAIN
Expand Down
14 changes: 7 additions & 7 deletions tlp-rf.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
# This software is licensed under the GPL v2 or later.

# --- Constants
readonly LIBDIRS="/usr/lib/tlp-pm /usr/lib64/tlp-pm @TLP_TLIB@"
readonly LIBDIR="@TLP_TLIB@"
readonly LIBS="tlp-functions tlp-rf-func"

# --- Locate and source libraries
for libdir in $LIBDIRS; do [ -d $libdir ] && break; done
[ -d $libdir ] || exit 0

# --- Source libraries
for lib in $LIBS; do
[ -f $libdir/$lib ] || exit 0
. $libdir/$lib
if [ ! -f $LIBDIR/$lib ]; then
echo "Error: missing function library \'$LIBDIR/$lib\'." 1>&2
exit 1
fi
. $LIBDIR/$lib
done

# --- MAIN
Expand Down
16 changes: 5 additions & 11 deletions tlp-run-on.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,16 @@
# This software is licensed under the GPL v2 or later.

# --- Constants
readonly LIBDIRS="/usr/lib/tlp-pm /usr/lib64/tlp-pm @TLP_TLIB@"
readonly LIBDIR="@TLP_TLIB@"
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
exit 1
fi

# --- Source libraries
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
Expand Down
17 changes: 5 additions & 12 deletions tlp-stat.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# --- Constants

readonly LIBDIRS="/usr/lib/tlp-pm /usr/lib64/tlp-pm @TLP_TLIB@"
readonly LIBDIR="@TLP_TLIB@"
readonly LIBS="tlp-functions tlp-rf-func"

readonly TLPUSB=tlp-usblist
Expand Down Expand Up @@ -328,20 +328,13 @@ read_args () { # read command line arguments
done
}

# --- 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
exit 1
fi

# --- Source libraries
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
Expand Down
16 changes: 5 additions & 11 deletions tlp.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,16 @@
# This software is licensed under the GPL v2 or later.

# --- Constants
readonly LIBDIRS="/usr/lib/tlp-pm /usr/lib64/tlp-pm @TLP_TLIB@"
readonly LIBDIR="@TLP_TLIB@"
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
exit 1
fi

# --- Source libraries
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
Expand Down

0 comments on commit 30373b7

Please sign in to comment.