Changeset - b01f9cb4f6fd
[Not reviewed]
0 1 0
Branko Majic (branko) - 4 years ago 2020-07-06 15:41:45
branko@majic.rs
Noticket: [factorio_manager.sh] Drop unused variables as reported by shellcheck.
1 file changed with 14 insertions and 8 deletions:
0 comments (0 inline, 0 general) First comment
games/factorio_manager.sh
Show inline comments
 
@@ -265,19 +265,28 @@ else
 
    _text_cyan=""
 
    _text_white=""
 

	
 
    _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
 

	
 
# Make the colors available via an associative array as well.
 
declare -A _text_colors=()
 

	
 
@@ -552,13 +561,13 @@ function validate_server_setting_value() {
 
function read_server_settings() {
 

	
 
    # Read arguments.
 
    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=()
 
    declare -A settings_type=()
 

	
 
    declare -a settings_order=()
 
@@ -1155,13 +1164,14 @@ if [[ -z ${1-} ]]; then
 
    exit "$SUCCESS"
 
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";;
 
        h) usage
 
           exit "$SUCCESS";;
 
        *) usage
 
@@ -1546,13 +1556,12 @@ elif [[ $command == restore ]]; then
 
    shift 2
 

	
 
    # Set-up derived values.
 
    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.
 
    if [[ -z $instance ]]; then
 
        error "Missing argument: INSTANCE"
 
        exit "$ERROR_ARGUMENTS"
 
@@ -1660,13 +1669,12 @@ elif [[ $command == remove-backup ]]; then
 
    fi
 

	
 
    # Set-up derived values.
 
    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.
 
    validate_path_or_terminate "instance_directory" "$instance_directory" "$ERROR_ARGUMENTS"
 

	
 
    # Validate that backup directory contains valid backup.
 
@@ -2007,13 +2015,12 @@ elif [[ $command == copy ]]; then
 
        exit "$ERROR_ARGUMENTS"
 
    fi
 

	
 
    # 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"
 
    destination_instance_config="$destination_instance_directory/instance.conf"
 

	
 
    # Validate that source instance directory contains valid instance.
 
@@ -2101,13 +2108,12 @@ elif [[ $command == import ]]; then
 

	
 
    # Calculate derived variables.
 
    instance_directory="$manager_directory/$instance"
 
    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.
 
    validate_path_or_terminate "instance_directory_new" "$instance_directory" "$ERROR_ARGUMENTS"
 

	
 
    # Make sure that the import source is valid (should be Factorio
 
@@ -2336,14 +2342,14 @@ EOF
 

	
 
    # Generate main save/map.
 
    info "Generating default savegame/map."
 
    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
 

	
 
    success "Created new server instance $(colorecho -n green "$instance")"
 
else
 
    error "Invalid command: $command"
0 comments (0 inline, 0 general) First comment
You need to be logged in to comment. Login now