Changeset - 09c52b03d177
[Not reviewed]
0 1 0
Branko Majic (branko) - 4 years ago 2020-07-06 17:17:15
branko@majic.rs
Noticket: [factorio_manager.sh] Disable checks for concurrent reading/writing to a lock file:

- Warnings will still trigger for 200>"$lock_file" lines, but
currently it does not seem possible to disable the check for those
lines only - unless the check is disabled for the entire subshell.
1 file changed with 5 insertions and 2 deletions:
0 comments (0 inline, 0 general) First comment
games/factorio_manager.sh
Show inline comments
 
@@ -1468,13 +1468,13 @@ elif [[ $command == backup ]]; then
 
    validate_path_or_terminate "instance_directory" "$instance_directory" "$ERROR_ARGUMENTS"
 

	
 
    # Validate destination path for backup directory can be used.
 
    validate_path_or_terminate "backup_directory_new" "$backup_destination" "$ERROR_GENERAL"
 

	
 
    (
 

	
 
        # shellcheck disable=SC2094 # Lock file is not being read from.
 
        lock "$lock_file" 200
 

	
 
        # Backup the instance. Clean-up the backup destination in case of failure.
 
        mkdir -p "$backup_destination"
 
        if ! cp -a "$instance_directory"/* "$backup_destination"; then
 
            error "Could not create backup under: $backup_destination"
 
@@ -1591,12 +1591,13 @@ elif [[ $command == restore ]]; then
 
    validate_path_or_terminate "instance_directory" "$instance_directory" "$ERROR_ARGUMENTS"
 

	
 
    # Validate that backup directory contains valid backup.
 
    validate_path_or_terminate "backup_directory" "$restore_source" "$ERROR_ARGUMENTS"
 

	
 
    (
 
        # shellcheck disable=SC2094 # Lock file is not being read from.
 
        lock "$lock_file" 200
 

	
 
        # Set-up a list of files and directories that will get removed.
 
        shopt -s nullglob
 
        entries_to_remove=("$instance_directory"/*)
 
        shopt -u nullglob
 
@@ -1944,12 +1945,13 @@ elif [[ $command == remove ]]; then
 
    lock_file="$instance_directory/.lock"
 

	
 
    # Validate that instance directory contains valid instance.
 
    validate_path_or_terminate "instance_directory" "$instance_directory" "$ERROR_ARGUMENTS"
 

	
 
    (
 
        # shellcheck disable=SC2094 # Lock file is not being read from.
 
        lock "$lock_file" 200
 

	
 
        # Set-up a list of files and directories that will get removed.
 
        shopt -s nullglob dotglob
 
        entries_to_remove=("$instance_directory"/*)
 
        shopt -u nullglob dotglob
 
@@ -2047,12 +2049,13 @@ elif [[ $command == copy ]]; then
 
    validate_path_or_terminate "instance_directory" "$source_instance_directory" "$ERROR_ARGUMENTS"
 

	
 
    # Make sure destination instance directory can be used.
 
    validate_path_or_terminate "instance_directory_new" "$destination_instance_directory" "$ERROR_ARGUMENTS"
 

	
 
    (
 
        # shellcheck disable=SC2094 # Lock file is not being read from.
 
        lock "$source_lock_file" 200
 

	
 
        # Load source instance configuration.
 
        # shellcheck source=/dev/null
 
        source "$source_instance_config"
 

	
 
@@ -2192,13 +2195,13 @@ elif [[ $command == import ]]; then
 
    # Display list of available Factorio versions and let user pick one.
 
    echo "Factorio version must  be selected manually for imported instances."
 
    echo
 
    select_factorio_version "$game_installations_directory" || exit "$ERROR_GENERAL"
 

	
 
    (
 

	
 
        # shellcheck disable=SC2094 # Lock file is not being read from.
 
        lock "$source_lock_file" 200
 

	
 
        # Create instance directory.
 
        mkdir "$instance_directory"
 

	
 
        # Copy files and directories.
0 comments (0 inline, 0 general) First comment
You need to be logged in to comment. Login now