#!/usr/bin/env bash set -euo pipefail pkg="${1:?package path required}" echo "==> pacman package metadata" pacman -Qip "$pkg" echo "==> namcap" namcap "$pkg" || true rm -rf /tmp/ayugram-package-test mkdir -p /tmp/ayugram-package-test bsdtar -xf "$pkg" -C /tmp/ayugram-package-test binary="/tmp/ayugram-package-test/usr/bin/AyuGram" if [[ ! -x "$binary" ]]; then echo "ERROR: expected executable ${binary} was not found" >&2 find /tmp/ayugram-package-test/usr -maxdepth 4 -type f -print exit 1 fi echo "==> ELF information" file "$binary" echo "==> Shared library resolution" ldd "$binary" | tee /tmp/ayugram-ldd.txt if grep -q 'not found' /tmp/ayugram-ldd.txt; then echo "ERROR: unresolved shared library detected" >&2 exit 1 fi echo "==> RPATH/RUNPATH" readelf -d "$binary" | grep -E 'RPATH|RUNPATH' || true echo "==> Basic executable smoke test" set +e timeout 15s "$binary" --version >/tmp/ayugram-version.txt 2>&1 rc=$? set -e cat /tmp/ayugram-version.txt || true # GUI applications commonly return non-zero or remain alive when --version is # unsupported. We only reject an immediate dynamic-loader failure. if grep -Eq 'error while loading shared libraries|cannot open shared object file|symbol lookup error' /tmp/ayugram-version.txt; then echo "ERROR: runtime loader failure" >&2 exit 1 fi if [[ "$rc" -eq 126 || "$rc" -eq 127 ]]; then echo "ERROR: executable could not be started" >&2 exit 1 fi echo "Package validation passed."