Gentoo Archives: gentoo-commits

From: Haelwenn Monnier <contact@×××××××××.me>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/guru:master commit in: sys-boot/osk-sdl/files/, sys-boot/osk-sdl/
Date: Sat, 26 Jun 2021 10:53:40
Message-Id: 1624647876.489930e0c504439316323b1e20abe3244c9ad9b7.lanodan@gentoo
1 commit: 489930e0c504439316323b1e20abe3244c9ad9b7
2 Author: Marco Scardovi <marco <AT> scardovi <DOT> com>
3 AuthorDate: Fri Jun 25 19:04:36 2021 +0000
4 Commit: Haelwenn Monnier <contact <AT> hacktivis <DOT> me>
5 CommitDate: Fri Jun 25 19:04:36 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=489930e0
7
8 sys-boot/osk-sdl: add new package
9
10 Package-Manager: Portage-3.0.20, Repoman-3.0.3
11 Signed-off-by: Marco Scardovi <marco <AT> scardovi.com>
12
13 sys-boot/osk-sdl/Manifest | 1 +
14 sys-boot/osk-sdl/files/module-setup.sh | 29 +++++++++++++++
15 sys-boot/osk-sdl/files/osk-sdl-pp.conf | 2 +
16 sys-boot/osk-sdl/files/osk-sdl-pp.path | 21 +++++++++++
17 sys-boot/osk-sdl/files/osk-sdl-pp.service | 21 +++++++++++
18 sys-boot/osk-sdl/files/osk-sdl.sh | 49 ++++++++++++++++++++++++
19 sys-boot/osk-sdl/metadata.xml | 8 ++++
20 sys-boot/osk-sdl/osk-sdl-0.64.ebuild | 62 +++++++++++++++++++++++++++++++
21 8 files changed, 193 insertions(+)
22
23 diff --git a/sys-boot/osk-sdl/Manifest b/sys-boot/osk-sdl/Manifest
24 new file mode 100644
25 index 000000000..907091802
26 --- /dev/null
27 +++ b/sys-boot/osk-sdl/Manifest
28 @@ -0,0 +1 @@
29 +DIST osk-sdl-0.64.tar.gz 37851 BLAKE2B dc297a0b1879f7b64bceb3032275b30f10072c50a2e2ddd985e94136ebf2308819fe71ca831fcc05d413c5e74f8ab955d920cc63bd90529e0c45fd3b6aae44db SHA512 0da985e1e8d0352f53f661dd4f7f6243a8f9b48279297f4ea3b120aa239c733411a83d324b58d152cafd9c2e7a791a36506afec6449e141c6445f0420bb9fd6b
30
31 diff --git a/sys-boot/osk-sdl/files/module-setup.sh b/sys-boot/osk-sdl/files/module-setup.sh
32 new file mode 100644
33 index 000000000..f27d34582
34 --- /dev/null
35 +++ b/sys-boot/osk-sdl/files/module-setup.sh
36 @@ -0,0 +1,29 @@
37 +#!/bin/bash
38 +
39 +# called by dracut
40 +check() {
41 + return 0
42 +}
43 +
44 +# called by dracut
45 +depends() {
46 + echo drm crypt
47 + return 0
48 +}
49 +
50 +# called by dracut
51 +install() {
52 + inst_multiple "/etc/osk.conf" \
53 + "/usr/share/glvnd/egl_vendor.d/50_mesa.json" \
54 + "/usr/share/fonts/dejavu/DejaVuSans.ttf" \
55 + osk-sdl
56 + inst_simple $moddir/osk-sdl.sh /usr/bin/osk-sdl.sh
57 + inst_simple $moddir/osk-sdl-pp.service ${systemdsystemunitdir}/osk-sdl-pp.service
58 + inst_simple $moddir/osk-sdl-pp.path ${systemdsystemunitdir}/osk-sdl-pp.path
59 + systemctl -q --root "$initdir" add-wants sysinit.target osk-sdl-pp.path
60 + # mesa cogl libglvnd
61 + equery f mesa cogl libglvnd | grep ".so$" | while read -r so; do
62 + inst ${so}
63 + done
64 +
65 +}
66
67 diff --git a/sys-boot/osk-sdl/files/osk-sdl-pp.conf b/sys-boot/osk-sdl/files/osk-sdl-pp.conf
68 new file mode 100644
69 index 000000000..bc5ec8bf0
70 --- /dev/null
71 +++ b/sys-boot/osk-sdl/files/osk-sdl-pp.conf
72 @@ -0,0 +1,2 @@
73 +# dracut config, need osk-sdl for encrypted root, uncomment the following line to enable it in initramfs
74 +#add_dracutmodules+=" osk-sdl "
75
76 diff --git a/sys-boot/osk-sdl/files/osk-sdl-pp.path b/sys-boot/osk-sdl/files/osk-sdl-pp.path
77 new file mode 100644
78 index 000000000..5a386bdaf
79 --- /dev/null
80 +++ b/sys-boot/osk-sdl/files/osk-sdl-pp.path
81 @@ -0,0 +1,21 @@
82 +# SPDX-License-Identifier: LGPL-2.1-or-later
83 +#
84 +# This file is part of systemd.
85 +#
86 +# systemd is free software; you can redistribute it and/or modify it
87 +# under the terms of the GNU Lesser General Public License as published by
88 +# the Free Software Foundation; either version 2.1 of the License, or
89 +# (at your option) any later version.
90 +
91 +[Unit]
92 +Description=Run on screen keyboard to unlock root dev path watch
93 +DefaultDependencies=no
94 +Conflicts=shutdown.target emergency.service
95 +Before=systemd-ask-password-console.service systemd-ask-password-plymouth.service systemd-fsck-root.service paths.target shutdown.target
96 +
97 +[Path]
98 +PathExists=/dev/null
99 +# touch screen
100 +#PathExists=/dev/input/by-path/platform-1c2ac00.i2c-event
101 +# video
102 +PathExists=/dev/dri/renderD128/
103
104 diff --git a/sys-boot/osk-sdl/files/osk-sdl-pp.service b/sys-boot/osk-sdl/files/osk-sdl-pp.service
105 new file mode 100644
106 index 000000000..e5445b7cc
107 --- /dev/null
108 +++ b/sys-boot/osk-sdl/files/osk-sdl-pp.service
109 @@ -0,0 +1,21 @@
110 +# SPDX-License-Identifier: LGPL-2.1-or-later
111 +#
112 +# This file is part of systemd.
113 +#
114 +# systemd is free software; you can redistribute it and/or modify it
115 +# under the terms of the GNU Lesser General Public License as published by
116 +# the Free Software Foundation; either version 2.1 of the License, or
117 +# (at your option) any later version.
118 +
119 +[Unit]
120 +Description=Run on screen keyboard to unlock root
121 +DefaultDependencies=no
122 +Conflicts=shutdown.target
123 +After=systemd-modules-load.service systemd-udevd.service
124 +Before=systemd-ask-password-console.service systemd-ask-password-plymouth.service systemd-fsck-root.service
125 +ConditionPathExists=!/dev/mapper/root
126 +
127 +[Service]
128 +Type=oneshot
129 +ExecStart=/usr/bin/osk-sdl.sh
130 +RemainAfterExit=true
131
132 diff --git a/sys-boot/osk-sdl/files/osk-sdl.sh b/sys-boot/osk-sdl/files/osk-sdl.sh
133 new file mode 100755
134 index 000000000..36cba93e8
135 --- /dev/null
136 +++ b/sys-boot/osk-sdl/files/osk-sdl.sh
137 @@ -0,0 +1,49 @@
138 +#!/bin/bash
139 +# stolen from postmarket
140 +# https://gitlab.com/postmarketOS/pmaports/-/blob/master/main/postmarketos-mkinitfs/init_functions.sh
141 +find_crypt_partition() {
142 + # The partition layout is one of the following:
143 + # a) boot, root partitions on sdcard
144 + # b) boot, root partition on the "system" partition (which has its
145 + # own partition header! so we have partitions on partitions!)
146 + #
147 + # mount_subpartitions() must get executed before calling
148 + # find_root_partition(), so partitions from b) also get found.
149 +
150 + # Short circuit all autodetection logic if pmos_root= is supplied
151 + # on the kernel cmdline
152 + # shellcheck disable=SC2013
153 + for x in $(cat /proc/cmdline); do
154 + [ "$x" = "${x#cryptroot=}" ] && continue
155 + DEVICE="${x#cryptroot=}"
156 + done
157 + echo "$DEVICE"
158 +}
159 +
160 +setup_directfb_tslib() {
161 + # Set up directfb and tslib
162 + # Note: linux_input module is disabled since it will try to take over
163 + # the touchscreen device from tslib (e.g. on the N900)
164 + export SDL_VIDEO_DRIVER="kmsdrm"
165 + export SDL_RENDER_DRIVER="software"
166 + #export DFBARGS="system=fbdev,no-cursor,disable-module=linux_input"
167 + # shellcheck disable=SC2154
168 + if [ -n "$deviceinfo_dev_touchscreen" ]; then
169 + export TSLIB_TSDEVICE="$deviceinfo_dev_touchscreen"
170 + fi
171 +}
172 +
173 +start_onscreen_keyboard() {
174 + setup_directfb_tslib
175 + sleep 1 # wait for dev settle
176 + /usr/bin/osk-sdl -n root -d "$partition" -c /etc/osk.conf
177 + unset DFBARGS
178 + unset TSLIB_TSDEVICE
179 +}
180 +
181 +unlock_root_partition() {
182 + partition="$(find_crypt_partition)"
183 + start_onscreen_keyboard
184 +}
185 +
186 +unlock_root_partition
187
188 diff --git a/sys-boot/osk-sdl/metadata.xml b/sys-boot/osk-sdl/metadata.xml
189 new file mode 100644
190 index 000000000..144c8091c
191 --- /dev/null
192 +++ b/sys-boot/osk-sdl/metadata.xml
193 @@ -0,0 +1,8 @@
194 +<?xml version='1.0' encoding='UTF-8'?>
195 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
196 +<pkgmetadata>
197 + <maintainer type="person">
198 + <email>marco@××××××××.com</email>
199 + <name>Marco Scardovi</name>
200 + </maintainer>
201 +</pkgmetadata>
202
203 diff --git a/sys-boot/osk-sdl/osk-sdl-0.64.ebuild b/sys-boot/osk-sdl/osk-sdl-0.64.ebuild
204 new file mode 100644
205 index 000000000..1f8daa085
206 --- /dev/null
207 +++ b/sys-boot/osk-sdl/osk-sdl-0.64.ebuild
208 @@ -0,0 +1,62 @@
209 +# Copyright 1999-2021 Gentoo Authors
210 +# Distributed under the terms of the GNU General Public License v2
211 +
212 +EAPI=7
213 +
214 +inherit meson
215 +
216 +COMMIT="69fb2d943a8664d5a587c967ac828f9ed5acd7ce"
217 +
218 +DESCRIPTION="Lightweight On-Screen-Keyboard based on SDL2"
219 +HOMEPAGE="https://gitlab.com/postmarketOS/osk-sdl"
220 +SRC_URI="https://gitlab.com/postmarketOS/osk-sdl/-/archive/${COMMIT}.tar.gz -> ${P}.tar.gz"
221 +
222 +LICENSE="GPL-3"
223 +SLOT="0"
224 +KEYWORDS="~amd64 ~arm64"
225 +IUSE="test"
226 +RESTRICT="!test? ( test )"
227 +
228 +RDEPEND="
229 + app-portage/gentoolkit
230 + media-libs/cogl
231 + media-fonts/dejavu
232 + media-libs/libglvnd
233 + media-libs/libsdl2[kms,haptic]
234 + media-libs/mesa
235 + media-libs/sdl2-ttf
236 + sys-fs/cryptsetup
237 + sys-kernel/dracut
238 +"
239 +
240 +BDEPEND="
241 + app-text/scdoc
242 + test? ( x11-misc/xvfb-run )
243 +"
244 +
245 +S="${WORKDIR}/${PN}-${COMMIT}"
246 +
247 +src_prepare() {
248 + default
249 + sed -e s/ttf-dejavu/dejavu/ -i osk.conf || die "Failed to sed"
250 +}
251 +
252 +src_install() {
253 + meson_src_install
254 + insinto /etc
255 + doins osk.conf
256 + insinto /etc/dracut.conf.d/
257 + doins "${FILESDIR}"/osk-sdl-pp.conf
258 + insinto /usr/lib/dracut/modules.d/50osk-sdl
259 + doins "${FILESDIR}"/osk-sdl-pp.path
260 + doins "${FILESDIR}"/osk-sdl-pp.service
261 + exeinto /usr/lib/dracut/modules.d/50osk-sdl
262 + doexe "${FILESDIR}"/module-setup.sh
263 + doexe "${FILESDIR}"/osk-sdl.sh
264 +}
265 +
266 +pkg_postinst() {
267 + einfo "For more info on how to test osk-sdl, and how to report problems, see: ${HOMEPAGE}"
268 + einfo "To use osk-sdl to unlock encrypted root at bootime, check osk-sdl-pp.conf in /etc/dracut.conf.d"
269 + einfo "and add these boot option 'root=/dev/mapper/root cryptroot=/dev/path/to/encrypted_partition' "
270 +}