helm/apps/aarch64-darwin/rollback
2024-03-18 12:02:21 -07:00

25 lines
615 B
Bash
Executable file

#!/bin/sh -e
GREEN='\033[1;32m'
YELLOW='\033[1;33m'
RED='\033[1;31m'
NC='\033[0m'
FLAKE="Dustins-MBP"
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}"