mirror of
https://github.com/librephoenix/nixos-config
synced 2025-01-18 22:55:52 +05:30
feat: adds -ac to automatically confirm the system rebuild
This commit is contained in:
parent
2db2c775b4
commit
bb6385720e
15
install.sh
15
install.sh
|
@ -15,6 +15,7 @@ DISABLE_HARDEN=0
|
||||||
TEMP_CLONE=0
|
TEMP_CLONE=0
|
||||||
SKIP_CLONE=0
|
SKIP_CLONE=0
|
||||||
SKIP_EMAIL=0
|
SKIP_EMAIL=0
|
||||||
|
AUTO_CONFIRM=0
|
||||||
EDITOR="${EDITOR:-nano}" # Default to nano if EDITOR is not set
|
EDITOR="${EDITOR:-nano}" # Default to nano if EDITOR is not set
|
||||||
|
|
||||||
# Helper function to display usage message
|
# Helper function to display usage message
|
||||||
|
@ -28,6 +29,7 @@ show_help() {
|
||||||
printf " -t, --temp-clone Clone into a temporary directory\n"
|
printf " -t, --temp-clone Clone into a temporary directory\n"
|
||||||
printf " -s, --skip-clone Skip the cloning step if directory exists\n"
|
printf " -s, --skip-clone Skip the cloning step if directory exists\n"
|
||||||
printf " -se, --skip-email Skip the email replacement step in flake.nix\n"
|
printf " -se, --skip-email Skip the email replacement step in flake.nix\n"
|
||||||
|
printf " -ac, --auto-confirm Automatically confirm the system rebuild\n"
|
||||||
printf " -h, --help Show this help message\n"
|
printf " -h, --help Show this help message\n"
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
@ -47,6 +49,7 @@ while [ "$#" -gt 0 ]; do
|
||||||
-t|--temp-clone) TEMP_CLONE=1; shift;;
|
-t|--temp-clone) TEMP_CLONE=1; shift;;
|
||||||
-s|--skip-clone) SKIP_CLONE=1; shift;;
|
-s|--skip-clone) SKIP_CLONE=1; shift;;
|
||||||
-se|--skip-email) SKIP_EMAIL=1; shift;;
|
-se|--skip-email) SKIP_EMAIL=1; shift;;
|
||||||
|
-ac|--auto-confirm) AUTO_CONFIRM=1; shift;;
|
||||||
-h|--help) show_help;;
|
-h|--help) show_help;;
|
||||||
--) shift; break;;
|
--) shift; break;;
|
||||||
*) printf "${RED}Error:${NC} Unknown option: $1\n"; show_help; exit 1;;
|
*) printf "${RED}Error:${NC} Unknown option: $1\n"; show_help; exit 1;;
|
||||||
|
@ -115,11 +118,13 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Confirmation prompt for system rebuild
|
# Confirmation prompt for system rebuild
|
||||||
printf "${YELLOW}Ready to rebuild the system with nixos-rebuild. Do you want to proceed? (y/n) ${NC}"
|
if [ "$AUTO_CONFIRM" -eq 0 ]; then
|
||||||
read -r confirm
|
printf "${YELLOW}Ready to rebuild the system with nixos-rebuild. Do you want to proceed? (y/n) ${NC}"
|
||||||
if [ "$confirm" != "y" ]; then
|
read -r confirm
|
||||||
printf "${RED}Aborting system rebuild.${NC}\n"
|
if [ "$confirm" != "y" ]; then
|
||||||
exit 0
|
printf "${RED}Aborting system rebuild.${NC}\n"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Rebuild system with new configuration
|
# Rebuild system with new configuration
|
||||||
|
|
Loading…
Reference in a new issue