Uniglot/Hooks/scripts.d/check-AniNIX-Makefile

23 lines
514 B
Bash
Executable File

#!/bin/bash
# Enforce each of the lines
linenum=0
for line in compile install clean uninstall test checkperm diff reverse; do
newlinenum="$(grep -nE "^$line:" "Makefile" | cut -f 1 -d ':')"
# Case 1: Missing section
if [ -z "$newlinenum" ]; then
echo "$file" is missing "$line"
exit 1
fi
# Case 2: Line is out of order
if [ "$newlinenum" -lt "$linenum" ]; then
echo "$file" has section "$line" out of order.
exit 2
fi
linenum="$newlinenum"
done