From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 3864 invoked from network); 2 Apr 2021 19:34:40 -0000 Received: from 1ess.inri.net (216.126.196.35) by inbox.vuxu.org with ESMTPUTF8; 2 Apr 2021 19:34:40 -0000 Received: from mail.typed-hole.org ([199.247.9.36]) by 1ess; Fri Apr 2 11:48:21 -0400 2021 Received: from [IPv6:2a01:cb1a:39:f6c:1d55:2dd9:1bad:8c51] ( [2a01:cb1a:39:f6c:1d55:2dd9:1bad:8c51]) by mail.typed-hole.org (OpenSMTPD) with ESMTPSA id e7b94e65 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO) for <9front@9front.org>; Fri, 2 Apr 2021 15:41:32 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Julien Blanchard Mime-Version: 1.0 (1.0) Date: Fri, 2 Apr 2021 17:41:31 +0200 Message-Id: <50E1AC50-8122-4D93-A6D4-92047385C515@typed-hole.org> References: <6A2C69B172AD0333000D35A4618F8FFF@typed-hole.org> In-Reply-To: <6A2C69B172AD0333000D35A4618F8FFF@typed-hole.org> To: 9front@9front.org X-Mailer: iPhone Mail (18D70) List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: session plugin HTML over TOR rails DOM database Subject: Re: [9front] [PATCH] Allow Acme Battery to use ACPI Reply-To: 9front@9front.org Precedence: bulk > Le 11 mars 2021 =C3=A0 17:01, julien@typed-hole.org a =C3=A9crit : >=20 > =EF=BB=BFThis is a multi-part message in MIME format. > --upas-tagxexdttctmbtbirbrxngwnxy > Content-Disposition: inline > Content-Type: text/plain; charset=3D"US-ASCII" > Content-Transfer-Encoding: 7bit >=20 > Hello, > I stubbled upon the content of /acme/bin and noticed this Battery script. I= t uses /mnt/apm. This patch allows it to use apm or acpi. > Hope my rc scripting is not too bad. > Cheers, > Julien >=20 >=20 > --upas-tagxexdttctmbtbirbrxngwnxy > Content-Disposition: attachment; filename=3Dacme_battery.patch > Content-Type: text/plain; charset=3D"US-ASCII" > Content-Transfer-Encoding: 7bit >=20 > diff -r 55df775635f0 acme/bin/Battery > --- a/acme/bin/Battery Wed Mar 10 16:49:17 2021 -0800 > +++ b/acme/bin/Battery Thu Mar 11 15:27:40 2021 +0100 > @@ -1,25 +1,37 @@ > #!/bin/rc >=20 > -if(! test -f /mnt/apm/battery){ > - echo no apm >[1=3D2] > - exit 'no apm' > +pm=3D() > + > +if(test -f /mnt/apm/battery) pm =3D apm > +if(test -f /mnt/acpi/battery) pm =3D acpi > +if not { > + echo no apm or acpi >[1=3D2] > + exit 'no apm or acpi' > } >=20 > cd /mnt/acme/new > -echo name /dev/apm >ctl > +echo name /dev/^$pm >ctl > echo dump Battery >ctl >=20 > -awkscript=3D' > -NR=3D=3D1 { > - if($3 !=3D -1) > - printf("%d%% %d:%02d %s", $2, $3/3600, ($3/60)%60, $1); > - else > - printf("%d%% %s", $2, $1); > +if(~ $pm apm){ > + awkscript=3D' > + NR=3D=3D1 { > + if($3 !=3D -1) > + printf("%d%% %d:%02d %s", $2, $3/3600, ($3/60)%60, $1); > + else > + printf("%d%% %s", $2, $1); > + }' > } > -' > + > +if(~ $pm acpi){ > + awkscript=3D' > + NR=3D=3D1 { > + printf("%d%% %s", $1, $11); > + }' > +} >=20 > fn chk { > - what=3D`{awk $awkscript /mnt/apm/battery} > + what=3D`{awk $awkscript /mnt/^$pm/battery} > echo cleartag >ctl || exit die > echo clean >ctl || exit die > echo ' '^$"what >tag || exit die > --upas-tagxexdttctmbtbirbrxngwnxy-- Hello I have this patch waiting eventually. =E2=80=94 julienxx=