systemd: store switch-root.conf in /run/initramfs

Store switch-root.conf in /run/initramfs/switch-root.conf, so that the
service does not fail in ExecPost after switching to the real root.
This commit is contained in:
Harald Hoyer 2012-05-16 11:24:42 +02:00
parent 41153ca4f2
commit 38111b9622
2 changed files with 3 additions and 3 deletions

View File

@ -27,12 +27,12 @@ for i in "$(getarg real_init=)" "$(getarg init=)"; do
__p=$(readlink -f "${NEWROOT}/${i}")
if [ -x "$__p" ]; then
INIT="$i"
echo "NEWINIT=\"$INIT\"" > /etc/switch-root.conf
echo "NEWINIT=\"$INIT\"" > /run/initramfs/switch-root.conf
break
fi
done
echo "NEWROOT=\"$NEWROOT\"" >> /etc/switch-root.conf
echo "NEWROOT=\"$NEWROOT\"" >> /run/initramfs/switch-root.conf
udevadm control --stop-exec-queue
systemctl stop systemd-udev.service

View File

@ -11,6 +11,6 @@ DefaultDependencies=no
[Service]
Type=oneshot
EnvironmentFile=/etc/switch-root.conf
EnvironmentFile=/run/initramfs/switch-root.conf
ExecStart=/usr/bin/systemctl --force switch-root ${NEWROOT} ${NEWINIT}
ExecStopPost=-/usr/bin/systemctl isolate default.target