xin/bins/check-restart.nix

23 lines
406 B
Nix
Raw Normal View History

2022-08-25 12:21:35 -06:00
{ perl }:
''
#!${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..";
}
''