forked from c3d2/nix-config
list-upgradable: obtain and print nixos system version
This commit is contained in:
parent
3b93b16370
commit
b349a48ec8
10
flake.nix
10
flake.nix
|
@ -117,13 +117,17 @@
|
|||
in nixpkgs.lib.optionalString (addr != null) ''
|
||||
echo -n -e "${name}: $RED"
|
||||
RUNNING=$(ssh -o PreferredAuthentications=publickey -o StrictHostKeyChecking=accept-new root@"${addr}" "readlink /run/current-system")
|
||||
if [ $? = 0 ]; then
|
||||
if [ $? = 0 ] && [ -n "$RUNNING" ]; then
|
||||
CURRENT=$(nix eval --raw ".#nixosConfigurations.${name}.config.system.build.toplevel" 2>/dev/null)
|
||||
RUNNING_VER=$(basename $RUNNING|rev|cut -d - -f 1|rev)
|
||||
CURRENT_VER=$(basename $CURRENT|rev|cut -d - -f 1|rev)
|
||||
|
||||
if [ "$RUNNING" = "$CURRENT" ]; then
|
||||
echo -e "$GREEN"current
|
||||
echo -e "$GREEN"current"$NORMAL $RUNNING_VER"
|
||||
elif [ "$RUNNING_VER" = "$CURRENT_VER" ]; then
|
||||
echo -e "$GREEN"modified"$NORMAL $RUNNING_VER"
|
||||
else
|
||||
echo -e "$YELLOW"outdated
|
||||
echo -e "$YELLOW"outdated"$NORMAL $RUNNING_VER < $CURRENT_VER"
|
||||
fi
|
||||
fi
|
||||
echo -n -e "$NORMAL"
|
||||
|
|
Loading…
Reference in New Issue
Block a user