6d25c1bef6
When util-linux v2.32 updated v2.33, remounting a partition stopped working. mount -n -o remount,rw / mount: /: can't find LABEL="pmOS_root". This service will add the pmOS rootfs partitions to device mapper so that the remount root partition will succeed. Fixes issue #156
82 lines
2.6 KiB
Bash
82 lines
2.6 KiB
Bash
#!/bin/sh
|
|
|
|
# Enable udev OpenRC services and runlevels
|
|
# https://github.com/alpinelinux/aports/blob/master/main/eudev/setup-udev
|
|
setup-udev -n
|
|
|
|
# Enable other OpenRC services
|
|
for service in devfs dmesg devmappings; do
|
|
rc-update -q add $service sysinit
|
|
done
|
|
for service in hwclock modules sysctl hostname bootmisc swclock syslog; do
|
|
rc-update -q add $service boot
|
|
done
|
|
for service in dbus haveged sshd swapfile wpa_supplicant chronyd local networkmanager; do
|
|
rc-update -q add $service default
|
|
done
|
|
for service in mount-ro killprocs savecache; do
|
|
rc-update -q add $service shutdown
|
|
done
|
|
|
|
# Prime swclock with a reasonable date/time on first boot
|
|
mkdir -p /run/openrc
|
|
touch /run/openrc/shutdowntime
|
|
|
|
write_unless_modified() {
|
|
# Redirect the stdin to the file unless it has been modified
|
|
# $1: file path
|
|
if ! apk audit "$(dirname "$1")" | grep -q "${1:1}"; then
|
|
cat > "$1"
|
|
fi
|
|
}
|
|
|
|
# Install /etc/fstab
|
|
{
|
|
echo '# <file system> <mount point> <type> <options> <dump> <pass>'
|
|
echo 'LABEL="pmOS_root" / ext4 relatime,data=ordered 0 1'
|
|
echo 'LABEL="pmOS_boot" /boot auto defaults 0 2'
|
|
} | write_unless_modified /etc/fstab
|
|
|
|
# Set /etc/issue
|
|
{
|
|
echo 'Welcome to postmarketOS'
|
|
echo 'Kernel \r on an \m (\l)'
|
|
# setterm -powersave on -blank 5
|
|
echo -ne "\033[9;5]"
|
|
} | write_unless_modified /etc/issue
|
|
|
|
# Set /etc/motd
|
|
{
|
|
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://wiki.postmarketos.org> and <https://wiki.alpinelinux.org>.'
|
|
echo ''
|
|
echo 'You may change this message by editing /etc/motd.'
|
|
echo ''
|
|
} | write_unless_modified /etc/motd
|
|
|
|
# Change wpa_supplicant into dbus mode and enable both drivers
|
|
{
|
|
echo 'wpa_supplicant_args="-u -Dwext,nl80211"'
|
|
} | write_unless_modified /etc/conf.d/wpa_supplicant
|
|
touch /etc/wpa_supplicant/wpa_supplicant.conf
|
|
|
|
# Enable syslog to SHM. Note: size is 4048KiB, which *should* be More Than Enough(TM) for all but the most chattiest of devices.
|
|
sed s/=\"/=\""-C4048 "/ -i /etc/conf.d/syslog
|
|
|
|
# Enable wext, nl80211 & dbus control for wpa_supplicant
|
|
if ! grep -q Dwext /etc/conf.d/wpa_supplicant; then
|
|
sed -i 's/wpa_supplicant_args=\"/wpa_supplicant_args=\" -u -Dwext,nl80211/' /etc/conf.d/wpa_supplicant
|
|
fi
|
|
touch /etc/wpa_supplicant/wpa_supplicant.conf
|
|
|
|
# Enable the 'wheel' group
|
|
sed -i 's/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/' /etc/sudoers
|
|
|
|
# Set chrony to quickly correct system time on first boot, if necessary
|
|
if ! grep -q "makestep" /etc/chrony/chrony.conf; then
|
|
echo "makestep 1 -1" >> /etc/chrony/chrony.conf
|
|
fi
|