devicepkg-dev: fix call to dc (MR 4959)

The current invocation doesn't work:

  $ busybox dc "100" "5" / p
  dc: can't open '100': No such file or directory

Fix it so that it does:

  $ busybox dc -e "100 5 / p"
  20

One of the messages that is printed on failure was missing
the "WARNING:" prefix. Address that too.

Signed-off-by: Andrea Bolognani <eof@kiyuko.org>
This commit is contained in:
Andrea Bolognani 2024-03-21 14:08:24 +01:00 committed by Alexey Minnekhanov
parent 74cec4794b
commit 9200f8fe1a
No known key found for this signature in database
GPG key ID: 6FE3B029D9D9FAFF
2 changed files with 5 additions and 5 deletions

View file

@ -1,6 +1,6 @@
pkgname=devicepkg-dev
pkgver=0.18.0
pkgrel=0
pkgrel=1
pkgdesc="Provides default device package functions"
url="https://postmarketos.org"
arch="noarch"
@ -76,7 +76,7 @@ package() {
}
sha512sums="
d69930dd790b00fb39760a37d95a10899f0d167e10e2804feb05d9ce04f94185dc32d36edc90214aba2ea2aa09bf18f7dab93f1d2eff23f67beb2cc83be30e7c compiler-gcc.h
faba89519197a9bccba3049a031f11b22f5c8b1b87b5278cb4daaa9d73f5946394643f9a59f76eb120618e6fe8df08b80879eca12b76a24ce03b1c9c7db65528 devicepkg_build.sh
a483a970f6cf3e1f2724d8ec1039c2a935cc3e75efd016b3f134cef8a6e53820428bff0f1cb2bcfbd8ccda33c69fdb250be1cf061b2dc53c6063d2ab49023f97 devicepkg_build.sh
5b83255dabd2019ea07a589d185bee5dad6760e28ab02de3480a0adfd1cf20d0c2e0b4a978e56757899ef683819091cee99d168a48e24a3f604b725e1ba26849 devicepkg_package.sh
3b997a00e76be7d4540290275585026c5b83832c0b9a7214346763f03ec196b3f1bea9f50a9928a5cab0bc22dc557af136ffe146bd45d3666b5c05589891047d devicepkg_pmtest_post_install.sh
f81e74e45ae8e55686ae459f550e229e7398daeafa72bd023c2d8c3a0d50e60bf53d5bbdfec931e9fbabe1cd71de57b2192805aaef091ab90bc7203cbaf66ba6 downstreamkernel_prepare.sh

View file

@ -50,14 +50,14 @@ echo_libinput_calibration()
# As the "dc" command from "bc" is incompatible to the one provided by busybox,
# this calls busybox explicitly.
# shellcheck disable=SC2154
x_offset=$(busybox dc "$3" "$deviceinfo_screen_width" / p)
x_offset=$(busybox dc -e "$3 $deviceinfo_screen_width / p")
# shellcheck disable=SC2154
y_offset=$(busybox dc "$6" "$deviceinfo_screen_height" / p)
y_offset=$(busybox dc -e "$6 $deviceinfo_screen_height / p")
# Check if we have got results from dc. If there was an error, dc should have
# printed an error message that hopefully gives the user a hint why it failed.
if [ -z "$x_offset" ] || [ -z "$y_offset" ]; then
echo "WARNING: Calculating the offsets for the calibration matrix for x11/libinput failed." >&2
echo "No calibration matrix for x11/libinput will be generated." >&2
echo "WARNING: No calibration matrix for x11/libinput will be generated." >&2
return
fi