#!env bash [[ -p /dev/stdin ]] && repository_paths=${KISS_PATH:-.} || repository_paths=${1:-$KISS_PATH} error_file='.kiss-lint-error' cleanup() { test -f $error_file && rm -f $error_file } trap cleanup EXIT warning() { echo warning $1 "$2" >&2 } error() { touch $error_file echo error $1 "$2" >&2 } echo $repository_paths | while IFS=: read -r repository_path; do ls $repository_path/*/version | while read -r version _; do package_path=$(dirname $version) build=$package_path/build checksums=$package_path/checksums depends=$package_path/depends sources=$package_path/sources preremove=$package_path/pre-remove postinstall=$package_path/post-install test -x $version && error $version "file is executable" if [[ -f $build ]]; then test -x $build || error $build "file is not executable" else error $build "file not found" fi if [[ -f $postinstall ]]; then test -x $postinstall || error $postinstall "file is not executable" fi if [[ -f $preremove ]]; then test -x $preremove || error $preremove "file is not executable" fi if [[ -f $sources ]]; then if [[ -f $checksums ]]; then sources_lines=$(grep --invert-match --extended-regexp '^#|^$|^git\+' $sources | wc -l) if [[ "$sources_lines" != "$(wc -l < $checksums)" ]]; then warning $checksums "does not match number of sources" fi grep --quiet --extended-regexp '^#|^$' $checksums && error $checksums "found comments or blank lines" test -x $checksums && error $checksums "file is executable" fi fi done done test ! -f $error_file