summary refs log tree commit diff
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2016-08-16 07:51:58 -0400
committerShea Levy <shea@shealevy.com>2016-08-16 07:51:58 -0400
commitb4954a8f3802ba545933905428a4288622f28294 (patch)
treee58ea149d7ecf20cbcc9cdcb6bbe6f0a9bd2c428
parent38f306f492e21140d2888c9b6de20d4a5c925387 (diff)
downloadnixlib-b4954a8f3802ba545933905428a4288622f28294.tar
nixlib-b4954a8f3802ba545933905428a4288622f28294.tar.gz
nixlib-b4954a8f3802ba545933905428a4288622f28294.tar.bz2
nixlib-b4954a8f3802ba545933905428a4288622f28294.tar.lz
nixlib-b4954a8f3802ba545933905428a4288622f28294.tar.xz
nixlib-b4954a8f3802ba545933905428a4288622f28294.tar.zst
nixlib-b4954a8f3802ba545933905428a4288622f28294.zip
Deprecate --install-grub in favor of --install-bootloader for nixos-rebuild.
Fixes #14293
-rw-r--r--nixos/doc/manual/man-nixos-rebuild.xml11
-rw-r--r--nixos/modules/installer/tools/nixos-install.sh2
-rw-r--r--nixos/modules/installer/tools/nixos-rebuild.sh6
-rw-r--r--nixos/modules/system/boot/loader/grub/install-grub.pl6
-rw-r--r--nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py6
5 files changed, 21 insertions, 10 deletions
diff --git a/nixos/doc/manual/man-nixos-rebuild.xml b/nixos/doc/manual/man-nixos-rebuild.xml
index a8d20c0f6579..d01e2e060bde 100644
--- a/nixos/doc/manual/man-nixos-rebuild.xml
+++ b/nixos/doc/manual/man-nixos-rebuild.xml
@@ -29,7 +29,7 @@
     </group>
     <sbr />
     <arg><option>--upgrade</option></arg>
-    <arg><option>--install-grub</option></arg>
+    <arg><option>--install-bootloader</option></arg>
     <arg><option>--no-build-nix</option></arg>
     <arg><option>--fast</option></arg>
     <arg><option>--rollback</option></arg>
@@ -212,12 +212,11 @@ $ ./result/bin/run-*-vm
   </varlistentry>
 
   <varlistentry>
-    <term><option>--install-grub</option></term>
+    <term><option>--install-bootloader</option></term>
     <listitem>
-      <para>Causes the GRUB boot loader to be (re)installed on the
-      device specified by the
-      <varname>boot.loader.grub.device</varname> configuration
-      option.</para>
+      <para>Causes the boot loader to be (re)installed on the
+      device specified by the relevant configuration options.
+      </para>
     </listitem>
   </varlistentry>
 
diff --git a/nixos/modules/installer/tools/nixos-install.sh b/nixos/modules/installer/tools/nixos-install.sh
index 758f0cdb9d3f..9d818c09b4d0 100644
--- a/nixos/modules/installer/tools/nixos-install.sh
+++ b/nixos/modules/installer/tools/nixos-install.sh
@@ -263,7 +263,7 @@ touch $mountPoint/etc/NIXOS
 # configuration.
 echo "finalising the installation..."
 if [ -z "$noBootLoader" ]; then
-  NIXOS_INSTALL_GRUB=1 chroot $mountPoint \
+  NIXOS_INSTALL_BOOTLOADER=1 chroot $mountPoint \
       /nix/var/nix/profiles/system/bin/switch-to-configuration boot
 fi
 
diff --git a/nixos/modules/installer/tools/nixos-rebuild.sh b/nixos/modules/installer/tools/nixos-rebuild.sh
index e26a9f6cf635..803989789838 100644
--- a/nixos/modules/installer/tools/nixos-rebuild.sh
+++ b/nixos/modules/installer/tools/nixos-rebuild.sh
@@ -33,7 +33,11 @@ while [ "$#" -gt 0 ]; do
         action="$i"
         ;;
       --install-grub)
-        export NIXOS_INSTALL_GRUB=1
+        echo "$0: --install-grub deprecated, use --install-bootloader instead" >&2
+        export NIXOS_INSTALL_BOOTLOADER=1
+        ;;
+      --install-bootloader)
+        export NIXOS_INSTALL_BOOTLOADER=1
         ;;
       --no-build-nix)
         buildNix=
diff --git a/nixos/modules/system/boot/loader/grub/install-grub.pl b/nixos/modules/system/boot/loader/grub/install-grub.pl
index 94d87b436065..4fa157641a4a 100644
--- a/nixos/modules/system/boot/loader/grub/install-grub.pl
+++ b/nixos/modules/system/boot/loader/grub/install-grub.pl
@@ -508,7 +508,11 @@ my $nameDiffer = get("fullName") ne $prevGrubState->name;
 my $versionDiffer = get("fullVersion") ne $prevGrubState->version;
 my $efiDiffer = $efiTarget ne $prevGrubState->efi;
 my $efiMountPointDiffer = $efiSysMountPoint ne $prevGrubState->efiMountPoint;
-my $requireNewInstall = $devicesDiffer || $nameDiffer || $versionDiffer || $efiDiffer || $efiMountPointDiffer || (($ENV{'NIXOS_INSTALL_GRUB'} // "") eq "1");
+if (($ENV{'NIXOS_INSTALL_GRUB'} // "") eq "1") {
+    warn "NIXOS_INSTALL_GRUB env var deprecated, use NIXOS_INSTALL_BOOTLOADER";
+    $ENV{'NIXOS_INSTALL_BOOTLOADER'} = "1";
+}
+my $requireNewInstall = $devicesDiffer || $nameDiffer || $versionDiffer || $efiDiffer || $efiMountPointDiffer || (($ENV{'NIXOS_INSTALL_BOOTLOADER'} // "") eq "1");
 
 # install a symlink so that grub can detect the boot drive
 my $tmpDir = File::Temp::tempdir(CLEANUP => 1) or die "Failed to create temporary space";
diff --git a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py
index c38af1b67f17..c703a3e083ba 100644
--- a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py
+++ b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py
@@ -7,6 +7,7 @@ import subprocess
 import glob
 import tempfile
 import errno
+import warnings
 
 def copy_if_not_exists(source, dest):
     if not os.path.exists(dest):
@@ -92,8 +93,11 @@ parser = argparse.ArgumentParser(description='Update NixOS-related systemd-boot
 parser.add_argument('default_config', metavar='DEFAULT-CONFIG', help='The default NixOS config to boot')
 args = parser.parse_args()
 
-# We deserve our own env var!
 if os.getenv("NIXOS_INSTALL_GRUB") == "1":
+    warnings.warn("NIXOS_INSTALL_GRUB env var deprecated, use NIXOS_INSTALL_BOOTLOADER", DeprecationWarning)
+    os.environ["NIXOS_INSTALL_BOOTLOADER"] = "1"
+
+if os.getenv("NIXOS_INSTALL_BOOTLOADER") == "1":
     if "@canTouchEfiVariables@" == "1":
         subprocess.check_call(["@systemd@/bin/bootctl", "--path=@efiSysMountPoint@", "install"])
     else: