Merge branch 'install-bootloader-flag'
This commit is contained in:
commit
2942895d55
|
@ -29,7 +29,7 @@
|
||||||
</group>
|
</group>
|
||||||
<sbr />
|
<sbr />
|
||||||
<arg><option>--upgrade</option></arg>
|
<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>--no-build-nix</option></arg>
|
||||||
<arg><option>--fast</option></arg>
|
<arg><option>--fast</option></arg>
|
||||||
<arg><option>--rollback</option></arg>
|
<arg><option>--rollback</option></arg>
|
||||||
|
@ -212,12 +212,11 @@ $ ./result/bin/run-*-vm
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><option>--install-grub</option></term>
|
<term><option>--install-bootloader</option></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Causes the GRUB boot loader to be (re)installed on the
|
<para>Causes the boot loader to be (re)installed on the
|
||||||
device specified by the
|
device specified by the relevant configuration options.
|
||||||
<varname>boot.loader.grub.device</varname> configuration
|
</para>
|
||||||
option.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
|
|
@ -260,7 +260,7 @@ touch $mountPoint/etc/NIXOS
|
||||||
# configuration.
|
# configuration.
|
||||||
echo "finalising the installation..."
|
echo "finalising the installation..."
|
||||||
if [ -z "$noBootLoader" ]; then
|
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
|
/nix/var/nix/profiles/system/bin/switch-to-configuration boot
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,11 @@ while [ "$#" -gt 0 ]; do
|
||||||
action="$i"
|
action="$i"
|
||||||
;;
|
;;
|
||||||
--install-grub)
|
--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)
|
--no-build-nix)
|
||||||
buildNix=
|
buildNix=
|
||||||
|
|
|
@ -508,7 +508,11 @@ my $nameDiffer = get("fullName") ne $prevGrubState->name;
|
||||||
my $versionDiffer = get("fullVersion") ne $prevGrubState->version;
|
my $versionDiffer = get("fullVersion") ne $prevGrubState->version;
|
||||||
my $efiDiffer = $efiTarget ne $prevGrubState->efi;
|
my $efiDiffer = $efiTarget ne $prevGrubState->efi;
|
||||||
my $efiMountPointDiffer = $efiSysMountPoint ne $prevGrubState->efiMountPoint;
|
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
|
# 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";
|
my $tmpDir = File::Temp::tempdir(CLEANUP => 1) or die "Failed to create temporary space";
|
||||||
|
|
|
@ -7,6 +7,7 @@ import subprocess
|
||||||
import glob
|
import glob
|
||||||
import tempfile
|
import tempfile
|
||||||
import errno
|
import errno
|
||||||
|
import warnings
|
||||||
|
|
||||||
def copy_if_not_exists(source, dest):
|
def copy_if_not_exists(source, dest):
|
||||||
if not os.path.exists(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')
|
parser.add_argument('default_config', metavar='DEFAULT-CONFIG', help='The default NixOS config to boot')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# We deserve our own env var!
|
|
||||||
if os.getenv("NIXOS_INSTALL_GRUB") == "1":
|
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":
|
if "@canTouchEfiVariables@" == "1":
|
||||||
subprocess.check_call(["@systemd@/bin/bootctl", "--path=@efiSysMountPoint@", "install"])
|
subprocess.check_call(["@systemd@/bin/bootctl", "--path=@efiSysMountPoint@", "install"])
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue