Skip to content

Commit

Permalink
Merge pull request #12 from vrutkovs/run-systemd-resolved
Browse files Browse the repository at this point in the history
[release-4.6] Fix invalid symlink on second boot
  • Loading branch information
openshift-merge-robot authored Nov 21, 2020
2 parents 975769e + be5215f commit 80329d3
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 16 deletions.
27 changes: 11 additions & 16 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ commit_id="$( <${dir}/meta.json jq -r '."ostree-commit"' )"
mkdir /srv/repo
curl -L "${tar_url}" | tar xf - -C /srv/repo/ --no-same-owner

# Remove all refs except ${REF} so that bootstrap pivot would not be confused
ostree --repo=/srv/repo refs | grep -v "${REF}" | xargs -n1 ostree --repo=/srv/repo refs --delete

# use repos from FCOS
rm -rf /etc/yum.repos.d
ostree --repo=/srv/repo checkout "${REF}" --subpath /usr/etc/yum.repos.d --user-mode /etc/yum.repos.d
Expand Down Expand Up @@ -104,25 +107,17 @@ pushd /tmp/working
echo "Extracting $i ..."
rpm2cpio $i | cpio -div
done
# Fix localtime symlink
rm -rf etc/localtime
ln -s ../usr/share/zoneinfo/UTC etc/localtime
# disable systemd-resolved.service. Having it enabled breaks machine-api DNS resolution
mkdir -p etc/systemd/system/systemd-resolved.service.d
echo -e "[Unit]\nConditionPathExists=/enoent" > etc/systemd/system/systemd-resolved.service.d/disabled.conf
mkdir -p etc/NetworkManager/conf.d
echo -e "[main]\ndns=default" > etc/NetworkManager/conf.d/dns.conf
rm -rf usr/etc/tmpfiles.d/dns.conf
mkdir -p etc/systemd/system/coreos-migrate-to-systemd-resolved.service.d
echo -e "[Unit]\nConditionPathExists=/enoent" > etc/systemd/system/coreos-migrate-to-systemd-resolved.service.d/disabled.conf
# Workaround for https://github.com/coreos/fedora-coreos-tracker/issues/649

# append additional configuration
cp -rvf /srv/overlay/* .

# move etc configuration to /usr/etc so that it would be merged by rpm-ostree
mv etc usr/
popd

# add binaries (MCD) from /srv/addons
mkdir -p /tmp/working/usr/bin
cp -rvf /srv/addons/* /tmp/working/
# add binaries (MCD) from /srv/addons
mkdir -p usr/bin usr/libexec
cp -rvf /srv/addons/* .
popd

# build new commit
coreos-assembler dev-overlay --repo /srv/repo --rev "${REF}" --add-tree /tmp/working --output-ref "${REF}"
2 changes: 2 additions & 0 deletions overlay/etc/NetworkManager/conf.d/dns.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[main]
dns=default
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Unit]
ConditionPathExists=/enoent
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Unit]
ConditionPathExists=/enoent
12 changes: 12 additions & 0 deletions overlay/usr/lib/tmpfiles.d/etc.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# See tmpfiles.d(5) for details
L /etc/os-release - - - - ../usr/lib/os-release
L+ /etc/mtab - - - - ../proc/self/mounts
C! /etc/nsswitch.conf - - - -
C! /etc/pam.d - - - -
C! /etc/issue - - - -

0 comments on commit 80329d3

Please sign in to comment.