mirror of
https://github.com/gentoo-mirror/guru.git
synced 2026-07-20 20:43:09 -04:00
sys-boot/osk-sdl: add new package
Package-Manager: Portage-3.0.20, Repoman-3.0.3 Signed-off-by: Marco Scardovi <marco@scardovi.com>
This commit is contained in:
1
sys-boot/osk-sdl/Manifest
Normal file
1
sys-boot/osk-sdl/Manifest
Normal file
@@ -0,0 +1 @@
|
||||
DIST osk-sdl-0.64.tar.gz 37851 BLAKE2B dc297a0b1879f7b64bceb3032275b30f10072c50a2e2ddd985e94136ebf2308819fe71ca831fcc05d413c5e74f8ab955d920cc63bd90529e0c45fd3b6aae44db SHA512 0da985e1e8d0352f53f661dd4f7f6243a8f9b48279297f4ea3b120aa239c733411a83d324b58d152cafd9c2e7a791a36506afec6449e141c6445f0420bb9fd6b
|
||||
29
sys-boot/osk-sdl/files/module-setup.sh
Normal file
29
sys-boot/osk-sdl/files/module-setup.sh
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
echo drm crypt
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_multiple "/etc/osk.conf" \
|
||||
"/usr/share/glvnd/egl_vendor.d/50_mesa.json" \
|
||||
"/usr/share/fonts/dejavu/DejaVuSans.ttf" \
|
||||
osk-sdl
|
||||
inst_simple $moddir/osk-sdl.sh /usr/bin/osk-sdl.sh
|
||||
inst_simple $moddir/osk-sdl-pp.service ${systemdsystemunitdir}/osk-sdl-pp.service
|
||||
inst_simple $moddir/osk-sdl-pp.path ${systemdsystemunitdir}/osk-sdl-pp.path
|
||||
systemctl -q --root "$initdir" add-wants sysinit.target osk-sdl-pp.path
|
||||
# mesa cogl libglvnd
|
||||
equery f mesa cogl libglvnd | grep ".so$" | while read -r so; do
|
||||
inst ${so}
|
||||
done
|
||||
|
||||
}
|
||||
2
sys-boot/osk-sdl/files/osk-sdl-pp.conf
Normal file
2
sys-boot/osk-sdl/files/osk-sdl-pp.conf
Normal file
@@ -0,0 +1,2 @@
|
||||
# dracut config, need osk-sdl for encrypted root, uncomment the following line to enable it in initramfs
|
||||
#add_dracutmodules+=" osk-sdl "
|
||||
21
sys-boot/osk-sdl/files/osk-sdl-pp.path
Normal file
21
sys-boot/osk-sdl/files/osk-sdl-pp.path
Normal file
@@ -0,0 +1,21 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
#
|
||||
# This file is part of systemd.
|
||||
#
|
||||
# systemd is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
[Unit]
|
||||
Description=Run on screen keyboard to unlock root dev path watch
|
||||
DefaultDependencies=no
|
||||
Conflicts=shutdown.target emergency.service
|
||||
Before=systemd-ask-password-console.service systemd-ask-password-plymouth.service systemd-fsck-root.service paths.target shutdown.target
|
||||
|
||||
[Path]
|
||||
PathExists=/dev/null
|
||||
# touch screen
|
||||
#PathExists=/dev/input/by-path/platform-1c2ac00.i2c-event
|
||||
# video
|
||||
PathExists=/dev/dri/renderD128/
|
||||
21
sys-boot/osk-sdl/files/osk-sdl-pp.service
Normal file
21
sys-boot/osk-sdl/files/osk-sdl-pp.service
Normal file
@@ -0,0 +1,21 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
#
|
||||
# This file is part of systemd.
|
||||
#
|
||||
# systemd is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
[Unit]
|
||||
Description=Run on screen keyboard to unlock root
|
||||
DefaultDependencies=no
|
||||
Conflicts=shutdown.target
|
||||
After=systemd-modules-load.service systemd-udevd.service
|
||||
Before=systemd-ask-password-console.service systemd-ask-password-plymouth.service systemd-fsck-root.service
|
||||
ConditionPathExists=!/dev/mapper/root
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/bin/osk-sdl.sh
|
||||
RemainAfterExit=true
|
||||
49
sys-boot/osk-sdl/files/osk-sdl.sh
Executable file
49
sys-boot/osk-sdl/files/osk-sdl.sh
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
# stolen from postmarket
|
||||
# https://gitlab.com/postmarketOS/pmaports/-/blob/master/main/postmarketos-mkinitfs/init_functions.sh
|
||||
find_crypt_partition() {
|
||||
# The partition layout is one of the following:
|
||||
# a) boot, root partitions on sdcard
|
||||
# b) boot, root partition on the "system" partition (which has its
|
||||
# own partition header! so we have partitions on partitions!)
|
||||
#
|
||||
# mount_subpartitions() must get executed before calling
|
||||
# find_root_partition(), so partitions from b) also get found.
|
||||
|
||||
# Short circuit all autodetection logic if pmos_root= is supplied
|
||||
# on the kernel cmdline
|
||||
# shellcheck disable=SC2013
|
||||
for x in $(cat /proc/cmdline); do
|
||||
[ "$x" = "${x#cryptroot=}" ] && continue
|
||||
DEVICE="${x#cryptroot=}"
|
||||
done
|
||||
echo "$DEVICE"
|
||||
}
|
||||
|
||||
setup_directfb_tslib() {
|
||||
# Set up directfb and tslib
|
||||
# Note: linux_input module is disabled since it will try to take over
|
||||
# the touchscreen device from tslib (e.g. on the N900)
|
||||
export SDL_VIDEO_DRIVER="kmsdrm"
|
||||
export SDL_RENDER_DRIVER="software"
|
||||
#export DFBARGS="system=fbdev,no-cursor,disable-module=linux_input"
|
||||
# shellcheck disable=SC2154
|
||||
if [ -n "$deviceinfo_dev_touchscreen" ]; then
|
||||
export TSLIB_TSDEVICE="$deviceinfo_dev_touchscreen"
|
||||
fi
|
||||
}
|
||||
|
||||
start_onscreen_keyboard() {
|
||||
setup_directfb_tslib
|
||||
sleep 1 # wait for dev settle
|
||||
/usr/bin/osk-sdl -n root -d "$partition" -c /etc/osk.conf
|
||||
unset DFBARGS
|
||||
unset TSLIB_TSDEVICE
|
||||
}
|
||||
|
||||
unlock_root_partition() {
|
||||
partition="$(find_crypt_partition)"
|
||||
start_onscreen_keyboard
|
||||
}
|
||||
|
||||
unlock_root_partition
|
||||
8
sys-boot/osk-sdl/metadata.xml
Normal file
8
sys-boot/osk-sdl/metadata.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
|
||||
<pkgmetadata>
|
||||
<maintainer type="person">
|
||||
<email>marco@scardovi.com</email>
|
||||
<name>Marco Scardovi</name>
|
||||
</maintainer>
|
||||
</pkgmetadata>
|
||||
62
sys-boot/osk-sdl/osk-sdl-0.64.ebuild
Normal file
62
sys-boot/osk-sdl/osk-sdl-0.64.ebuild
Normal file
@@ -0,0 +1,62 @@
|
||||
# Copyright 1999-2021 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=7
|
||||
|
||||
inherit meson
|
||||
|
||||
COMMIT="69fb2d943a8664d5a587c967ac828f9ed5acd7ce"
|
||||
|
||||
DESCRIPTION="Lightweight On-Screen-Keyboard based on SDL2"
|
||||
HOMEPAGE="https://gitlab.com/postmarketOS/osk-sdl"
|
||||
SRC_URI="https://gitlab.com/postmarketOS/osk-sdl/-/archive/${COMMIT}.tar.gz -> ${P}.tar.gz"
|
||||
|
||||
LICENSE="GPL-3"
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64 ~arm64"
|
||||
IUSE="test"
|
||||
RESTRICT="!test? ( test )"
|
||||
|
||||
RDEPEND="
|
||||
app-portage/gentoolkit
|
||||
media-libs/cogl
|
||||
media-fonts/dejavu
|
||||
media-libs/libglvnd
|
||||
media-libs/libsdl2[kms,haptic]
|
||||
media-libs/mesa
|
||||
media-libs/sdl2-ttf
|
||||
sys-fs/cryptsetup
|
||||
sys-kernel/dracut
|
||||
"
|
||||
|
||||
BDEPEND="
|
||||
app-text/scdoc
|
||||
test? ( x11-misc/xvfb-run )
|
||||
"
|
||||
|
||||
S="${WORKDIR}/${PN}-${COMMIT}"
|
||||
|
||||
src_prepare() {
|
||||
default
|
||||
sed -e s/ttf-dejavu/dejavu/ -i osk.conf || die "Failed to sed"
|
||||
}
|
||||
|
||||
src_install() {
|
||||
meson_src_install
|
||||
insinto /etc
|
||||
doins osk.conf
|
||||
insinto /etc/dracut.conf.d/
|
||||
doins "${FILESDIR}"/osk-sdl-pp.conf
|
||||
insinto /usr/lib/dracut/modules.d/50osk-sdl
|
||||
doins "${FILESDIR}"/osk-sdl-pp.path
|
||||
doins "${FILESDIR}"/osk-sdl-pp.service
|
||||
exeinto /usr/lib/dracut/modules.d/50osk-sdl
|
||||
doexe "${FILESDIR}"/module-setup.sh
|
||||
doexe "${FILESDIR}"/osk-sdl.sh
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
einfo "For more info on how to test osk-sdl, and how to report problems, see: ${HOMEPAGE}"
|
||||
einfo "To use osk-sdl to unlock encrypted root at bootime, check osk-sdl-pp.conf in /etc/dracut.conf.d"
|
||||
einfo "and add these boot option 'root=/dev/mapper/root cryptroot=/dev/path/to/encrypted_partition' "
|
||||
}
|
||||
Reference in New Issue
Block a user