summaryrefslogtreecommitdiff
path: root/src/pm-powersave
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2007-12-29 11:58:18 +0000
committerRichard Hughes <richard@hughsie.com>2007-12-29 11:58:18 +0000
commita1e346dd88820b75f0e8d28f3c9ffb9b3604e4cf (patch)
tree3b6672936e1ab6c7bb519c61cdb66be78355a968 /src/pm-powersave
parentd2d72cb5c174e0873530773a1e371c2310809c6b (diff)
2007-12-29 Richard Hughes <richard@hughsie.com>
* pm/functions: * src/pm-powersave: Red Hat Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=302401 (Issue 2 in the bug report) Without the uniq files in the sleep.d or power.d directory may run twice. Also this patch removes a uneccessary -e test in the if statements, the -x test already includes a -e test. Also this patch adds a modeline for vim no to expand tabs, because tabs are used in the files for indentation. From Till Maas <opensource@till.name>, many thanks.
Diffstat (limited to 'src/pm-powersave')
-rwxr-xr-xsrc/pm-powersave10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/pm-powersave b/src/pm-powersave
index 93841ae..65d24f5 100755
--- a/src/pm-powersave
+++ b/src/pm-powersave
@@ -1,5 +1,5 @@
#!/bin/bash
-#
+# vim:noexpandtab
# Simple powersave script
#
# Copyright 2006 Red Hat, Inc.
@@ -31,12 +31,10 @@ shopt -s nullglob
find_powerd_files()
{
flist="/etc/pm/power.d/*[^~] /usr/lib/pm-utils/power.d/*[^~]"
- bases=$(for file in $flist ; do echo $(basename $file) ; done | sort -n)
+ bases=$(for file in $flist ; do echo $(basename $file) ; done | sort -n | uniq)
for base in $bases ; do
- if [ -e "/etc/pm/power.d/$base" ]; then
- if [ -x "/etc/pm/power.d/$base" ]; then
- echo /etc/pm/power.d/$base
- fi
+ if [ -x "/etc/pm/power.d/$base" ]; then
+ echo /etc/pm/power.d/$base
elif [ -x "/usr/lib/pm-utils/power.d/$base" ]; then
echo /usr/lib/pm-utils/power.d/$base
fi