From fb8fb69532a02c2a1983ea733ed49a34b69b7700 Mon Sep 17 00:00:00 2001 From: faumaray Date: Sun, 26 Jul 2026 16:48:53 +0300 Subject: [PATCH] Release: fix portable runtime and updater --- EchoionCore | 2 +- .../echoion/standalone/RuntimePaths.hpp | 3 ++ EchoionStandalone/src/RuntimePaths.cpp | 18 ++++++++- EchoionStandalone/src/main.cpp | 10 +++++ .../tests/test_runtime_paths.cpp | 18 ++++++--- EchoionStandalone/tests/test_stage_release.sh | 2 + .../src/components/TeamSpeakAdmin.tsx | 10 ++++- EchoionWeb/frontend/src/lib/teamspeak.test.ts | 33 ++++++++++++++++ EchoionWeb/frontend/src/lib/teamspeak.ts | 33 ++++++++++++++++ EchoionWeb/frontend/src/styles/style.css | 34 ++++++++++++++++ .../frontend/src/views/DashboardView.tsx | 28 +++++++++---- cmake/DependencyLock.cmake | 2 +- packaging/README.md | 9 ++++- packaging/tests/installer_test.sh | 4 +- packaging/tests/updater_test.sh | 5 ++- packaging/updater/ReleaseTree.cpp | 1 + scripts/release.sh | 19 +++++++-- scripts/tests/test-release-packaging.sh | 4 ++ scripts/tests/test-runtime-dependencies.sh | 39 +++++++++++++++++-- scripts/validate-release-elf.py | 6 ++- scripts/validate-release-manifest.py | 1 + 21 files changed, 252 insertions(+), 29 deletions(-) create mode 100644 EchoionWeb/frontend/src/lib/teamspeak.test.ts create mode 100644 EchoionWeb/frontend/src/lib/teamspeak.ts diff --git a/EchoionCore b/EchoionCore index 7975f2b..dfbbdaa 160000 --- a/EchoionCore +++ b/EchoionCore @@ -1 +1 @@ -Subproject commit 7975f2b38e76c185f85e2d80a9777b8fbba065e5 +Subproject commit dfbbdaaf017cd16851bf8422d0a20d37ec8a8e6a diff --git a/EchoionStandalone/include/echoion/standalone/RuntimePaths.hpp b/EchoionStandalone/include/echoion/standalone/RuntimePaths.hpp index 88122a1..8ee1646 100644 --- a/EchoionStandalone/include/echoion/standalone/RuntimePaths.hpp +++ b/EchoionStandalone/include/echoion/standalone/RuntimePaths.hpp @@ -32,6 +32,9 @@ namespace Echoion::Standalone const std::filesystem::path& installRoot, const std::filesystem::path& executableDirectory); + [[nodiscard]] std::optional + bundledCertificateBundle(const std::filesystem::path& installRoot); + [[nodiscard]] std::expected resolveAvatarCacheDirectory( const std::filesystem::path& configuredDirectory, diff --git a/EchoionStandalone/src/RuntimePaths.cpp b/EchoionStandalone/src/RuntimePaths.cpp index 7996086..ffceb14 100644 --- a/EchoionStandalone/src/RuntimePaths.cpp +++ b/EchoionStandalone/src/RuntimePaths.cpp @@ -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 + 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 resolveAvatarCacheDirectory( const std::filesystem::path& configuredDirectory, diff --git a/EchoionStandalone/src/main.cpp b/EchoionStandalone/src/main.cpp index b9e4c23..b551194 100644 --- a/EchoionStandalone/src/main.cpp +++ b/EchoionStandalone/src/main.cpp @@ -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)) { diff --git a/EchoionStandalone/tests/test_runtime_paths.cpp b/EchoionStandalone/tests/test_runtime_paths.cpp index 053451f..7059d0a 100644 --- a/EchoionStandalone/tests/test_runtime_paths.cpp +++ b/EchoionStandalone/tests/test_runtime_paths.cpp @@ -101,11 +101,19 @@ int main() const auto packagedIndex = installRoot / "share" / "echoion" / "web" / "index.html"; check(writeFile(packagedIndex), "failed to create packaged web fixture"); - check( - Echoion::Standalone::runtimeWorkingDirectory(installRoot, - executableDirectory) == - installRoot / "share" / "echoion", - "packaged web root did not select share/echoion as working directory"); + check(Echoion::Standalone::runtimeWorkingDirectory( + installRoot, executableDirectory) == installRoot, + "packaged web root did not select the installation root as working " + "directory"); + const auto bundledCertificates = + installRoot / "share" / "echoion" / "certs" / "ca-certificates.crt"; + check(!Echoion::Standalone::bundledCertificateBundle(installRoot), + "missing bundled certificate store was accepted"); + check(writeFile(bundledCertificates), + "failed to create bundled certificate store fixture"); + check(Echoion::Standalone::bundledCertificateBundle(installRoot) == + bundledCertificates, + "bundled certificate store was not resolved from the install root"); std::filesystem::remove_all(installRoot / "share"); const auto developmentIndex = executableDirectory / "web" / "index.html"; check(writeFile(developmentIndex), diff --git a/EchoionStandalone/tests/test_stage_release.sh b/EchoionStandalone/tests/test_stage_release.sh index c57a4d1..3433bb4 100755 --- a/EchoionStandalone/tests/test_stage_release.sh +++ b/EchoionStandalone/tests/test_stage_release.sh @@ -14,6 +14,7 @@ mkdir -p -- \ "$bundle/bin" \ "$bundle/lib" \ "$bundle/service" \ + "$bundle/share/echoion/certs" \ "$bundle/share/echoion/tools" \ "$bundle/share/echoion/web" printf '#!/bin/sh\necho "echoiond must not run during release staging" >&2\nexit 97\n' \ @@ -27,6 +28,7 @@ install -m 0644 -- \ "$service_templates/echoion-updater.timer.in" \ "$bundle/service/" printf '{"webRoot":"./web"}\n' > "$bundle/share/echoion/config.example.json" +printf 'test trust bundle\n' > "$bundle/share/echoion/certs/ca-certificates.crt" install -m 0755 -- "$manifest_validator" \ "$bundle/share/echoion/tools/validate-release-manifest.py" printf '\n' > "$bundle/share/echoion/web/index.html" diff --git a/EchoionWeb/frontend/src/components/TeamSpeakAdmin.tsx b/EchoionWeb/frontend/src/components/TeamSpeakAdmin.tsx index ceeed3a..397ff21 100644 --- a/EchoionWeb/frontend/src/components/TeamSpeakAdmin.tsx +++ b/EchoionWeb/frontend/src/components/TeamSpeakAdmin.tsx @@ -4,6 +4,7 @@ import type { RpcMethodName } from '../lib/rpc'; import { confirmDialog, promptDialog } from '../lib/dialog'; import { EmptyRow } from './TrackRow'; import { t, tf } from '../i18n'; +import { teamSpeakChannelDisplayName } from '../lib/teamspeak'; interface AdminClient { id: number; @@ -281,10 +282,17 @@ export function TeamSpeakAdmin() { } function Channel({ channel, depth = 0 }: { channel: AdminChannel; depth?: number }) { + const displayName = teamSpeakChannelDisplayName(channel.name); + return (
- {channel.name} + + {displayName.label} + #{channel.id} {channel.currentClients}/{channel.maxClients || '∞'} diff --git a/EchoionWeb/frontend/src/lib/teamspeak.test.ts b/EchoionWeb/frontend/src/lib/teamspeak.test.ts new file mode 100644 index 0000000..080454f --- /dev/null +++ b/EchoionWeb/frontend/src/lib/teamspeak.test.ts @@ -0,0 +1,33 @@ +import { describe, expect, it } from 'vitest'; +import { teamSpeakChannelDisplayName } from './teamspeak'; + +describe('TeamSpeak channel display names', () => { + it('leaves ordinary channel names unchanged', () => { + expect(teamSpeakChannelDisplayName('Minecraft')).toEqual({ + label: 'Minecraft', + spacer: false, + alignment: 'left', + }); + }); + + it('removes spacer control prefixes and preserves alignment', () => { + expect(teamSpeakChannelDisplayName('[cspacer0]Гамесы')).toEqual({ + label: 'Гамесы', + spacer: true, + alignment: 'center', + }); + expect(teamSpeakChannelDisplayName('[rspacer12]Подвал')).toEqual({ + label: 'Подвал', + spacer: true, + alignment: 'right', + }); + }); + + it('recognizes repeating spacer channels', () => { + expect(teamSpeakChannelDisplayName('[*spacer3]—')).toEqual({ + label: '—', + spacer: true, + alignment: 'repeat', + }); + }); +}); diff --git a/EchoionWeb/frontend/src/lib/teamspeak.ts b/EchoionWeb/frontend/src/lib/teamspeak.ts new file mode 100644 index 0000000..72348a1 --- /dev/null +++ b/EchoionWeb/frontend/src/lib/teamspeak.ts @@ -0,0 +1,33 @@ +export type TeamSpeakSpacerAlignment = 'left' | 'center' | 'right' | 'repeat'; + +export interface TeamSpeakChannelDisplayName { + label: string; + spacer: boolean; + alignment: TeamSpeakSpacerAlignment; +} + +const SPACER_NAME = /^\[([clr]|\*)?spacer\d*\](.*)$/i; + +export function teamSpeakChannelDisplayName( + name: string +): TeamSpeakChannelDisplayName { + const match = SPACER_NAME.exec(name); + if (!match) { + return { label: name, spacer: false, alignment: 'left' }; + } + + const alignment = + match[1]?.toLowerCase() === 'c' + ? 'center' + : match[1]?.toLowerCase() === 'r' + ? 'right' + : match[1] === '*' + ? 'repeat' + : 'left'; + + return { + label: match[2].trim(), + spacer: true, + alignment, + }; +} diff --git a/EchoionWeb/frontend/src/styles/style.css b/EchoionWeb/frontend/src/styles/style.css index c0d6738..a6cb857 100644 --- a/EchoionWeb/frontend/src/styles/style.css +++ b/EchoionWeb/frontend/src/styles/style.css @@ -579,6 +579,39 @@ select:focus:not(:focus-visible) { outline: none; } .ts-channel-row:hover, .ts-client-row:hover { background: rgba(255, 255, 255, 0.035); } .ts-channel-caret { width: 14px; color: var(--faint); text-align: center; } .ts-channel-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 650; } +.ts-channel-row.ts-spacer { + margin: 4px 0 3px; + padding-inline: 5px; + background: linear-gradient(90deg, rgba(124, 92, 255, 0.06), transparent); +} +.ts-channel-row.ts-spacer:hover { + background: linear-gradient(90deg, rgba(124, 92, 255, 0.11), transparent); +} +.ts-channel-row.ts-spacer .ts-channel-caret { + order: 2; + margin-left: auto; +} +.ts-channel-row.ts-spacer .ts-channel-name { + display: flex; + flex: 1; + align-items: center; + gap: 10px; + color: var(--text-2); + letter-spacing: 0.015em; +} +.ts-channel-row.ts-spacer .ts-channel-name::before, +.ts-channel-row.ts-spacer .ts-channel-name::after { + content: ''; + flex: 1; + border-top: 1px solid rgba(124, 92, 255, 0.3); +} +.ts-channel-row.ts-spacer-left .ts-channel-name::before, +.ts-channel-row.ts-spacer-repeat .ts-channel-name::before { + display: none; +} +.ts-channel-row.ts-spacer-right .ts-channel-name::after { + display: none; +} .ts-capacity { margin-left: auto; color: var(--faint); font: 11px var(--font-mono); } .ts-tag { padding: 2px 6px; border-radius: 999px; color: var(--muted-2); @@ -620,6 +653,7 @@ select:focus:not(:focus-visible) { outline: none; } display: flex; align-items: center; gap: 7px; flex-wrap: wrap; min-height: 34px; } +.ts-admin-spacer { color: var(--accent-text); letter-spacing: 0.02em; } .ts-admin-channel-head .ts-capacity { margin-left: 0; margin-right: auto; } .ts-admin-client { display: grid; grid-template-columns: minmax(180px, 0.8fr) minmax(250px, 1.2fr) auto; diff --git a/EchoionWeb/frontend/src/views/DashboardView.tsx b/EchoionWeb/frontend/src/views/DashboardView.tsx index a7180ab..44f1840 100644 --- a/EchoionWeb/frontend/src/views/DashboardView.tsx +++ b/EchoionWeb/frontend/src/views/DashboardView.tsx @@ -16,6 +16,7 @@ import { } from '../components/icons'; import { t, tf } from '../i18n'; import type { PublicDashboardChannel } from '../lib/types'; +import { teamSpeakChannelDisplayName } from '../lib/teamspeak'; const DASHBOARD_VIDEO_PREF_KEY = 'echoion.npVideo'; @@ -32,26 +33,37 @@ function ChannelNode({ channel: PublicDashboardChannel; depth?: number; }) { + const displayName = teamSpeakChannelDisplayName(channel.name); + const rowClassName = displayName.spacer + ? `ts-channel-row ts-spacer ts-spacer-${displayName.alignment}` + : 'ts-channel-row'; + return (
-
+
- {channel.name} - {channel.default && {t('default')}} - {channel.password && ( + + {displayName.label} + + {!displayName.spacer && channel.default && ( + {t('default')} + )} + {!displayName.spacer && channel.password && ( {t('locked')} )} - - {channel.currentClients}/ - {channel.maxClients > 0 ? channel.maxClients : '∞'} - + {!displayName.spacer && ( + + {channel.currentClients}/ + {channel.maxClients > 0 ? channel.maxClients : '∞'} + + )}
{channel.clients.map((client, index) => (
/ @@ -61,7 +61,12 @@ or plugin data. The operation is idempotent and participates in installer rollback. The service and portable launcher expose only the active release's bundled shared-library directory through `LD_LIBRARY_PATH`; release builds keep `BUILD_SHARED_LIBS=ON` -and `ECHOION_STATIC_LINK=OFF`. Installed configurations use the relocatable +and `ECHOION_STATIC_LINK=OFF`. Plugin RUNPATHs also resolve the active +`current/lib` closure from managed, portable/manual, and immutable bootstrap +locations, with `$ORIGIN/lib` reserved for plugin-private dependencies. +The daemon selects the bundled CA trust store when `SSL_CERT_FILE` is unset, so +HTTPS feeds remain verified on hosts without the builder distribution's +OpenSSL directory layout. Installed configurations use the relocatable `./share/echoion/web` asset path; systemd units and the portable launcher set the active release as their working directory. An upgrade rewrites only the exact legacy installer default `./web`; custom web roots remain untouched and diff --git a/packaging/tests/installer_test.sh b/packaging/tests/installer_test.sh index 366b380..b1059c9 100755 --- a/packaging/tests/installer_test.sh +++ b/packaging/tests/installer_test.sh @@ -59,7 +59,7 @@ assert_not_contains() { make_payload() { local root=$1 install -d -- "$root/bin" "$root/lib" "$root/share/echoion/web" \ - "$root/share/echoion/tools" "$root/service" \ + "$root/share/echoion/tools" "$root/share/echoion/certs" "$root/service" \ "$root/share/echoion/bootstrap-plugins/url-shortener-internal/1.0.0" \ "$root/share/echoion/bootstrap-plugins/url-shortener-external/1.0.0" install -m 0755 -- "$PACKAGING_DIR/install.sh" "$root/install.sh" @@ -107,6 +107,8 @@ EOF } EOF printf '\n' > "$root/share/echoion/web/index.html" + printf 'test trust bundle\n' \ + >"$root/share/echoion/certs/ca-certificates.crt" printf 'fake internal shortener plugin 1.0.0\n' > \ "$root/share/echoion/bootstrap-plugins/url-shortener-internal/1.0.0/url-shortener-internal.so" printf 'fake external shortener plugin 1.0.0\n' > \ diff --git a/packaging/tests/updater_test.sh b/packaging/tests/updater_test.sh index b15e24c..1eba707 100644 --- a/packaging/tests/updater_test.sh +++ b/packaging/tests/updater_test.sh @@ -21,7 +21,8 @@ make_release() { local destination=$1 local version=$2 mkdir -p "$destination/bin" "$destination/lib" "$destination/service" \ - "$destination/share/echoion/web" "$destination/share/echoion/tools" + "$destination/share/echoion/web" "$destination/share/echoion/tools" \ + "$destination/share/echoion/certs" install -m 0755 /bin/true "$destination/bin/echoiond" install -m 0755 "$updater" "$destination/bin/echoion-updater" printf 'core %s\n' "$version" >"$destination/lib/Echoion.ts" @@ -35,6 +36,8 @@ make_release() { "$destination/share/echoion/tools/validate-release-manifest.py" printf '{}\n' >"$destination/share/echoion/config.example.json" printf '\n' >"$destination/share/echoion/web/index.html" + printf 'test trust bundle\n' \ + >"$destination/share/echoion/certs/ca-certificates.crt" python3 "$source_root/scripts/generate-release-manifest.py" \ --root "$destination" --version "$version" } diff --git a/packaging/updater/ReleaseTree.cpp b/packaging/updater/ReleaseTree.cpp index f9ea2da..48aac97 100644 --- a/packaging/updater/ReleaseTree.cpp +++ b/packaging/updater/ReleaseTree.cpp @@ -1431,6 +1431,7 @@ namespace Echoion::Updater {"lib/Echoion.ts", "file"}, {"share/echoion/web/index.html", "file"}, {"share/echoion/config.example.json", "file"}, + {"share/echoion/certs/ca-certificates.crt", "file"}, {"share/echoion/tools/validate-release-manifest.py", "file"}, {"service/echoion.service.in", "file"}, {"service/echoion-updater.service.in", "file"}, diff --git a/scripts/release.sh b/scripts/release.sh index e11f9e9..d9406dd 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -382,6 +382,12 @@ cmake --install "$build_dir" \ --component Runtime \ --prefix "$stage" +certificate_bundle=${ECHOION_CA_BUNDLE:-/etc/ssl/certs/ca-certificates.crt} +[[ -s $certificate_bundle ]] || + die "TLS certificate bundle is missing or empty: $certificate_bundle" +install -D -m 0644 -- "$certificate_bundle" \ + "$stage/share/echoion/certs/ca-certificates.crt" + mapfile -t library_directories < <( find "$build_dir" -type f \( -name '*.so' -o -name '*.so.*' -o -name '*.ts' \) \ -printf '%h\n' | LC_ALL=C sort -u @@ -420,11 +426,12 @@ cmake \ -P "$source_dir/cmake/BundleRuntimeDependencies.cmake" # Bootstrap plugins are copied into writable managed-plugin state by the -# installer. Services and the portable launcher point the loader at current/lib; -# this relative path also keeps the immutable source artifact directly usable. +# installer. Search the active release closure from managed, portable/manual, +# and immutable bootstrap locations, then allow plugin-private dependencies. +plugin_runpath='$ORIGIN/../../../../../../current/lib:$ORIGIN/../../current/lib:$ORIGIN/lib' for plugin_library in "${resolver_libraries[@]:1}"; do # shellcheck disable=SC2016 # Dynamic linker token, not a shell variable. - patchelf --set-rpath '$ORIGIN/../../../../../lib' "$plugin_library" + patchelf --set-rpath "$plugin_runpath" "$plugin_library" done dependency_report="$build_dir/dependency-report.txt" @@ -513,6 +520,12 @@ collect_licenses() { -printf '%f\n' | LC_ALL=C sort -u ) fi + + candidate=/usr/share/doc/ca-certificates/copyright + if [[ -f $candidate ]]; then + install -m 0644 -- "$candidate" \ + "$destination/ca-certificates--copyright" + fi } collect_licenses "$stage/share/echoion/licenses" diff --git a/scripts/tests/test-release-packaging.sh b/scripts/tests/test-release-packaging.sh index 4c80b85..c49b137 100755 --- a/scripts/tests/test-release-packaging.sh +++ b/scripts/tests/test-release-packaging.sh @@ -63,6 +63,7 @@ mkdir -p \ "$bundle/bin" \ "$bundle/lib" \ "$bundle/service" \ + "$bundle/share/echoion/certs" \ "$bundle/share/echoion/web" \ "$bundle/share/echoion/tools" install -m 0755 /bin/true "$bundle/bin/echoiond" @@ -74,6 +75,8 @@ printf '%s\n' '[Service]' >"$bundle/service/echoion.service.in" printf '%s\n' '[Service]' >"$bundle/service/echoion-updater.service.in" printf '%s\n' '[Timer]' >"$bundle/service/echoion-updater.timer.in" printf '%s\n' '{}' >"$bundle/share/echoion/config.example.json" +printf '%s\n' 'test trust bundle' \ + >"$bundle/share/echoion/certs/ca-certificates.crt" install -m 0755 "$source_root/scripts/validate-release-manifest.py" \ "$bundle/share/echoion/tools/validate-release-manifest.py" ln -s Echoion.ts "$bundle/lib/Echoion-current.ts" @@ -117,6 +120,7 @@ assert manifest["core"] == "lib/Echoion.ts" paths = [entry["path"] for entry in manifest["files"]] assert paths == sorted(paths) assert "share/echoion/web/index.html" in paths +assert "share/echoion/certs/ca-certificates.crt" in paths link = next(entry for entry in manifest["files"] if entry["path"].endswith("current.ts")) assert link == { "path": "lib/Echoion-current.ts", diff --git a/scripts/tests/test-runtime-dependencies.sh b/scripts/tests/test-runtime-dependencies.sh index d84fdf0..1fe30d1 100755 --- a/scripts/tests/test-runtime-dependencies.sh +++ b/scripts/tests/test-runtime-dependencies.sh @@ -7,7 +7,7 @@ if [[ $# != 1 ]]; then fi source_root=$(realpath -e -- "$1") -for command_name in cmake patchelf readelf python3; do +for command_name in cmake ldd patchelf readelf python3; do command -v "$command_name" >/dev/null || { echo "missing test command: $command_name" >&2 exit 2 @@ -147,7 +147,8 @@ cmake \ "-DBUNDLE_SEED_FILES=$seed_lib/libstdc++.so.6" \ "-DPATCHELF_EXECUTABLE=$(command -v patchelf)" \ -P "$source_root/cmake/BundleRuntimeDependencies.cmake" -patchelf --set-rpath "\$ORIGIN/../../../../../lib" "$bundle_plugin" +plugin_runpath="\$ORIGIN/../../../../../../current/lib:\$ORIGIN/../../current/lib:\$ORIGIN/lib" +patchelf --set-rpath "$plugin_runpath" "$bundle_plugin" python3 - "$source_root/scripts/validate-release-elf.py" <<'PY' import importlib.util @@ -230,8 +231,38 @@ if python3 "$source_root/scripts/validate-release-elf.py" \ fi grep -F $'NEEDED\tlib/Echoion.ts\tlibechoion-dependency.so.1\tbundled' "$report" grep -F $'NEEDED\tbin/echoiond\tlibc.so.6\tsystem' "$report" -grep -F $'ELF\tshare/echoion/bootstrap-plugins/fixture-shortener/1.0.0/fixture-shortener.so\tRUNPATH=$ORIGIN/../../../../../lib' "$report" +grep -F \ + $'ELF\tshare/echoion/bootstrap-plugins/fixture-shortener/1.0.0/fixture-shortener.so\tRUNPATH=$ORIGIN/../../../../../../current/lib:$ORIGIN/../../current/lib:$ORIGIN/lib' \ + "$report" grep -F $'NEEDED\tshare/echoion/bootstrap-plugins/fixture-shortener/1.0.0/fixture-shortener.so\tlibechoion-dependency.so.1\tbundled' "$report" + +installed="$temporary/installed" +managed_plugin="$installed/state/plugins/.managed/fixture-shortener/versions/1.0.0/fixture-shortener.so" +portable_plugin="$installed/state/plugins/fixture-shortener.so" +mkdir -p "$installed/current/lib" "$(dirname -- "$managed_plugin")" \ + "$(dirname -- "$portable_plugin")" +cp -a "$bundle/lib/." "$installed/current/lib/" +cp "$bundle_plugin" "$managed_plugin" +cp "$bundle_plugin" "$portable_plugin" +for installed_plugin in "$managed_plugin" "$portable_plugin"; do + ldd_report="$temporary/$(basename -- "$(dirname -- "$installed_plugin")").ldd" + env -u LD_LIBRARY_PATH ldd "$installed_plugin" >"$ldd_report" 2>&1 + resolved_dependency=$(awk ' + $1 == "libechoion-dependency.so.1" && $2 == "=>" { + print $3 + exit + } + ' "$ldd_report") + [[ -n $resolved_dependency ]] + [[ $(realpath -e -- "$resolved_dependency") == \ + $(realpath -e -- "$installed/current/lib/libechoion-dependency.so.1") ]] + if grep -Fq 'not found' "$ldd_report"; then + echo "installed plugin did not resolve its bundled dependency closure" >&2 + cat "$ldd_report" >&2 + exit 1 + fi +done + if python3 "$source_root/scripts/validate-release-elf.py" \ --root "$bundle" \ --forbid-content-prefix /tmp/echoion-plugin-forbidden-build-path \ @@ -266,7 +297,7 @@ if python3 "$source_root/scripts/validate-release-elf.py" \ echo "incorrect bootstrap plugin RUNPATH unexpectedly passed validation" >&2 exit 1 fi -patchelf --set-rpath "\$ORIGIN/../../../../../lib" "$bundle_plugin" +patchelf --set-rpath "$plugin_runpath" "$bundle_plugin" patchelf --set-rpath /tmp/unsafe-build-path "$bundle/lib/Echoion.ts" if python3 "$source_root/scripts/validate-release-elf.py" \ diff --git a/scripts/validate-release-elf.py b/scripts/validate-release-elf.py index 9143212..99512cf 100755 --- a/scripts/validate-release-elf.py +++ b/scripts/validate-release-elf.py @@ -44,7 +44,11 @@ PLUGIN_VERSION_PATTERN = re.compile( r"(?:-(?:0|[1-9][0-9]*|[0-9A-Za-z-]*[A-Za-z-][0-9A-Za-z-]*)" r"(?:\.(?:0|[1-9][0-9]*|[0-9A-Za-z-]*[A-Za-z-][0-9A-Za-z-]*))*)?$" ) -PLUGIN_RUNPATH = "$ORIGIN/../../../../../lib" +PLUGIN_RUNPATH = ( + "$ORIGIN/../../../../../../current/lib:" + "$ORIGIN/../../current/lib:" + "$ORIGIN/lib" +) def parse_version(value: str) -> tuple[int, ...]: diff --git a/scripts/validate-release-manifest.py b/scripts/validate-release-manifest.py index dd39114..6dc5a89 100644 --- a/scripts/validate-release-manifest.py +++ b/scripts/validate-release-manifest.py @@ -172,6 +172,7 @@ def load_and_validate(root: Path, expected_version: str | None = None) -> dict: "core": "lib/Echoion.ts", "web dashboard": "share/echoion/web/index.html", "configuration template": "share/echoion/config.example.json", + "TLS trust bundle": "share/echoion/certs/ca-certificates.crt", "manifest validator": "share/echoion/tools/validate-release-manifest.py", "service template": "service/echoion.service.in", "updater service template": "service/echoion-updater.service.in",