diff --git a/setup.sh b/setup.sh index a49c40b..1311f38 100644 --- a/setup.sh +++ b/setup.sh @@ -4,15 +4,21 @@ # add a limited user account, modify sshd_config settings, and optionally install Docker CE # Variables -timezone="America/New_York" sshd_config="/etc/ssh/sshd_config" -docker_installed=false # Function to prompt for hostname prompt_for_hostname() { read -p "Please enter the desired hostname: " hostname } +# Function to prompt for timezone selection +prompt_for_timezone() { + echo "Available timezones:" + timedatectl list-timezones + read -p "Please enter the desired timezone (default: America/New_York): " timezone + timezone=${timezone:-"America/New_York"} # Default to America/New_York if no input +} + # Function to add hostname and IP to /etc/hosts update_hosts_file() { local ip_address @@ -52,7 +58,6 @@ install_docker() { usermod -aG docker "$username" echo "User $username added to the docker group." - } # Function to create a limited user account @@ -96,6 +101,9 @@ elif command -v yum &> /dev/null; then yum -y update fi +# Prompt for timezone selection +prompt_for_timezone + # Change the timezone echo "Setting timezone to $timezone..." timedatectl set-timezone "$timezone" @@ -167,4 +175,4 @@ elif command -v yum &> /dev/null; then yum -y autoremove fi -echo "System update complete! Timezone set to $timezone, hostname set to $hostname, limited user created, sshd_config modified, and Docker installation completed if selected." \ No newline at end of file +echo "System update complete! Timezone set to $timezone, hostname set to $hostname, limited user created, sshd_config modified, and Docker installation completed if selected."