modules/microvm-host: improve update-microvm behaviour

This commit is contained in:
Astro 2022-09-16 00:11:00 +02:00
parent 10bb8eb364
commit afc7a33eb5
1 changed files with 13 additions and 4 deletions

View File

@ -90,17 +90,26 @@
if [ -e booted ]; then
nix store diff-closures $(readlink booted) $NEW
else
echo "NOT BOOTED?"
echo "NOT BOOTED? Run:"
echo systemctl start microvm@$NAME
fi
if [ "$(readlink current)" != $NEW ]; then
CHANGED=no
if ! [ -e current ]; then
ln -s $NEW current
CHANGED=yes
elif [ "$(readlink current)" != $NEW ]; then
rm -f old
mv current old
ln -s $NEW current
CHANGED=yes
fi
fi
echo Run at your own peril:
echo systemctl restart microvm@$NAME
if [ "$CHANGED" = "yes" ]; then
echo Run at your own peril:
echo systemctl restart microvm@$NAME
fi
echo
done
''