The *ldconfig.service* fails because `/etc` is not writable and thus `/etc/ld.so.cache` cannot be generated. The files specified in the `provision.d` *tmpfiles.d(5)* configuration are unnecessary, and many of them cannot be created at runtime because the root filesystem is immutable.
82 lines
2.1 KiB
Bash
Executable File
82 lines
2.1 KiB
Bash
Executable File
#!/bin/sh
|
|
# vim: set sw=4 ts=4 sts=4 et :
|
|
|
|
set -e
|
|
|
|
. ./config
|
|
|
|
mkdir -p \
|
|
/mnt/gentoo/usr/bin \
|
|
/mnt/gentoo/usr/lib \
|
|
/mnt/gentoo/usr/lib64 \
|
|
|| exit
|
|
[ -h /mnt/gentoo/bin ] || ln -s usr/bin /mnt/gentoo/bin
|
|
[ -h /mnt/gentoo/sbin ] || ln -s usr/sbin /mnt/gentoo/sbin
|
|
[ -h /mnt/gentoo/usr/sbin ] || ln -s bin /mnt/gentoo/usr/sbin
|
|
[ -h /mnt/gentoo/lib ] || ln -s usr/lib /mnt/gentoo/lib
|
|
[ -h /mnt/gentoo/lib64 ] || ln -s usr/lib64 /mnt/gentoo/lib64
|
|
|
|
mkdir -p /mnt/gentoo/etc/portage
|
|
ln -snf \
|
|
/var/db/repos/gentoo/profiles/${profile} \
|
|
/mnt/gentoo/etc/portage/make.profile
|
|
cp -r portage/. /mnt/gentoo/etc/portage/
|
|
|
|
ROOT=/mnt/gentoo \
|
|
PORTAGE_CONFIGROOT=/mnt/gentoo \
|
|
${target}-emerge -Kvnj \
|
|
sys-apps/busybox \
|
|
sys-apps/systemd \
|
|
net-misc/openssh \
|
|
net-misc/wget \
|
|
sys-fs/btrfs-progs \
|
|
--
|
|
ROOT=/mnt/gentoo \
|
|
PORTAGE_CONFIGROOT=/mnt/gentoo \
|
|
${target}-emerge -vnj \
|
|
net-wireless/wireless-regdb \
|
|
sys-kernel/linux-firmware \
|
|
--
|
|
|
|
mkdir -p \
|
|
/mnt/gentoo/boot/efi \
|
|
/mnt/gentoo/dev \
|
|
/mnt/gentoo/home \
|
|
/mnt/gentoo/proc \
|
|
/mnt/gentoo/sys \
|
|
|| exit
|
|
|
|
: > /mnt/gentoo/etc/machine-id
|
|
|
|
while read name; do
|
|
if [ ! -h /mnt/gentoo/bin/"${name}" ]; then
|
|
printf "'/bin/%s' -> 'busybox'\n" "${name}"
|
|
ln -snf busybox /mnt/gentoo/bin/"${name}" \
|
|
|| printf 'Failed to create busybox symlink for %s\n' "${name}"
|
|
fi
|
|
done < busybox.symlinks
|
|
|
|
tar -c -C overlay . \
|
|
| tar -x --keep-newer-files -C /mnt/gentoo
|
|
|
|
cp -uv /usr/${target}/usr/bin/grub-editenv /mnt/gentoo/usr/bin/
|
|
|
|
if [ -f /mnt/gentoo/etc/udev/hwdb.bin ]; then
|
|
mv /mnt/gentoo/etc/udev/hwdb.bin /mnt/gentoo/usr/lib/udev/
|
|
fi
|
|
|
|
rm -f /mnt/gentoo/lib/tmpfiles.d/provision.conf
|
|
|
|
systemctl preset-all --root=/mnt/gentoo
|
|
rm -f /mnt/gentoo/lib/systemd/system/sysinit.target.wants/ldconfig.service
|
|
|
|
systemd-sysusers --root=/mnt/gentoo
|
|
if grep -q '^root:.*/bin/bash$' /mnt/gentoo/etc/passwd; then
|
|
sed -ri 's@(root:.*):/bin/bash@\1:/bin/sh@' /mnt/gentoo/etc/passwd
|
|
fi
|
|
|
|
if ! grep -q Include /mnt/gentoo/etc/ssh/sshd_config; then
|
|
echo 'Include /etc/ssh/sshd_config.d/*.conf' \
|
|
>> /mnt/gentoo/etc/ssh/sshd_config
|
|
fi
|