Skip to content

Commit

Permalink
Update PR
Browse files Browse the repository at this point in the history
* Update PR to add a test for entrypoint.sh to exist, to assist with Docker first run scenario
  • Loading branch information
abraunegg committed Nov 1, 2023
1 parent 673c0a2 commit 677f076
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/config.d
Original file line number Diff line number Diff line change
Expand Up @@ -1803,8 +1803,16 @@ class ApplicationConfig {
// sync_dir was set in config file
if (configFileSyncDir != getValueString("sync_dir")) {
// config file was set and CLI input changed this
log.vdebug("sync_dir: CLI override of config file option, --resync needed");
syncDirDifferent = true;

// Is this potentially running as a Docker container?
if (entrypointExists) {
// entrypoint.sh exists
log.vdebug("sync_dir: CLI override of config file option, however entrypoint.sh exists, thus most likely first run of Docker container");
} else {
// entrypoint.sh does not exist
log.vdebug("sync_dir: CLI override of config file option, --resync needed");
syncDirDifferent = true;
}
}
}

Expand Down
8 changes: 8 additions & 0 deletions src/util.d
Original file line number Diff line number Diff line change
Expand Up @@ -799,4 +799,12 @@ string byteToGibiByte(ulong bytes) {
double gib = bytes / pow(1024.0,3);
double roundedGib = round(gib * 100) / 100;
return to!string(format("%.2f", roundedGib)); // Format to ensure two decimal places
}

// Test if entrypoint.sh exists on the root filesystem
bool entrypointExists() {
// build the path
string entrypointPath = buildNormalizedPath(buildPath("/", "entrypoint.sh"));
// return if path exists
return exists(entrypointPath);
}

0 comments on commit 677f076

Please sign in to comment.