* [gentoo-commits] gentoo-x86 commit in app-laptop/tp_smapi/files: tp_smapi-0.40-initd thinkpad_ec_semaphore.patch
@ 2011-06-17 13:27 Tomas Chvatal (scarabeus)
0 siblings, 0 replies; only message in thread
From: Tomas Chvatal (scarabeus) @ 2011-06-17 13:27 UTC (permalink / raw
To: gentoo-commits
scarabeus 11/06/17 13:27:42
Modified: tp_smapi-0.40-initd
Removed: thinkpad_ec_semaphore.patch
Log:
Revision bump to migrate intiscripts from bashisms. Punt older overshadowed stuff.
(Portage version: 2.2.0_alpha38/cvs/Linux x86_64)
Revision Changes Path
1.2 app-laptop/tp_smapi/files/tp_smapi-0.40-initd
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-laptop/tp_smapi/files/tp_smapi-0.40-initd?rev=1.2&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-laptop/tp_smapi/files/tp_smapi-0.40-initd?rev=1.2&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-laptop/tp_smapi/files/tp_smapi-0.40-initd?r1=1.1&r2=1.2
Index: tp_smapi-0.40-initd
===================================================================
RCS file: /var/cvsroot/gentoo-x86/app-laptop/tp_smapi/files/tp_smapi-0.40-initd,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- tp_smapi-0.40-initd 14 Jun 2011 15:31:20 -0000 1.1
+++ tp_smapi-0.40-initd 17 Jun 2011 13:27:42 -0000 1.2
@@ -14,13 +14,22 @@
}
start() {
+ local state1
+ local state2
+
ebegin "Making sure that module 'tp_smapi' is loaded"
modprobe tp_smapi
- eend $? || return $?
+ state1=$?
+ eend ${state1}
- ebegin "Checking for ${SMAPI_SYSFS}"
- test -d ${SMAPI_SYSFS}
- eend $? || return $?
+ ebegin "Checking for \"${SMAPI_SYSFS}\""
+ test -d "${SMAPI_SYSFS}"
+ state2=$?
+ eend ${state2}
+
+ if [ "${state1}" -ne "0" ] || [ "${state1}" -ne "0" ]; then
+ return 1
+ fi
ebegin "Starting ${SVCNAME}"
set_all ${SMAPI_THRESH_START} ${SMAPI_THRESH_STOP}
@@ -28,51 +37,56 @@
}
stop() {
- ebegin "Stopping ${SVCNAME}"
- eend $?
+ einfo "Nothing required to be done to stop ${SVCNAME}"
}
require_started() {
- service_started && return 0
-
- ewarn "WARNING: ${SVCNAME} is not running"
- return 1
+ if ! service_started; then
+ "${RC_SERVICE}" start || return $?
+ fi
}
high() {
- require_started || return $?
+ require_started
- ebegin "Switching ${SVCNAME} to high thesholds"
+ einfo "Switching ${SVCNAME} to high thesholds"
set_all ${SMAPI_HIGH_THRESH_START} ${SMAPI_HIGH_THRESH_STOP}
- eend $?
}
low() {
- require_started || return $?
+ require_started
- ebegin "Switching ${SVCNAME} to low thesholds"
+ einfo "Switching ${SVCNAME} to low thesholds"
set_all ${SMAPI_LOW_THRESH_START} ${SMAPI_LOW_THRESH_STOP}
- eend $?
}
set_all() {
local tstart=$1
local tstop=$2
+ local bat
+
for bat in ${BATS}; do
ebegin " setting thresholds for ${bat}: $tstart $tstop"
- echo $tstart > ${SMAPI_SYSFS}/${bat}/start_charge_thresh && \
- echo $tstop > ${SMAPI_SYSFS}/${bat}/stop_charge_thresh
+ echo ${tstart} > ${SMAPI_SYSFS}/${bat}/start_charge_thresh
+ echo ${tstop} > ${SMAPI_SYSFS}/${bat}/stop_charge_thresh
eend $?
done
}
info() {
- require_started || return $?
+ local presence
+ local tstart
+ local tstop
+ local bat
+
+ require_started
for bat in ${BATS}; do
- local tstart=$( cat ${SMAPI_SYSFS}/${bat}/start_charge_thresh)
- local tstop=$( cat ${SMAPI_SYSFS}/${bat}/stop_charge_thresh)
- local presence=$( [[ $(cat ${SMAPI_SYSFS}/${bat}/installed) = 1 ]] && echo ' [installed]')
+ tstart=$(cat ${SMAPI_SYSFS}/${bat}/start_charge_thresh)
+ tstop=$(cat ${SMAPI_SYSFS}/${bat}/stop_charge_thresh)
+ if [ "$(cat ${SMAPI_SYSFS}/${bat}/installed)" -eq "1" ]; then
+ presence=" [installed]"
+ fi
einfo "${bat}: ${tstart} ${tstop}${presence}"
done
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-06-17 13:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-17 13:27 [gentoo-commits] gentoo-x86 commit in app-laptop/tp_smapi/files: tp_smapi-0.40-initd thinkpad_ec_semaphore.patch Tomas Chvatal (scarabeus)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox