pmaports/postmarketos-base/postmarketos-base.post-install

90 lines
2.8 KiB
Text
Raw Normal View History

#!/bin/sh
. /etc/deviceinfo
# Enable OpenRC services
for service in devfs dmesg; do
rc-update -q add $service sysinit
done
for service in hwclock modules sysctl hostname bootmisc wpa_supplicant wifi-handler; do
rc-update -q add $service boot
done
for service in haveged sshd udev; do
rc-update -q add $service default
done
for service in mount-ro killprocs savecache; do
rc-update -q add $service shutdown
done
# Add user account
adduser -u 1000 -D -h /home/user -G users user 2>/dev/null
2017-06-03 20:13:22 +00:00
# Autologin on tty1, let busybox autoconfigure 2-6
autologin="root"
2017-06-03 20:13:22 +00:00
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
# Adjust welcome messages /etc (unless the files have been modified)
if ! apk audit /etc | grep -q etc/issue; then
{
echo 'Welcome to postmarketOS'
echo 'Kernel \r on an \m (\l)'
} >/etc/issue
fi
if ! apk audit /etc | grep -q etc/motd; then
{
echo 'Welcome to postmarketOS!'
echo ''
echo 'This distribution is based on Alpine Linux.'
echo 'Read both our wikis to find a large amount of how-to guides and'
echo 'general information about administrating and development.'
echo 'See <https://postmarketos.org/wiki> and <https://wiki.alpinelinux.org>.'
echo ''
echo 'You may change this message by editing /etc/motd.'
echo ''
} >/etc/motd
fi
# This section generates weston.ini with options from /etc/deviceinfo (if present)
# This functionality is a strong candidate for belonging in another package (e.g. weston), but
# since postmarketos-base owns weston.ini, this will have to do for now.
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