Changeset - b996dd49a6c7
[Not reviewed]
0 1 0
Branko Majic (branko) - 4 years ago 2020-07-05 16:52:29
branko@majic.rs
Noticket: Updated help for Factorio Manager, and bumped the script version to 0.2.
1 file changed with 90 insertions and 40 deletions:
0 comments (0 inline, 0 general)
games/factorio_manager.sh
Show inline comments
 
@@ -22,7 +22,7 @@
 
set -u
 

	
 
program="factorio_manager.sh"
 
version="0.1"
 
version="0.2"
 

	
 
function synopsis() {
 
cat <<EOF
 
@@ -63,49 +63,47 @@ function usage() {
 
    cat <<EOF
 
$(synopsis)
 

	
 
$program is a helper tool for managing multiple Factorio
 
instances.
 
$program is a helper tool for managing multiple Factorio instances.
 

	
 
Each instance is designated a dedicated directory, which contains all
 
of its configuration files, saves games, and mods, and is kept
 
separate from all other instances.
 

	
 
A single Factorio version installation (base files) can be used by
 
multiple instances, but each instance is bound to a specific version
 
of Factorio.
 
Each instance is bound to a specific game version, and the manager
 
fully supports working with multiple versions of Factorio. Base game
 
files are kept intact and can be shared by multiple instances.
 

	
 
Factorio Manager keeps instances in sub-directories under the
 
~/.factorio/ directory. Sub-directories are named after the
 
instances. The following instance names are reserved for special use
 
by the tool:
 
~/.factorio/ directory. Sub-directories correspond to instance
 
names.
 

	
 
The following instance names are reserved for special use by
 
the tool:
 

	
 
 - .game_installations (used for storing symlink towards directory
 
   containing Factorio installations)
 

	
 
Multiple commands are provided for managing Factorio instances, and
 
they all expect different positional parameters:
 

	
 

	
 
set-game-dir GAME_INSTALLATIONS_DIRECTORY
 
Multiple commands are provided for managing Factorio instances. Each
 
command accepts its own set of positional arguments.
 

	
 
    Sets the passed-in directory path as the base directory where
 
    different versions of Factorio will be looked-up. Each
 
    sub-directory within this directory should be named after the
 
    version of Factorio it represents, and should be the base
 
    directory under which the Factorio installation files can be
 
    found.
 

	
 

	
 
versions
 

	
 
    Shows locally available Factorio versions.
 
backup INSTANCE [DESCRIPTION]
 

	
 
    Creates backup of an instance. All backups will be stored as
 
    subdirectories under the .bak directory within the instance
 
    directory. An optional description can be passed-in to make it
 
    easier to distinguish between different backups. Hidden files
 
    (names starting with '.') will be omitted from the backup.
 

	
 
list
 

	
 
    Lists available Factorio instances, and shows some basic
 
    information about them.
 
copy SOURCE_INSTANCE DESTINATION_INSTANCE
 

	
 
    Creates a copy of an existing instance. Requires name of an
 
    existing instance and name of the new instance to be passed-in as
 
    arguments. Command will refuse to overwrite destination instance
 
    if it already exists. Command will prompt user to specify desired
 
    version for the copy, and to choose whether the backups should be
 
    copied as well.
 

	
 
create INSTANCE
 

	
 
@@ -113,12 +111,7 @@ create INSTANCE
 
    prompt the user to pick between locally available Factorio
 
    versions.
 

	
 

	
 
launch INSTANCE
 

	
 
    Launches an instance with the given name.
 

	
 
    NOTE:: When launching the instance for the first time, Factorio
 
    NOTE: When launching the instance for the first time, Factorio
 
    will report that its configuration file is invalid, and offer to
 
    fix it. The reason is that the manager creates a minimal
 
    configuration file when creating an instance, and Factorio does
 
@@ -126,19 +119,76 @@ launch INSTANCE
 
    configuration file (this will populate it with the necessary
 
    commented-out options).
 

	
 
create-server INSTANCE
 

	
 
backup INSTANCE [DESCRIPTION]
 
    Creates a new Factorio server instance with the given
 
    name. Command will prompt the user to pick between locally
 
    available Factorio versions, and to provide settings for server.
 

	
 
    Creates backup of an instance. All backups will be stored as
 
    subdirectories under the .bak directory within the instance
 
    directory. An optional description can be passed-in to make it
 
    easier to distinguish between different backups. Hidden files
 
    (names starting with '.') will be omitted from the backup.
 
import INSTANCE
 

	
 
    Creates a new instance out of existing files found within a
 
    Factorio installation directory. This command is useful when
 
    migrating from Factorio installations that store all data in the
 
    root of the game installation directory. Command will prompt the
 
    user to pick between locally available Factorio versions.
 

	
 
info INSTANCE
 

	
 
    Shows information about the specified instance. This includes:
 

	
 
        - instance name
 
        - game version
 
        - instance directory path
 
        - list of enabled/disabled mods
 
        - list of backups
 

	
 
launch INSTANCE
 

	
 
    Launches the instance with specified name. See the note for the
 
    "create" command.
 

	
 
list
 

	
 
    Lists available Factorio instances.
 

	
 
list-backups INSTANCE
 

	
 
    Lists available backups of an instance, including description (if any is set).
 
    Lists available backups for the specified instance.
 

	
 
remove-backup INSTANCE BACKUP_NAME
 

	
 
    Removes the specified backup for the specified instance. User must
 
    confirm the action prior to any files being removed.
 

	
 
remove INSTANCE
 

	
 
    Removes the specified instance. User must confirm the action prior
 
    to any files being removed.
 

	
 
restore INSTANCE BACKUP_NAME
 

	
 
    Restores the specified instance from the specified backup. User
 
    must confirm the action prior to any files being replaced.
 

	
 
set-game-dir GAME_INSTALLATIONS_DIRECTORY
 

	
 
    Sets the base directory where Factorio game installations can be
 
    found. Each sub-directory within this directory should be named
 
    after the version of Factorio it represents. For example:
 

	
 
        - ~/local/games/factorio/0.17.79/
 
        - ~/local/games/factorio/0.18.30/
 
        - ~/local/games/factorio/0.18.34/
 

	
 
set-version INSTANCE
 

	
 
    Sets Factorio version for the specified instance. User is prompted
 
    to pick between locally available versions.
 

	
 
versions
 

	
 
    Shows locally available Factorio versions.
 

	
 

	
 
$program accepts the following options:
0 comments (0 inline, 0 general)