36
36
handle_sigterm () {
37
37
log_warn " TERM signal received. Shutting down server."
38
38
# Only attempt to terminate if the child process is still running
39
- if kill -0 " $child_pid " 2> /dev/null; then
39
+ if kill -0 " $child_pid " 2> /dev/null; then
40
40
log_debug " Sending TERM signal to child pid: ${child_pid} "
41
- kill -TERM " $child_pid " 2> /dev/null
41
+ kill -TERM " $child_pid " 2> /dev/null
42
42
else
43
43
log_warn " Child pid: ${child_pid} exited before we could sent TERM signal."
44
44
fi
@@ -58,19 +58,19 @@ log_debug "Mount info for ${DATA_DIR}: ${mount_info}"
58
58
permissions_test_file=" ${DATA_DIR} /.container-permissions-test.txt"
59
59
permission_test_failed=0
60
60
log_debug " Testing permissions on ${permissions_test_file} "
61
- if ! touch " ${permissions_test_file} " 2> /dev/null; then
61
+ if ! touch " ${permissions_test_file} " 2> /dev/null; then
62
62
log_error " Volume write test failed."
63
63
permission_test_failed=1
64
64
else
65
65
log_debug " Volume write test succeeded."
66
66
fi
67
- if ! cat " ${permissions_test_file} " > /dev/null 2>&1 ; then
67
+ if ! cat " ${permissions_test_file} " > /dev/null 2>&1 ; then
68
68
log_error " Volume read test failed."
69
69
permission_test_failed=1
70
70
else
71
71
log_debug " Volume read test succeeded."
72
72
fi
73
- if ! rm -f " ${permissions_test_file} " 2> /dev/null; then
73
+ if ! rm -f " ${permissions_test_file} " 2> /dev/null; then
74
74
log_error " Volume delete test failed."
75
75
permission_test_failed=1
76
76
else
@@ -181,7 +181,7 @@ if [ $install_required = true ]; then
181
181
log " Using CONTAINER_CACHE: ${CONTAINER_CACHE} "
182
182
mkdir -p " ${CONTAINER_CACHE} "
183
183
# Create a cache marker file in the cache directory.
184
- cat << END_OF_LINE >"${CONTAINER_CACHE} /CACHEDIR.TAG"
184
+ cat << END_OF_LINE > "${CONTAINER_CACHE} /CACHEDIR.TAG"
185
185
Signature: $( printf " .IsCacheDirectory" | md5sum | cut -d ' ' -f 1)
186
186
# This file is a cache directory tag created by the felddy/foundryvtt container
187
187
# https://github.com/felddy/foundryvtt-docker
@@ -205,9 +205,9 @@ END_OF_LINE
205
205
curl ${CONTAINER_VERBOSE+--verbose} --fail --location \
206
206
--user-agent " ${curl_user_agent} " \
207
207
--time-cond " ${release_filename} " \
208
- --output " ${downloading_filename} " " ${presigned_url} " 2>&1 |
209
- tr " \r" " \n" |
210
- sed --unbuffered ' /^Warning: .* date/d'
208
+ --output " ${downloading_filename} " " ${presigned_url} " 2>&1 \
209
+ | tr " \r" " \n" \
210
+ | sed --unbuffered ' /^Warning: .* date/d'
211
211
curl_exit_code=$?
212
212
set -e
213
213
@@ -225,7 +225,7 @@ END_OF_LINE
225
225
else
226
226
# Download succeeded so rename the file to the final name.
227
227
# If we had a cache hit, the file is already renamed.
228
- mv " ${downloading_filename} " " ${release_filename} " > /dev/null 2>&1 || true
228
+ mv " ${downloading_filename} " " ${release_filename} " > /dev/null 2>&1 || true
229
229
fi
230
230
fi
231
231
@@ -275,7 +275,7 @@ END_OF_LINE
275
275
log " Preserving release archive file in cache."
276
276
# Check if CONTAINER_CACHE_SIZE is set and if so, ensure it's greater than 0
277
277
if [[ -n " ${CONTAINER_CACHE_SIZE:- } " ]]; then
278
- if ! [[ " ${CONTAINER_CACHE_SIZE} " -gt 0 ]] 2> /dev/null; then
278
+ if ! [[ " ${CONTAINER_CACHE_SIZE} " -gt 0 ]] 2> /dev/null; then
279
279
log_error " If set, CONTAINER_CACHE_SIZE must be 1 or greater. Found: ${CONTAINER_CACHE_SIZE} "
280
280
exit 1
281
281
fi
@@ -286,9 +286,9 @@ END_OF_LINE
286
286
cache_files_removed_count=0
287
287
288
288
# Store the list of cache files to remove
289
- file_list=$( find " ${CONTAINER_CACHE} " -maxdepth 1 -name ' foundryvtt-*.zip' |
290
- sort -Vr |
291
- awk -v keep=" ${CONTAINER_CACHE_SIZE} " ' NR > keep' )
289
+ file_list=$( find " ${CONTAINER_CACHE} " -maxdepth 1 -name ' foundryvtt-*.zip' \
290
+ | sort -Vr \
291
+ | awk -v keep=" ${CONTAINER_CACHE_SIZE} " ' NR > keep' )
292
292
293
293
# Iterate over the file list
294
294
if [ -n " $file_list " ]; then
@@ -359,7 +359,7 @@ if [ ! -f "${LICENSE_FILE}" ]; then
359
359
set -o nounset
360
360
log " Applying license key passed via FOUNDRY_LICENSE_KEY."
361
361
# FOUNDRY_LICENSE_KEY is long enough to be a key
362
- echo " { \" license\" : \" ${FOUNDRY_LICENSE_KEY} \" }" | tr -d ' -' > " ${LICENSE_FILE} "
362
+ echo " { \" license\" : \" ${FOUNDRY_LICENSE_KEY} \" }" | tr -d ' -' > " ${LICENSE_FILE} "
363
363
elif [ -f ${cookiejar_file} ]; then
364
364
log " Attempting to fetch license key from authenticated account."
365
365
if [[ " ${FOUNDRY_LICENSE_KEY:- } " ]]; then
@@ -376,7 +376,7 @@ if [ ! -f "${LICENSE_FILE}" ]; then
376
376
--user-agent=" ${node_user_agent} " \
377
377
" ${cookiejar_file} " )
378
378
fi
379
- echo " { \" license\" : \" ${fetched_license_key} \" }" > " ${LICENSE_FILE} "
379
+ echo " { \" license\" : \" ${fetched_license_key} \" }" > " ${LICENSE_FILE} "
380
380
else
381
381
log_warn " Unable to apply a license key since neither a license key nor credentials were provided. The license key will need to be entered in the browser."
382
382
fi
0 commit comments