Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Commit

Permalink
Improved version check by adding a hash-check to compare installed an…
Browse files Browse the repository at this point in the history
…d delivered bin.
  • Loading branch information
SimMac committed Mar 13, 2015
1 parent 07836fa commit cbc06b0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
minimal_adb_fastboot
====================

Last updated: 10.03.2015 | adb version: 1.0.32
Last updated: 13.03.2015 | adb version: 1.0.32
------------------------
Installs the adb and fastboot binaries for OS X.

Expand All @@ -20,6 +20,7 @@ Changelog:
- 1.1 | 16.11.2014 Script can now be called from everywhere
- 1.1.1 | 23.11.2014 Name change due to name confict with other adb installer.
- 1.2 | 10.03.2015 Updated adb and fastboot binaries to platform-tools v22, adjusted script because binaries change without version number incremention.
- 1.2.1 | 13.03.2015 Improved version check by adding a hash-check to compare installed and delivered bin.

Installer Package (legacy):
------------------
Expand Down
23 changes: 16 additions & 7 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,22 @@ VERSION="$($DIR/bins/./adb version | cut -d ' ' -f5)"
#This is checking if the installed adb version is up to date.
#If it is, it will quit the script.
if [ "$VERSION" == "$VERSIONINSTALLED" ]; then
echo -e "It seems, ADB is up to date. However, there could be silent changes which "
echo -e "didn't increment the version number counter. Do you want to update ADB nevertheless?\n"
read -p "Please enter y(es) or n(o): " yn
case $yn in
[Yy]* ) ;;
[Nn]* ) echo -e "Quitting...\n\n"; exit 0;;
esac

#check md5 match
MD5="$(md5 $DIR/bins/adb | cut -d " " -f4 )"
MD5INSTALLED="$(md5 $(which adb) | cut -d " " -f4)"
if [ "$MD5" != "$MD5INSTALLED" ]; then
echo -e "$MD5 $MD5INSTALLED Although the version number of the adb binary didn't change, the file itself changed. "
echo -e "Probably there was a minor patch in the binary. Do you want to update the adb binary?\n"
read -p "Please enter y(es) or n(o): " yn
case $yn in
[Yy]* ) ;;
[Nn]* ) echo -e "Quitting...\n\n"; exit 0;;
esac
else
echo -e "Your adb binaries seem to be up to date. Please check github.com/simmac/minimal_adb_fastboot for updates!"
exit 0;
fi
fi
if [ "$VERSION" != "$VERSIONINSTALLED" ]; then
echo -e "\nadb is not installed or outdated."
Expand Down

0 comments on commit cbc06b0

Please sign in to comment.