From 3ec710af5a3d186b4f2b7b064e365fb70fa825b0 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Tue, 20 May 2025 18:36:30 +0800 Subject: [PATCH] feat(packages/rebuild): add a reboot prompt --- packages/rebuild/default.nix | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/rebuild/default.nix b/packages/rebuild/default.nix index a5bee2d..a38758c 100644 --- a/packages/rebuild/default.nix +++ b/packages/rebuild/default.nix @@ -19,7 +19,7 @@ pkgs.writeShellScriptBin "rebuild" # sh echo "--- opening test shell... ---" ${pkgs.cowsay}/bin/cowsay -f elephant "Entering a test shell. Type 'exit 1' to abort changes and 'exit' to commit." PS1="Test shell> " $SHELL || { - ${pkgs.cowsay}/bin/cowsay -f satanic "You aborted." + ${pkgs.cowsay}/bin/cowsay "You aborted." exit 1 } @@ -29,5 +29,14 @@ pkgs.writeShellScriptBin "rebuild" # sh exit 1 } git commit - exit 0 + + read -p "Reboot the system now? (y/n) [n]: " -n 1 -r + echo # (optional) move to a new line + if [[ $REPLY =~ ^[Yy]$ ]]; then + echo "Rebooting the system..." + sudo systemctl reboot + else + echo "Not rebooting." + exit 0 + fi ''