#!/bin/bash # Matthew Hutchinson # Rocky 9 System Configuration Tweaks for Cluster Nodes ID=$(grep -w ID= /etc/os-release | cut -d= -f2 | tr -d '"') Platform=$(grep -w PLATFORM_ID= /etc/os-release | cut -d= -f2 | tr -d '"') # Check if the OS is Rocky Linux 9 if [[ "$ID" != "rocky" && "$ID" != "rhel" || "$Platform" != "platform:el9" ]]; then echo "OS is not Rocky9 or Rhel9 Linux" exit 1 fi interpreter=$(ps -p $$ | awk '$1 != "PID" {print $(NF)}' | tr -d '()') if [ "$interpreter" != "bash" ]; then echo "Please run with bash. (\`./rocky-preconfig.sh\` or \`bash rocky-preconfig.sh\`)" echo "Current interpreter: $interpreter" exit 1 fi euid=$(id -u) if [[ "$euid" != 0 ]]; then echo "Please run as root or with sudo." exit 1 fi welcome() { local response cat < .rocky-preconfig.progress ;& 1) echo "################################################################################" install_epel_release echo 2 > .rocky-preconfig.progress ;& 2) echo "################################################################################" selinux_permissive echo 3 > .rocky-preconfig.progress ;& 3) echo "################################################################################" houston_configuration echo 4 > .rocky-preconfig.progress ;& 4) echo "################################################################################" update_system echo 5 > .rocky-preconfig.progress ;& 5) echo "################################################################################" setup_done echo 6 > .rocky-preconfig.progress ;& 6) echo "Setup successfully finished the previous time running this script." ;; esac exit 0