hm-cli now backups files before applying
This commit is contained in:
parent
ecb290a989
commit
9c909ba079
1 changed files with 3 additions and 3 deletions
|
|
@ -36,7 +36,7 @@ pkgs.writeShellScriptBin "hm" ''
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
apply)
|
apply)
|
||||||
"$HM" switch --flake "$FLAKE_PATH#$FLAKE_OUTPUT"
|
"$HM" switch --flake "$FLAKE_PATH#$FLAKE_OUTPUT" -b bkp
|
||||||
;;
|
;;
|
||||||
generation)
|
generation)
|
||||||
if [[ $# -lt 2 ]]; then
|
if [[ $# -lt 2 ]]; then
|
||||||
|
|
@ -65,14 +65,14 @@ pkgs.writeShellScriptBin "hm" ''
|
||||||
echo "Error: could not determine previous generation (possibly only one generation exists)"
|
echo "Error: could not determine previous generation (possibly only one generation exists)"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
"$HM" switch --flake "$FLAKE_PATH" --switch-generation "$PREV_GEN"
|
"$HM" switch --flake "$FLAKE_PATH" --switch-generation "$PREV_GEN" -b bkp
|
||||||
;;
|
;;
|
||||||
switch)
|
switch)
|
||||||
if [[ $# -ne 3 ]]; then
|
if [[ $# -ne 3 ]]; then
|
||||||
echo "Error: switch requires exactly one generation ID"
|
echo "Error: switch requires exactly one generation ID"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
"$HM" switch --flake "$FLAKE_PATH" --switch-generation "$3"
|
"$HM" switch --flake "$FLAKE_PATH" --switch-generation "$3" -b bkp
|
||||||
;;
|
;;
|
||||||
cleanup)
|
cleanup)
|
||||||
CURRENT_GEN=$("$HM" generations | sed -n 's/^.*id \([0-9]\+\) .* (current)$/\1/p')
|
CURRENT_GEN=$("$HM" generations | sed -n 's/^.*id \([0-9]\+\) .* (current)$/\1/p')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue