diff --git a/main/postmarketos-boot-hwtest/APKBUILD b/main/postmarketos-boot-hwtest/APKBUILD new file mode 100644 index 000000000..adb4dfd56 --- /dev/null +++ b/main/postmarketos-boot-hwtest/APKBUILD @@ -0,0 +1,20 @@ +# Contributor: Martijn Braam +pkgname=postmarketos-boot-hwtest +pkgver=0.1 +pkgrel=0 +pkgdesc="Boot into a TTY running hwtest" +url="https://gitlab.com/MartijnBraam/hwtest" +arch="all" +license="MIT" +depends="hwtest ofono dbus-x11" +install="$pkgname.post-install" +source="launch_hwtest.sh" +options="!check" + +package() { + mkdir -p $pkgdir + install -D -m755 "$srcdir"/launch_hwtest.sh \ + "$pkgdir"/etc/profile.d/99-hwtest.sh +} + +sha512sums="2fca42f44918af02ee706e84d00c876630b53605c13daf4c79b097a3ae1d7b323ff658964516c0c9bd098d6c61bebaba0e95e48e416490959f75fa88b7fc943e launch_hwtest.sh" diff --git a/main/postmarketos-boot-hwtest/launch_hwtest.sh b/main/postmarketos-boot-hwtest/launch_hwtest.sh new file mode 100644 index 000000000..541ebca98 --- /dev/null +++ b/main/postmarketos-boot-hwtest/launch_hwtest.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +if [ "$(id -u)" = "10000" ] && [ $(tty) = "/dev/tty1" ]; then + if [ -f /usr/share/hwtest.ini ]; then + dbus-launch hwtest --verify /usr/share/hwtest.ini --export ~/hwtest.ini --formatter ColoredTTY + else + dbus-launch hwtest --formatter ColoredTTY --export ~/hwtest.ini + fi +fi diff --git a/main/postmarketos-boot-hwtest/postmarketos-boot-hwtest.post-install b/main/postmarketos-boot-hwtest/postmarketos-boot-hwtest.post-install new file mode 100644 index 000000000..2b0c30853 --- /dev/null +++ b/main/postmarketos-boot-hwtest/postmarketos-boot-hwtest.post-install @@ -0,0 +1,13 @@ +#!/bin/sh + +# Enable ofono +rc-update add ofono default + +# Autologin on tty1, let busybox autoconfigure 2-6 +autologin="$(getent passwd 10000 | cut -d ":" -f 1)" +for i in 1 2 3 4 5 6; do + old="^tty$i::respawn:/sbin/getty 38400 tty$i" + new="# tty$i::respawn:/sbin/getty 38400 tty$i" + [ "$i" == "1" ] && new="tty1::respawn:/bin/login -f $autologin" + sed -i -e "s.$old.$new.g" /etc/inittab +done