Release: fix portable runtime and updater
This commit is contained in:
1 parent
1ff935b727
commit
fb8fb69532
21 files changed
+252
-29
No files matched your search
+16
-3
@@ -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"
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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" \
|
||||
|
||||
@@ -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, ...]:
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in new issue
Block a user