From b01f9cb4f6fd995176866bfc9576f89925f0d350 2020-07-06 15:41:45
From: Branko Majic <branko@majic.rs>
Date: 2020-07-06 15:41:45
Subject: [PATCH] Noticket: [factorio_manager.sh] Drop unused variables as reported by shellcheck.

---

diff --git a/games/factorio_manager.sh b/games/factorio_manager.sh
index 7caf4cfdc0f1c3f394117953e422c24a9558b119..4fc1222a4beadb82f813836d5fffb061967231f6 100755
--- a/games/factorio_manager.sh
+++ b/games/factorio_manager.sh
@@ -268,13 +268,22 @@ else
     _text_bold=""
     _text_reset=""
 
+    # Part of the standard Majic Bash script template.
+    # shellcheck disable=SC2034
     _bg_black=""
+    # shellcheck disable=SC2034
     _bg_red=""
+    # shellcheck disable=SC2034
     _bg_green=""
+    # shellcheck disable=SC2034
     _bg_yellow=""
+    # shellcheck disable=SC2034
     _bg_blue=""
+    # shellcheck disable=SC2034
     _bg_purple=""
+    # shellcheck disable=SC2034
     _bg_cyan=""
+    # shellcheck disable=SC2034
     _bg_white=""
 fi
 
@@ -555,7 +564,7 @@ function read_server_settings() {
     local server_name="$1"
 
     # Local helper variables.
-    local key="" value="" prompt="" confirmed="" item="" validation_passed possible_values i
+    local key="" value="" prompt="" confirmed="" item="" possible_values i
 
     declare -A settings_prompt=()
     declare -A settings_description=()
@@ -1158,7 +1167,8 @@ fi
 # Parse the arguments
 while getopts "qdvh" opt; do
     case "$opt" in
-	q) quiet=1;;
+	q) # shellcheck disable=SC2034 # part of standard Bash script template.
+           quiet=1;;
 	d) debug=1;;
         v) version
            exit "$SUCCESS";;
@@ -1549,7 +1559,6 @@ elif [[ $command == restore ]]; then
     instance_directory="$manager_directory/$instance"
     restore_source="$instance_directory/.bak/$backup_name"
     backup_instance_config="$restore_source/instance.conf"
-    backup_game_config="$restore_source/config.ini"
     lock_file="$instance_directory/.lock"
 
     # Verify positional arguments.
@@ -1663,7 +1672,6 @@ elif [[ $command == remove-backup ]]; then
     instance_directory="$manager_directory/$instance"
     removal_target="$instance_directory/.bak/$backup_name"
     backup_instance_config="$removal_target/instance.conf"
-    backup_game_config="$removal_target/config.ini"
     lock_file="$instance_directory/.lock"
 
     # Validate that instance directory contains valid instance.
@@ -2010,7 +2018,6 @@ elif [[ $command == copy ]]; then
     # Calculate derived variables.
     source_instance_directory="$manager_directory/$source_instance"
     source_instance_config="$source_instance_directory/instance.conf"
-    source_game_config="$source_instance_directory/config.ini"
     source_lock_file="$source_instance_directory/.lock"
 
     destination_instance_directory="$manager_directory/$destination_instance"
@@ -2104,7 +2111,6 @@ elif [[ $command == import ]]; then
     instance_config="$instance_directory/instance.conf"
     game_config="$instance_directory/config.ini"
 
-    source_config="$source_directory/config/config.ini"
     source_lock_file="$source_directory/.lock"
 
     # Make sure new instance directory can be used.
@@ -2339,8 +2345,8 @@ EOF
     game_directory="${game_installations_directory}/${game_version_selected}"
     factorio_bin="$game_directory/bin/x64/factorio"
 
-    if ! "$factorio_bin" --config "$game_config" --create "$saves_directory/default.zip"; then
-        error "Failed to generate default savegame/map under: $saves_directory/default.zip"
+    if ! "$factorio_bin" --config "$game_config" --create "$main_save"; then
+        error "Failed to generate default savegame/map under: $main_save"
         exit "$ERROR_GENERAL"
     fi