#!/bin/sh

##############################################################################
# Copyright 2009-2010, LAMP/EPFL
#
# This is free software; see the distribution for copying conditions.
# There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
##############################################################################

if [ -z "$ANDROID_SDK_HOME" ] ; then
    ANDROID_SDK_HOME=$HOME
fi

AVD_HOME=$ANDROID_SDK_HOME/.android/avd
if [ ! -d "$AVD_HOME" ] ; then
    echo "Error: User directory $AVD_HOME not found"
    exit 1
fi

RAMDISK_LIST=`find "$AVD_HOME" -type d -name "*-custom"`
if [ ! -z "$RAMDISK_LIST" ] ; then
    for i in $RAMDISK_LIST "" ; do
        [ -z "$i" ] && continue
        echo "Removing $i..."
        rm -rf $i > /dev/null
    done
    echo "Customized ramdisk.img files were successfully removed"
else
    echo "No ramdisk.img file was found"
fi
