autotest: added unpack_mp.sh script

used to generated
http://firmware.diydrones.com/Tools/MissionPlanner/upgrade
This commit is contained in:
Andrew Tridgell 2013-04-24 13:56:26 +10:00
parent 1a7cffefe6
commit 67de5e5172

30
Tools/scripts/unpack_mp.sh Executable file
View File

@ -0,0 +1,30 @@
#!/bin/bash
# unpack latest MissionPlanner*.zip on firmware.diydrones.com
# to facilitate upgrade of existing MissionPlanner installs
export PATH=$PATH:/bin:/usr/bin
directory="$1"
[ "$#" -eq 1 ] || {
echo "Usage: unpack_mp.sh <DIRECTORY>"
exit 1
}
cd $directory || exit 1
mplatest=$(/bin/ls -tr MissionPlanner*zip | tail -1)
lastsum="$(cat .latest 2> /dev/null)"
[ "$lastsum" = "$(md5sum $mplatest)" ] && {
exit 0
}
echo "$(date) unpacking $mplatest"
mkdir -p upgrade.new upgrade
cd upgrade.new || exit 1
unzip -q "../$mplatest"
cd ..
md5sum $mplatest > .latest
mv upgrade upgrade.old
mv upgrade.new upgrade
rm -rf upgrade.old
find upgrade -type f -print0 | xargs -i -0 md5sum '{}' > checksums.txt