Release: fix portable runtime and updater
This commit is contained in:
1 parent
659e4467e0
commit
978930f4d2
5 files changed
+45
-6
No files matched your search
+17
-1
@@ -120,7 +120,10 @@ namespace Echoion::Standalone
|
||||
if (std::filesystem::is_regular_file(
|
||||
packagedDirectory / "web" / "index.html", error) &&
|
||||
!error) {
|
||||
return packagedDirectory;
|
||||
// Installed config paths are rooted at the release prefix (for
|
||||
// example ./share/echoion/web), so the working directory must be
|
||||
// the installation root rather than share/echoion itself.
|
||||
return installRoot;
|
||||
}
|
||||
|
||||
error.clear();
|
||||
@@ -132,6 +135,19 @@ namespace Echoion::Standalone
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::optional<std::filesystem::path>
|
||||
bundledCertificateBundle(const std::filesystem::path& installRoot)
|
||||
{
|
||||
const auto bundle =
|
||||
installRoot / "share" / "echoion" / "certs" / "ca-certificates.crt";
|
||||
std::error_code error;
|
||||
if (!std::filesystem::is_regular_file(bundle, error) || error ||
|
||||
std::filesystem::file_size(bundle, error) == 0 || error) {
|
||||
return std::nullopt;
|
||||
}
|
||||
return bundle.lexically_normal();
|
||||
}
|
||||
|
||||
std::expected<std::filesystem::path, std::string>
|
||||
resolveAvatarCacheDirectory(
|
||||
const std::filesystem::path& configuredDirectory,
|
||||
|
||||
@@ -558,6 +558,16 @@ int main(int argc, char** argv)
|
||||
std::cerr << "Cannot export ECHOION_HOME\n";
|
||||
return 2;
|
||||
}
|
||||
if (!environmentPath("SSL_CERT_FILE")) {
|
||||
if (const auto certificateBundle =
|
||||
Echoion::Standalone::bundledCertificateBundle(installRoot)) {
|
||||
const auto bundleString = certificateBundle->string();
|
||||
if (::setenv("SSL_CERT_FILE", bundleString.c_str(), 0) != 0) {
|
||||
std::cerr << "Cannot export bundled TLS certificate store\n";
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const std::string_view requiredValue : {"--config", "--state-dir"}) {
|
||||
if (hasArgument(argc, argv, requiredValue) &&
|
||||
!optionalArgumentPath(argc, argv, requiredValue)) {
|
||||
|
||||
Reference in new issue
Block a user