pmaports/main/postmarketos-ui-weston/postmarketos-ui-weston.post-install
Pablo Castellano 114fdc0a68 Close #709: Improve user creation (#725)
* Allow to specify a custom username in "pmbootstrap init"
* Build chroots have "pmos" instead of "user" as username now
* Installation user UID is 1000 now (as in all other Linux distributions)
* Adjust autologins
* postmarketos-base: enable wheel group for sudo, removed previous sudoers file
* Implement safe upgrade path:
We save the version of the work folder format now, in $WORK/version.
When this file does not exist, it defaults to 0.
In case it does not match the currently required version
(pmb.config.work_version), then ask the user if it should
automatically be upgraded.
2017-10-12 20:08:10 +00:00

53 lines
1.8 KiB
Bash

#!/bin/sh
. /etc/deviceinfo
# This section generates weston.ini with options from /etc/deviceinfo (if present)
weston_config="/etc/xdg/weston/weston.ini"
mkdir -p /etc/xdg/weston
# If weston.ini exists, no modifications to it will be made
if [ ! -f $weston_config ]; then
### [Core]
echo "[core]" >> $weston_config
# modules
# Note: Default to loading NO modules if none specified
if [ -n "$deviceinfo_weston_core_modules" ]; then
echo "modules=$deviceinfo_weston_core_modules" >> $weston_config
fi
# backend
if [ -n "$deviceinfo_weston_core_backend" ]; then
echo "backend=$deviceinfo_weston_core_backend" >> $weston_config
else
# Default backend for PMOS, if none specified
echo "backend=fbdev-backend.so" >> $weston_config
fi
### [Keyboard]
echo "[keyboard]" >> $weston_config
# keymap_rules
if [ -n "$deviceinfo_weston_keymap_rules" ]; then
echo "keymap_rules=$deviceinfo_weston_keymap_rules" >> $weston_config
fi
# keymap_model
if [ -n "$deviceinfo_weston_keymap_model" ]; then
echo "keymap_model=$deviceinfo_weston_keymap_model" >> $weston_config
fi
fi
# Autologin on tty1, let busybox autoconfigure 2-6
autologin="$(getent passwd 1000 | 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
# Create weston-launch group and add user to it
[ $(getent group weston-launch) ] || groupadd weston-launch
username="$(getent passwd 1000 | cut -d ":" -f 1)"
usermod -a -G weston-launch "$username"