Skip to content

Commit b180c6b

Browse files
author
zone-zero
committed
updated save-importer and documentation
1 parent a7e8e38 commit b180c6b

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

charts/factorio-server-charts/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,20 @@ serverPassword:
106106
# Existing Secret containing a `game_password` data entry
107107
passwordSecret: ''
108108
```
109+
## Importing a save file
110+
111+
> :warning: Importing a save file will **DESTROY THE SERVER SAVEFILE** with the name specified in `factorioServer.save_name`. Import with caution!
112+
113+
To import an existing save file, start/restart the pod at least once. This will create the factorio folder structure.
114+
115+
Now, copy your existing savegame to the `/factorio/save_to_import/<existing_savegame_name>.zip` on the running pod using whatever mechanism you prefer. To do this with kubectl:
116+
117+
```bash
118+
kubectl cp ./my_existing_savegame.zip <namespace>/<pod_name>:/factorio/save_to_import
119+
```
120+
121+
Restart the pod again to import your save file.
122+
109123

110124
## Installing mods
111125

@@ -221,6 +235,7 @@ If you do run into any issues with mods, I will try to work with you on finding
221235
| `factorioServer.generate_new_save` | Generate a new save if `save_name` is not found | `true` |
222236
| `factorioServer.update_mods_on_start` | Update mods on server start | `false` |
223237
| `factorioServer.load_latest_save` | Lets the game know if you want to load the latest save | `true` |
238+
| `factorioServer.import_save` | Import an existing save file from '/factorio/save_to_import'. **:warning: Overwrites existing save** | `true` |
224239
| `account.accountSecret` | Existing secret containing a valid factorio.com username and either a password or a token (or both) | `""` |
225240
| `account.username` | Factorio.com username, ignored if `account.accountSecret` is set | `""` |
226241
| `account.password` | Factorio.com password, ignored if `account.accountSecret` is set | `""` |

charts/factorio-server-charts/templates/save-importer-configmap.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ metadata:
99
heritage: "{{ .Release.Service }}"
1010
data:
1111
save-importer.sh: |
12-
message_prefix="save-importer.sh:"
12+
message_prefix="save-importer: "
1313
source_dir="/factorio/save_to_import"
1414
target_dir="/factorio/saves"
1515
target_filename="{{ .Values.factorioServer.save_name }}.zip"
@@ -44,8 +44,13 @@ data:
4444
echo "$message_prefix Error copying the file."
4545
exit 1
4646
fi
47+
elif [ "$count" -eq 0 ]; then
48+
echo "$message_prefix No save file found in '$source_dir'"
49+
echo "$message_prefix Skipping save import process."
50+
fi
4751
else
48-
echo "$message_prefix No save file found in '$source_dir' or multiple save files found."
52+
echo "$message_prefix Multiple save file found in '$source_dir'"
53+
echo "$message_prefix Not sure what to do here. Put only one factorio save zip file in '$source_dir' to enable the import process."
4954
echo "$message_prefix Skipping save import process."
5055
fi
5156

0 commit comments

Comments
 (0)