switch-to-configuration: require a reboot going from Upstart to systemd

This commit is contained in:
Eelco Dolstra 2012-07-20 16:23:52 -04:00
parent 5fabcf63a3
commit 0b865edb16
2 changed files with 8 additions and 8 deletions

View File

@ -59,16 +59,16 @@ fi
# Activate the new configuration.
if [ "$action" != switch -a "$action" != test ]; then exit 0; fi
oldVersion=$(cat /run/current-system/upstart-interface-version 2> /dev/null || echo 0)
newVersion=$(cat @out@/upstart-interface-version 2> /dev/null || echo 0)
oldVersion="$(cat /run/current-system/init-interface-version 2> /dev/null || echo "")"
newVersion="$(cat @out@/init-interface-version)"
if test "$oldVersion" -ne "$newVersion"; then
if [ "$oldVersion" != "$newVersion" ]; then
cat <<EOF
Warning: the new NixOS configuration has an Upstart version that is
incompatible with the current version. The new configuration won't
take effect until you reboot the system.
Warning: the new NixOS configuration has an init that is
incompatible with the current configuration. The new configuration
won't take effect until you reboot the system.
EOF
exit 1
exit 100 # denotes "reboot required" to Charon
fi
# Ignore SIGHUP so that we're not killed if we're running on (say)

View File

@ -122,7 +122,7 @@ let
echo -n "$kernelParams" > $out/kernel-params
echo -n "$configurationName" > $out/configuration-name
#echo -n "${toString config.system.build.upstart.interfaceVersion}" > $out/upstart-interface-version
echo -n "systemd ${toString config.system.build.systemd.interfaceVersion}" > $out/init-interface-version
echo -n "$nixosVersion" > $out/nixos-version
mkdir $out/fine-tune