Check for shell scripts that are not POSIX master
authorColin Clark <colin.clark@cclark.uk>
Sun, 12 May 2024 16:26:35 +0000 (17:26 +0100)
committerColin Clark <colin.clark@cclark.uk>
Sun, 12 May 2024 16:26:35 +0000 (17:26 +0100)
scripts/test-ancillary-files.sh

index ad1caba..ac3e673 100755 (executable)
@@ -42,11 +42,28 @@ fi
 
 exit_status=0
 
 
 exit_status=0
 
+# All script files must be POSIX
+# downsize is a third-party file and is excluded
+while read -r file
+do
+       result=$(file "$file" | grep "shell script")
+
+       if [ -n "$result" ]
+       then
+               if [ "${result#*"POSIX"}" = "$result" ]
+               then
+                       printf "ERROR; Executable script is not POSIX: %s\n" "$file"
+                       exit_status=1
+               fi
+       fi
+done << EOF
+$(find "$1/plugins" "$1/src" "$1/scripts" -type f -not -name downsize -executable)
+EOF
+
 # Script files must have the file extension .sh  or
 # be symlinked as so - for doxygen
 while read -r file
 do
 # Script files must have the file extension .sh  or
 # be symlinked as so - for doxygen
 while read -r file
 do
-       #~ check_sh
        result=$(file "$file" | grep "POSIX shell script")
 
        if [ -n "$result" ]
        result=$(file "$file" | grep "POSIX shell script")
 
        if [ -n "$result" ]