diff options
Diffstat (limited to 'meta-netboot/recipes-core/initramfs-netboot/files')
-rw-r--r-- | meta-netboot/recipes-core/initramfs-netboot/files/init.sh | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/meta-netboot/recipes-core/initramfs-netboot/files/init.sh b/meta-netboot/recipes-core/initramfs-netboot/files/init.sh index 92927df47..4a4af3180 100644 --- a/meta-netboot/recipes-core/initramfs-netboot/files/init.sh +++ b/meta-netboot/recipes-core/initramfs-netboot/files/init.sh @@ -144,16 +144,41 @@ pivot_root . boot/initramfs || bail_out "pivot_root failed." if [[ -f /lib/systemd/system/connman.service ]]; then newopts="-r -n" iface=$(find_active_interface) - [[ -n "$iface" ]] && newopts="$newopts -I $iface" + # beside discovered iface, also ignore known renames + [[ -n "$iface" ]] && newopts="$newopts -I ${iface},enp2s0,enp3s0,end0,enp0s2,enp0s1 " log_info "Adjusting Connman command line. Will be: 'connmand $newopts'" sed -i "s|connmand -n\$|connmand $newopts|g" /lib/systemd/system/connman.service fi +# workaround for systemd-network-generator bringing the interface up/down/up +if [[ -f /usr/lib/systemd/system/systemd-network-generator.service ]] ; then + mkdir /etc/systemd/system/systemd-network-generator.service.d/ + echo "[Unit]" > /etc/systemd/system/systemd-network-generator.service.d/10_disable_nbd.conf + echo "ConditionKernelCommandLine=!nbd.server" >> /etc/systemd/system/systemd-network-generator.service.d/10_disable_nbd.conf +fi + + # also use /proc/net/pnp to generate /etc/resolv.conf rm -f /etc/resolv.conf grep -v bootserver /proc/net/pnp | sed 's/^domain/search/g' >/etc/resolv.conf +# Do SELinux relabeling if required, to avoid a reboot that would complicate CI +if [ -f /.autorelabel ]; then + # Nothing SELinux related works w/o the fs mounted + do_mount_fs selinuxfs /sys/fs/selinux + + # Labeling requires the policy to be loaded + log_info "Loading SELinux policy" + /usr/sbin/load_policy + + /usr/bin/selinux-autorelabel.sh + + # Will get remounted by systemd startup, unmount to keep that behavior + # more like the non-netboot case. + umount /sys/fs/selinux +fi + # unmount tmp and run to let systemd remount them log_info "Unmounting /tmp and /run" umount /tmp |