postmarketos-base: configure getty using deviceinfo_getty variable (!771)
On some devices a getty should run on the serial console. Configure the getty by setting the deviceinfo_getty variable. The format is "<port>;<baud rate>". For example, "ttyS0;115200". A post-installation trigger in postmarketos-base checks /etc/deviceinfo, and modifies /etc/inittab if the device should run a getty.
This commit is contained in:
parent
d23549a251
commit
4c67611c90
2 changed files with 42 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
|||
pkgname=postmarketos-base
|
||||
pkgver=3
|
||||
pkgrel=29
|
||||
pkgrel=30
|
||||
pkgdesc="Meta package for minimal postmarketOS base"
|
||||
url="https://postmarketos.org"
|
||||
arch="noarch"
|
||||
|
@ -26,6 +26,7 @@ depends="
|
|||
pulseaudio
|
||||
pulseaudio-alsa"
|
||||
install="$pkgname.post-install"
|
||||
triggers="$pkgname.trigger=/etc"
|
||||
subpackages="$pkgname-x11"
|
||||
source="
|
||||
firmwareload.sh
|
||||
|
|
40
main/postmarketos-base/postmarketos-base.trigger
Normal file
40
main/postmarketos-base/postmarketos-base.trigger
Normal file
|
@ -0,0 +1,40 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
# Each argument to this shell script is a path that caused the trigger to execute.
|
||||
# If /etc/deviceinfo was installed (which should be the case for any device) and
|
||||
# deviceinfo_getty is set, then configure a getty.
|
||||
|
||||
deviceinfo="false"
|
||||
|
||||
for i in "$@"; do
|
||||
case "$i" in
|
||||
/etc)
|
||||
if [ -f /etc/deviceinfo ]; then
|
||||
deviceinfo="true"
|
||||
fi
|
||||
break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$deviceinfo" = "true" ]; then
|
||||
deviceinfo_getty=""
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
. /etc/deviceinfo
|
||||
|
||||
if [ -n "${deviceinfo_getty}" ]; then
|
||||
port=$(echo "${deviceinfo_getty}" | cut -s -d ";" -f 1)
|
||||
baudrate=$(echo "${deviceinfo_getty}" | cut -s -d ";" -f 2)
|
||||
|
||||
if [ -n "${port}" ] && [ -n "${baudrate}" ]; then
|
||||
echo "Configuring a getty on port ${port} with baud rate ${baudrate}"
|
||||
sed -i -e "s/#ttyS0::respawn:\/sbin\/getty -L ttyS0 115200 vt100/${port}::respawn:\/sbin\/getty -L ${port} ${baudrate} vt100/" /etc/inittab
|
||||
else
|
||||
echo "ERROR: Invalid value for deviceinfo_getty: ${deviceinfo_getty}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
sync
|
||||
exit 0
|
Loading…
Reference in a new issue