General TC > Programming & Scripting - Unofficial
extension audit script
^thehatsrule^:
Scripts should not be posted in the wiki - a link back to the thread should be the way to go.
robc:
If Bash isn't installed then there is an error so the Bash check is useless. Try this:
--- Code: ---#!/bin/sh
if [ ! `which bash` ]; then
echo "Install bash."
exit 1
fi
bash
RED=`echo -e '\e[1;31m'`
YELLOW=`echo -e '\e[1;33m'`
WHITE=`echo -e '\e[00m'`
GREEN=`echo -e '\e[0;32m'`
if [ ! `which file` ]; then
echo "Install the file extension."
exit 1
fi
if [ ! `which mksquashfs` ]; then
echo "Install the squashfs-tools extension."
exit 1
fi
--- End code ---
And the info file check can be changed to:
--- Code: ---for I in `ls *.info`; do
INFOERR=""
echo "Checking for errors in "$I"..."
[ -z `awk '/Title:/ { print $2 }' "$I"` ] && INFOERR=`echo -e "\tTitle: field is not valid in "$I"."\n`
[ -z `awk '/Description:/ { print $2 }' "$I"` ] && INFOERR=$INFOERR`echo -e "\tDescription: field is not valid in "$I"."\n`
[ -z `awk '/Version:/ { print $2 }' "$I"` ] && INFOERR=$INFOERR`echo -e "\tVersion: field is not valid in "$I"."\n`
[ -z `awk '/Author:/ { print $2 }' "$I"` ] && INFOERR=$INFOERR`echo -e "\tAuthor: field is not valid in "$I"."\n`
[ -z `awk '/Original-site:/ { print $2 }' "$I"` ] && INFOERR=$INFOERR`echo -e "\tOriginal-site: field is not valid in "$I"."\n`
[ -z `awk '/Copying-policy:/ { print $2 }' "$I"` ] && INFOERR=$INFOERR`echo -e "\tCopying-policy: field is not valid in "$I"."\n`
[ -z `awk '/Size:/ { print $2 }' "$I"` ] && INFOERR=$INFOERR`echo -e "\tSize: field is not valid in "$I"."\n`
[ -z `awk '/Extension_by:/ { print $2 }' "$I"` ] && INFOERR=$INFOERR`echo -e "\tExtension_by: field is not valid in "$I"."\n`
[ -z `awk '/Comments:/ { print $2 }' "$I"` ] && INFOERR=$INFOERR`echo -e "\tComments: field is not valid in "$I"."\n`
[ -z `awk '/Change-log:/ { print $2 }' "$I"` ] && INFOERR=$INFOERR`echo -e "\tChange-log: field is not valid in "$I"."\n`
[ -z `awk '/Current:/ { print $2 }' "$I"` ] && INFOERR=$INFOERR`echo -e "\tCurrent: field is not valid in "$I"."\n`
file "$I" | grep "CRLF" && dos2unix -u "$I" && INFOERR=$INFOERR`echo -e "\t${YELLOW}Fixed CRLF line terminators in "$I". Please don't use Windows apps to edit Linux files.${WHITE}"\n`
if [ -n $INFOERR ]; then
echo "${RED}$INFOERR"
else
echo -e "\bNo Errors found."
fi
sleep 1
done
--- End code ---
Jason W:
Thanks, I will add that in soon.
Jason W:
Dropped bash requirement, added robc's suggestion and also added the listing of .list file differences from the extension being audited and the one in the repo to draw attention to list file content differences when updating existing extensions. Particular attention in list file diffs is those of /usr/local/lib/lib.so.X number differences that often result in breakage of dependent apps when the extension being updated is a library one. This just raises a yellow flag on file content differences for the submitter to determine the relevance.
A version for 2.x and 3.x are attached to original post.
Jason W:
robc-
I undid your info changes as I saw errors and don't have time to troubleshoot. If you would confirm it working or bugfix it I would be glad to include it in.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version