get-rommanager: Prevent saving a broken download

Change-Id: I6a5553f64407b05c20febc1ae44abca52cd2fdea
This commit is contained in:
Ladios Jonquil 2011-05-28 12:33:29 +08:00 committed by Steve Kondik
parent 07738b846a
commit 8c5b23d57e

View File

@ -1,2 +1,16 @@
mkdir -p `dirname $0`/proprietary url=http://mirrorbrain.cyanogenmod.com/cm/recoveries/RomManager.apk
curl -L -o `dirname $0`/proprietary/RomManager.apk -O -L http://mirror.kanged.net/recoveries/RomManager.apk apk=RomManager.apk
dir=`dirname $0`/proprietary
mkdir -p $dir
curl -Lo $dir/$apk.new $url || exit $?
mime=`file -b --mime-type $dir/$apk.new`
if [ "$mime" = "application/zip" ]
then
mv $dir/$apk.new $dir/$apk
file --mime-type $dir/$apk
else
echo -n "$dir/$apk.new: "
echo "$mime" | grep text && cat $dir/$apk.new
rm $dir/$apk.new
exit 1
fi