Teach this script about different architectures.

This commit is contained in:
Kris Kennaway 2003-09-12 20:50:44 +00:00
parent 6e13e8bdb5
commit b815980215
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=88968
2 changed files with 54 additions and 61 deletions

View file

@ -1,63 +1,52 @@
#!/bin/sh #!/bin/sh
# prints out logs that are in all directories # prints out logs that are in dir1 but not in dir2
if [ $# -lt 2 ]; then if [ $# -ne 3 ]; then
echo "usage: $0 dir1 dir2 [dir3...]" echo "usage: $0 arch dir1 dir2"
exit 1 exit 1
fi fi
here=$(pwd) here=$(pwd)
dir1=$1 arch=$1
dir1=$2
dir2=$3
fdir1=$here/${arch}-$dir1
fdir2=$here/${arch}-$dir2
ldir2=$(cd $fdir2; pwd | sed -e 's/e\./a./')
concat="$(echo $*)" plus="$(echo $2 $3 | sed -e 's/ /+/g')"
plus="$(echo $* | sed -e 's/ /+/g')"
of=$here/$plus.html of=$here/$arch-$plus.html
echo "<html><head><title>Logs that are in all of \"$concat\"</title>" >$of echo "<html><head><title>Logs that are in both $dir1 and $dir2</title>" >$of
echo "<h1>Logs that are in all of \"$concat\"</h1>" >>$of echo "<h1>Logs that are in both $dir1 and $dir2</h1>" >>$of
echo "</head><body>" >>$of echo "</head><body>" >>$of
cd $here/$1 cd $fdir1
logs=$(find . -name \*.log -o -name \*.log.bz2 | sed -e 's/\.log\.bz2/\.log/g')
nlogs=$(echo $logs | wc -w)
logs="$(echo *.log)" if [ $nlogs -eq 0 ]; then
echo "No errors" >>$of;
if [ "x$logs" = "x*.log" ]; then
echo "No errors" >>$of
else else
shift
while [ $# -gt 0 ]; do
num=0 num=0
newlogs="" echo "<table border=1>" >>$of
cd $here/$1 echo "<tr><th>Log</th></tr>" >>$of
for log in *.log; do for i in $logs; do
if echo $logs | grep -Fwq $log; then if [ -f ${fdir2}/${i}.bz2 -o -f ${fdir2}/${i} ]; then
newlogs="$newlogs $log" fname1=$(basename $i .bz2)
fname=$(basename $fname1 .log)
echo -n "<tr>" >> $of
echo -n "<td><a href=\"$arch-$dir1/$fname.log\">$fname</a></td>" >>$of
echo -n "<td><a href=\"$arch-$dir2/$fname.log\">$fname</a></td>" >>$of
echo "</tr>" >>$of
num=$(($num + 1)) num=$(($num + 1))
fi fi
done done
logs=$newlogs
shift
done
if [ $num = 0 ]; then
echo "No errors" >>$of
else
echo "<table border=1>" >>$of
echo "<tr><th>Log</th></tr>" >>$of
set $newlogs
while [ $# -gt 0 ]; do
echo -n "<tr><td>" >>$of
echo -n "<a href=\"$dir1/index.html#$1\">" >>$of
echo -n $(basename $1 .log) >>$of
echo -n "</a>" >>$of
echo "</td></tr>" >>$of
shift
done
echo "</table><br>" >> $of echo "</table><br>" >> $of
echo "$num errors<br>" >> $of echo "$num errors<br>" >> $of
fi fi
fi
echo "<hr>" >> $of echo "<hr>" >> $of
echo "<a href=\"../\">back to top</a>" >> $of echo "<a href=\"../\">back to top</a>" >> $of

View file

@ -2,44 +2,48 @@
# prints out logs that are in dir1 but not in dir2 # prints out logs that are in dir1 but not in dir2
if [ $# != 2 ]; then if [ $# -ne 3 ]; then
echo "usage: $0 dir1 dir2" echo "usage: $0 arch dir1 dir2"
exit 1 exit 1
fi fi
here=$(pwd) here=$(pwd)
dir1=$1 arch=$1
dir2=$2 dir1=$2
fdir1=$here/$dir1 dir2=$3
fdir2=$here/$dir2 fdir1=$here/${arch}-$dir1
fdir2=$here/${arch}-$dir2
ldir2=$(cd $fdir2; pwd | sed -e 's/e\./a./') ldir2=$(cd $fdir2; pwd | sed -e 's/e\./a./')
of=$here/$dir1-$dir2.html of=$here/$arch-$dir1-$dir2.html
echo "<html><head><title>Logs that are in $dir1 but not in $dir2</title>" >$of echo "<html><head><title>Logs that are in $dir1 but not in $dir2</title>" >$of
echo "<h1>Logs that are in $dir1 but not in $dir2</h1>" >>$of echo "<h1>Logs that are in $dir1 but not in $dir2</h1>" >>$of
echo "</head><body>" >>$of echo "</head><body>" >>$of
cd $fdir1 cd $fdir1
logs=$(find . -name \*.log -o -name \*.log.bz2 | sed -e 's/\.log\.bz2/\.log/g')
nlogs=$(echo $logs | wc -w)
set *.log if [ $nlogs -eq 0 ]; then
echo "No errors" >>$of;
if [ $# = 1 -a "x$1" = "x*.log" ]; then
echo "No errors" >>$of
else else
num=0 num=0
echo "<table border=1>" >>$of echo "<table border=1>" >>$of
echo "<tr><th>Log</th></tr>" >>$of echo "<tr><th>Log</th></tr>" >>$of
while [ $# -gt 0 ]; do for i in $logs; do
if [ -f ${ldir2}/$1 -a ! -f ${fdir2}/$1 ]; then if [ -f ${fdir2}/${i}.bz2 -o -f ${fdir2}/${i} ]; then
# foo
else
fname1=$(basename $i .bz2)
fname=$(basename $fname1 .log)
echo -n "<tr><td>" >>$of echo -n "<tr><td>" >>$of
echo -n "<a href=\"$dir1/index.html#$1\">" >>$of echo -n "<a href=\"$arch-$dir1/index.html#$fname\">" >>$of
echo -n $(basename $1 .log) >>$of echo -n $fname >>$of
echo -n "</a>" >>$of echo -n "</a>" >>$of
echo "</td></tr>" >>$of echo "</td></tr>" >>$of
num=$(($num + 1)) num=$(($num + 1))
fi fi
shift
done done
echo "</table><br>" >> $of echo "</table><br>" >> $of
echo "$num errors<br>" >> $of echo "$num errors<br>" >> $of