From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QXZ5V-0002Yd-9S for garchives@archives.gentoo.org; Fri, 17 Jun 2011 13:27:53 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 65A151C038; Fri, 17 Jun 2011 13:27:45 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 1E67D1C038 for ; Fri, 17 Jun 2011 13:27:45 +0000 (UTC) Received: from flycatcher.gentoo.org (flycatcher.gentoo.org [81.93.255.6]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 2C59B1BC015 for ; Fri, 17 Jun 2011 13:27:44 +0000 (UTC) Received: by flycatcher.gentoo.org (Postfix, from userid 2230) id CA40820054; Fri, 17 Jun 2011 13:27:42 +0000 (UTC) From: "Tomas Chvatal (scarabeus)" To: gentoo-commits@lists.gentoo.org Reply-To: gentoo-dev@lists.gentoo.org, scarabeus@gentoo.org Subject: [gentoo-commits] gentoo-x86 commit in app-laptop/tp_smapi/files: tp_smapi-0.40-initd thinkpad_ec_semaphore.patch X-VCS-Repository: gentoo-x86 X-VCS-Files: tp_smapi-0.40-initd thinkpad_ec_semaphore.patch X-VCS-Directories: app-laptop/tp_smapi/files X-VCS-Committer: scarabeus X-VCS-Committer-Name: Tomas Chvatal Content-Type: text/plain; charset=utf8 Message-Id: <20110617132742.CA40820054@flycatcher.gentoo.org> Date: Fri, 17 Jun 2011 13:27:42 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 8c3e193c74545e4f10d47d2a956f7e1c 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 overshad= owed stuff. =20 (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_smap= i/files/tp_smapi-0.40-initd?rev=3D1.2&view=3Dmarkup plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-laptop/tp_smap= i/files/tp_smapi-0.40-initd?rev=3D1.2&content-type=3Dtext/plain diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-laptop/tp_smap= i/files/tp_smapi-0.40-initd?r1=3D1.1&r2=3D1.2 Index: tp_smapi-0.40-initd =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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 @@ } =20 start() { + local state1 + local state2 + ebegin "Making sure that module 'tp_smapi' is loaded" modprobe tp_smapi - eend $? || return $? + state1=3D$? + eend ${state1} =20 - ebegin "Checking for ${SMAPI_SYSFS}" - test -d ${SMAPI_SYSFS} - eend $? || return $? + ebegin "Checking for \"${SMAPI_SYSFS}\"" + test -d "${SMAPI_SYSFS}" + state2=3D$? + eend ${state2} + + if [ "${state1}" -ne "0" ] || [ "${state1}" -ne "0" ]; then + return 1 + fi =20 ebegin "Starting ${SVCNAME}" set_all ${SMAPI_THRESH_START} ${SMAPI_THRESH_STOP} @@ -28,51 +37,56 @@ } =20 stop() { - ebegin "Stopping ${SVCNAME}" - eend $? + einfo "Nothing required to be done to stop ${SVCNAME}" } =20 require_started() { - service_started && return 0 - - ewarn "WARNING: ${SVCNAME} is not running" - return 1 + if ! service_started; then + "${RC_SERVICE}" start || return $? + fi } =20 high() { - require_started || return $? + require_started =20 - ebegin "Switching ${SVCNAME} to high thesholds" + einfo "Switching ${SVCNAME} to high thesholds" set_all ${SMAPI_HIGH_THRESH_START} ${SMAPI_HIGH_THRESH_STOP} - eend $? } =20 low() { - require_started || return $? + require_started =20 - ebegin "Switching ${SVCNAME} to low thesholds" + einfo "Switching ${SVCNAME} to low thesholds" set_all ${SMAPI_LOW_THRESH_START} ${SMAPI_LOW_THRESH_STOP} - eend $? } =20 set_all() { local tstart=3D$1 local tstop=3D$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 } =20 info() { - require_started || return $? + local presence + local tstart + local tstop + local bat + + require_started =20 for bat in ${BATS}; do - local tstart=3D$( cat ${SMAPI_SYSFS}/${bat}/start_charge_thresh) - local tstop=3D$( cat ${SMAPI_SYSFS}/${bat}/stop_charge_thresh) - local presence=3D$( [[ $(cat ${SMAPI_SYSFS}/${bat}/installed) =3D 1 ]]= && echo ' [installed]') + tstart=3D$(cat ${SMAPI_SYSFS}/${bat}/start_charge_thresh) + tstop=3D$(cat ${SMAPI_SYSFS}/${bat}/stop_charge_thresh) + if [ "$(cat ${SMAPI_SYSFS}/${bat}/installed)" -eq "1" ]; then + presence=3D" [installed]" + fi einfo "${bat}: ${tstart} ${tstop}${presence}" done }