44 lines
1.3 KiB
Bash
Executable File
44 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
|
|
while IFS= read -r file; do
|
|
first_line="$(head -n 1 "$file")"
|
|
if [[ "$first_line" == *bash* ]]; then
|
|
bash -n "$file"
|
|
else
|
|
sh -n "$file"
|
|
fi
|
|
done < <(find "$ROOT" -type f \( -name '*.sh' -o -path '*/src/etc/rc.d/rustproxy' -o -path '*/src/etc/rc.syshook.d/*.start' \))
|
|
|
|
python3 - "$ROOT" <<'PY'
|
|
import pathlib
|
|
import sys
|
|
import xml.etree.ElementTree as ET
|
|
root = pathlib.Path(sys.argv[1])
|
|
for path in root.glob('opnsense-plugin/**/*.xml'):
|
|
ET.parse(path)
|
|
print('xml ok:', path.relative_to(root))
|
|
PY
|
|
|
|
if command -v php >/dev/null 2>&1; then
|
|
while IFS= read -r file; do php -l "$file" >/dev/null; done < <(find "$ROOT/opnsense-plugin" -type f -name '*.php')
|
|
fi
|
|
|
|
if [[ -n "${RUSTPROXY_SOURCE_DIR:-}" ]] && [[ -f "$RUSTPROXY_SOURCE_DIR/Cargo.toml" ]] && command -v cargo >/dev/null 2>&1; then
|
|
cargo metadata --locked --no-deps --format-version 1 --manifest-path "$RUSTPROXY_SOURCE_DIR/Cargo.toml" >/dev/null
|
|
fi
|
|
|
|
if [[ -d "$ROOT/app" ]]; then
|
|
echo "RustProxy source must not be vendored in this packaging repository: $ROOT/app" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [[ -e "$ROOT/opnsense-plugin/www/rustproxy/src/sbin/rust-proxy" ]]; then
|
|
echo "Generated binary must not be committed in plugin source." >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "Repository checks passed."
|