Olaf Kolkman fbd41a72f1
First Try
2025-05-06 19:41:26 +02:00

25 lines
609 B
Bash
Executable File

#!/bin/sh -e
GREEN='\033[1;32m'
YELLOW='\033[1;33m'
RED='\033[1;31m'
NC='\033[0m'
FLAKE="macos"
echo "${YELLOW}Available generations:${NC}"
/run/current-system/sw/bin/darwin-rebuild --list-generations
echo "${YELLOW}Enter the generation number for rollback:${NC}"
read GEN_NUM
if [ -z "$GEN_NUM" ]; then
echo "${RED}No generation number entered. Aborting rollback.${NC}"
exit 1
fi
echo "${YELLOW}Rolling back to generation $GEN_NUM...${NC}"
/run/current-system/sw/bin/darwin-rebuild switch --flake .#$FLAKE --switch-generation $GEN_NUM
echo "${GREEN}Rollback to generation $GEN_NUM complete!${NC}"