Skip to content

Commit 7674546

Browse files
committed
adding update mod check on mod script to avoid it always updating mods
1 parent 487dd22 commit 7674546

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#### Non-Breaking Changes
66

77
- Fixing mod download script to encode spaces properly, fixes [Issue 42](https://github.com/SQLJames/factorio-server-charts/issues/42)
8+
- Adding update mod check on mod script to avoid it always updating mods, fixes part of[Issue 45](https://github.com/SQLJames/factorio-server-charts/issues/45)
89

910
### V2.2.0
1011

charts/factorio-server-charts/templates/deployment.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ spec:
9797
securityContext:
9898
{{- toYaml . | nindent 12 }}
9999
{{- end }}
100+
env:
101+
- name: UPDATE_MODS_ON_START
102+
value: {{ .Values.factorioServer.update_mods_on_start | quote }}
100103
volumeMounts:
101104
- name: datadir
102105
mountPath: /factorio

charts/factorio-server-charts/templates/mod-downloader-configmap.yaml

+10-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ data:
1111
# credit to the factoriotools/factorio-docker team, most of this logic came from them
1212
# https://github.com/factoriotools/factorio-docker/blob/master/docker/files/update-mods.sh
1313
mod-downloader.sh: |
14+
FLAG_FILE="/factorio/mods/.mod_update_complete"
15+
16+
# Check if flag file exists and UPDATE_MODS_ON_START is not true
17+
if [[ -f "$FLAG_FILE" && "${UPDATE_MODS_ON_START}" != "true" ]]; then
18+
echo "Mod update already completed previously. Skipping."
19+
exit 0
20+
fi
1421
modDir=/factorio/mods
1522
MOD_BASE_URL="https://mods.factorio.com"
1623
declare -a officialMods
@@ -109,7 +116,9 @@ data:
109116
done
110117
fi
111118
fi
112-
119+
# Mark the update as complete by creating the flag file
120+
touch "$FLAG_FILE"
121+
echo "Mod update completed."
113122
114123
115124

0 commit comments

Comments
 (0)