diff --git a/.gitea/workflows/DRBv3-Client_Setup_tests.yaml b/.gitea/workflows/DRBv3-Client_Setup_tests.yaml index 404d65d..6673eb3 100644 --- a/.gitea/workflows/DRBv3-Client_Setup_tests.yaml +++ b/.gitea/workflows/DRBv3-Client_Setup_tests.yaml @@ -23,4 +23,4 @@ jobs: - name: Test setup script working-directory: "./client" run: | - sudo bash setup.sh \ No newline at end of file + sudo bash setup.sh --test \ No newline at end of file diff --git a/.gitea/workflows/DRBv3_tests.yaml b/.gitea/workflows/DRBv3_tests.yaml index 1dd1e6c..b5717dd 100644 --- a/.gitea/workflows/DRBv3_tests.yaml +++ b/.gitea/workflows/DRBv3_tests.yaml @@ -75,8 +75,4 @@ jobs: working-directory: "./client" run: npm test - - run: echo "Completed the NPM tests" - - - name: Start discord-radio-bot service - working-directory: "./client" - run: systemctl start discord-radio-bot.service \ No newline at end of file + - run: echo "Completed the DRB tests" \ No newline at end of file diff --git a/client/setup.sh b/client/setup.sh index ddaf039..14643af 100644 --- a/client/setup.sh +++ b/client/setup.sh @@ -19,43 +19,67 @@ fi ####------------------- Functions # Function to prompt user for input with a specific message and store the result in a variable prompt_user() { - read -p "$1: " input - echo "$input" + if [[ "$TEST_MODE" == "true" ]]; then + echo "TESTING" # Use the pre-set value + else + read -p "$1: " input + echo "$input" + fi } # Function to prompt user for capabilities options and store the result in a variable prompt_capabilities() { - default_capabilities="radio" # Default value - read -p "Select CLIENT_CAPABILITIES (comma-separated, default: $default_capabilities): " capabilities - capabilities="${capabilities:-$default_capabilities}" # Use default value if input is empty - echo "$capabilities" + if [[ "$TEST_MODE" == "true" ]]; then + echo "radio" # Use the pre-set value + else + default_capabilities="radio" # Default value + read -p "Select CLIENT_CAPABILITIES (comma-separated, default: $default_capabilities): " capabilities + capabilities="${capabilities:-$default_capabilities}" # Use default value if input is empty + echo "$capabilities" + fi } # Function to prompt user for nearby systems details prompt_nearby_system() { - local system_name="" - local frequencies="" - local mode="" - local trunk_file="" - local whitelist_file="" + if [[ "$TEST_MODE" == "true" ]]; then + echo "\"TESTING-Node\": { + \"frequencies\": [\"$(echo "155750000,154750000,156555550" | sed 's/,/","/g')\"], + \"mode\": \"p25\", + \"trunkFile\": \"testing_trunk.tsv\", + \"whitelistFile\": \"testing_whitelist.tsv\" + }," # Use the pre-set value + else + local system_name="" + local frequencies="" + local mode="" + local trunk_file="" + local whitelist_file="" - read -p "Enter system name: " system_name - read -p "Enter frequencies (comma-separated): " frequencies - read -p "Enter mode (p25/nbfm): " mode + read -p "Enter system name: " system_name + read -p "Enter frequencies (comma-separated): " frequencies + read -p "Enter mode (p25/nbfm): " mode - if [[ "$mode" == "p25" ]]; then - read -p "Enter trunk file: " trunk_file - read -p "Enter whitelist file: " whitelist_file + if [[ "$mode" == "p25" ]]; then + read -p "Enter trunk file: " trunk_file + read -p "Enter whitelist file: " whitelist_file + fi + + echo "\"$system_name\": { + \"frequencies\": [\"$(echo "$frequencies" | sed 's/,/","/g')\"], + \"mode\": \"$mode\", + \"trunkFile\": \"$trunk_file\", + \"whitelistFile\": \"$whitelist_file\" + }," fi - - echo "\"$system_name\": { - \"frequencies\": [\"$(echo "$frequencies" | sed 's/,/","/g')\"], - \"mode\": \"$mode\", - \"trunkFile\": \"$trunk_file\", - \"whitelistFile\": \"$whitelist_file\" -}," } +# Check if test mode is enabled +if [[ "$1" == "--test" ]]; then + TEST_MODE="true" +else + TEST_MODE="false" +fi + # Install Node Repo # Get the CPU architecture cpu_arch=$(uname -m)