From e43e9726ea088710fd5c1e7d4debc51e23cc7b6d Mon Sep 17 00:00:00 2001 From: TrudeEH Date: Thu, 27 Mar 2025 12:14:11 +0000 Subject: [PATCH] Add reload option to install script --- install.sh | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index d6889c3f..2d066027 100755 --- a/install.sh +++ b/install.sh @@ -1,5 +1,7 @@ #!/bin/bash +# -r : Only reload configurations + # Colors RED='\033[0;31m' GREEN='\033[0;32m' @@ -37,6 +39,15 @@ install_gnome_extension() { fi } +# Flags +reload=false +for arg in "$@"; do + if [ "$arg" = "-r" ]; then + reload=true + break + fi +done + # Clone Dotfiles if not already present cd "$HOME/dotfiles" if [ "$(pwd)" != "$HOME/dotfiles" ]; then @@ -83,7 +94,7 @@ printf "${CYAN}Desktop: ${PURPLE}%s${NC}\n" "$XDG_CURRENT_DESKTOP" printf "\n" # Install Programs -if [ -z "$nixos" ]; then +if [ "$reload" = false ] && [ -z "$nixos" ]; then programs=(neovim curl git tmux htop fzf gcc make tldr pass lynis bat) if [[ "$OSTYPE" != "darwin"* ]]; then @@ -133,7 +144,7 @@ else fi # UFW Firewall -if [ -z "$nixos" ] && [[ "$OSTYPE" != "darwin"* ]]; then +if [ "$reload" = false ] && [ -z "$nixos" ] && [[ "$OSTYPE" != "darwin"* ]]; then printf "${YELLOW}Setting up UFW...${NC}\n" sudo ufw default deny incoming sudo ufw default allow outgoing @@ -149,7 +160,7 @@ if [ -z "$nixos" ] && [[ "$OSTYPE" != "darwin"* ]]; then else printf "${GREEN}UFW setup successfully.${NC}\n" fi -elif [[ "$OSTYPE" == "darwin"* ]]; then +elif [[ "$OSTYPE" == "darwin"* && "$reload" = false ]]; then printf "${YELLOW}Enabling macOS Firewall...${NC}\n" sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate on if [ $? -ne 0 ]; then @@ -192,7 +203,7 @@ if [ "$USER" = "trude" ]; then fi # Security Scan -if [ ! -f "$HOME/dotfiles/logs/lynis_scan.log" ]; then +if [ "$reload" = false ] && [ ! -f "$HOME/dotfiles/logs/lynis_scan.log" ]; then printf "${YELLOW}Running Lynis Security Scan...${NC}\n" sudo lynis audit system | tee "$HOME/dotfiles/logs/lynis_scan.log" if [ $? -ne 0 ]; then