xin/bins/check-restart.nix

21 lines
405 B
Nix
Raw Normal View History

2023-09-12 08:44:05 -06:00
{ perl }: ''
2022-08-25 12:21:35 -06:00
#!${perl}/bin/perl
use strict;
use warnings;
2022-09-10 21:38:00 -06:00
use feature 'say';
2022-08-25 12:21:35 -06:00
my @booted = split("/", `readlink -f /run/booted-system/kernel`);
my @current = split("/", `readlink -f /run/current-system/kernel`);
if ($booted[3] ne $current[3]) {
say "Restart required!";
say "old: $booted[3]";
say "new: $current[3]";
exit 1;
} else {
say "system is clean..";
}
''