#!/bin/sh

cd "$(dirname $0)"

versions=$(echo vH*)

rm -r file-diffs
rm -r infos
mkdir -p file-diffs/listings
mkdir -p infos

create_diff() {
	diff file-diffs/listings/$1 file-diffs/listings/$2 -u --color=always | /bin/ansi2html.sh > file-diffs/${1}_to_${2}.html
}

for version in $(echo $versions); do
	./gluon-image-info $version/sysupgrade/gluon-ffh-*x86-64-sysupgrade.img.gz > infos/$version.txt
	echo $version
	find $version | sort | sed "s/$version//g" > file-diffs/listings/$version
	if [ -n "$last_version" ]; then
		create_diff $last_version $version
	fi
	last_version=$version
done

create_diff vH37 vH39~4
create_diff vH39~4 vH39
create_diff vH39 vH40~7
