mirror of
https://github.com/aviallon/nixos-lib.git
synced 2026-04-05 17:27:50 +00:00
[Boot] successful boot marking: handle specialization
This commit is contained in:
parent
8f7bc11e09
commit
364f149725
1 changed files with 20 additions and 1 deletions
21
boot.nix
21
boot.nix
|
|
@ -320,10 +320,23 @@ in {
|
||||||
in ''
|
in ''
|
||||||
rpath=
|
rpath=
|
||||||
generation=
|
generation=
|
||||||
|
specialization=
|
||||||
boot_generation_path=$(realpath /run/booted-system)
|
boot_generation_path=$(realpath /run/booted-system)
|
||||||
for path in /nix/var/nix/profiles/system-*-link; do
|
for path in /nix/var/nix/profiles/system-*-link; do
|
||||||
rpath=$(realpath "$path")
|
rpath=$(realpath "$path")
|
||||||
|
ok=false
|
||||||
if [ "$rpath" = "$boot_generation_path" ]; then
|
if [ "$rpath" = "$boot_generation_path" ]; then
|
||||||
|
echo "Good path: $path"
|
||||||
|
ok=true
|
||||||
|
fi
|
||||||
|
for specialization in "$path"/specialisation/*; do
|
||||||
|
if [ "$(realpath $specialization)" = "$boot_generation_path" ]; then
|
||||||
|
ok=true
|
||||||
|
echo "Good specialization: $specialization"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if $ok; then
|
||||||
generation="''${path##*/system-}"
|
generation="''${path##*/system-}"
|
||||||
generation="''${generation%%-link}"
|
generation="''${generation%%-link}"
|
||||||
break
|
break
|
||||||
|
|
@ -335,13 +348,19 @@ in {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
loader_entry="${efiDir}/loader/entries/nixos-generation-''${generation}.conf"
|
loader_entry="${efiDir}/loader/entries/nixos-generation-''${generation}.conf"
|
||||||
|
if ! [ -z "$specialization" ]; then
|
||||||
|
specialization_name=$(basename -- "$specialization")
|
||||||
|
echo "Specialization is: $specialization_name"
|
||||||
|
loader_entry="${efiDir}/loader/entries/nixos-generation-''${generation}-specialisation-''${specialization_name}.conf"
|
||||||
|
fi
|
||||||
|
|
||||||
if ! [ -f "$loader_entry" ]; then
|
if ! [ -f "$loader_entry" ]; then
|
||||||
echo "Failed to find corresponding loader generation entry:" ''${loader_entry} "not found"
|
echo "Failed to find corresponding loader generation entry:" ''${loader_entry} "not found"
|
||||||
echo -e "\e[33mWARNING:\e[0m This may mean that your aviallon.boot.configurationLimit is set too low!"
|
echo -e "\e[33mWARNING:\e[0m This may mean that your aviallon.boot.configurationLimit is set too low!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sed -i 's/version /version <LAST> /' "${efiDir}/loader/entries/nixos-generation-''${generation}.conf" &&
|
sed -i 's/version /version <LAST> /' "$loader_entry" &&
|
||||||
echo "Marked generation $generation as last sucessfully booted"
|
echo "Marked generation $generation as last sucessfully booted"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue