#!/bin/sh set -eu root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) found=0 for directory in "$root"/ports/*; do [ -d "$directory" ] || continue [ "${directory##*/}" != README.md ] || continue found=1 name=${directory##*/} case "$name" in ""|[!a-z]*|*[!a-z0-9-]*) printf '%s\n' "invalid port directory name: $name" >&2 exit 1 ;; esac [ -f "$directory/port.conf" ] || { printf '%s\n' "missing recipe: ports/$name/port.conf" >&2 exit 1 } [ -x "$directory/build.sh" ] || { printf '%s\n' "missing executable build script: ports/$name/build.sh" >&2 exit 1 } sh -n "$directory/build.sh" done if [ "$found" -eq 0 ]; then printf '%s\n' "ports collection is empty" else printf '%s\n' "ports layout check passed" fi