OSDN Git Service

Adjust API level for phone comparator
[android-x86/sdk.git] / eclipse / scripts / update_version.sh
1 #!/bin/bash
2
3 OLD="$1"
4 NEW="$2"
5
6 # sanity check in input args
7 if [ -z "$OLD" ] || [ -z "$NEW" ]; then
8     cat <<EOF
9 Usage: $0 <old> <new>
10 Changes the ADT plugin revision number.
11 Example:
12   cd tools/eclipse
13   scripts/update_version.sh 0.1.2 0.2.3
14 EOF
15     exit 1
16 fi
17
18 # sanity check on current dir
19 if [ `basename "$PWD"` != "eclipse" ]; then
20     echo "Please run this from tools/eclipse."
21     exit 1
22 fi
23
24 # quote dots for regexps
25 OLD="${OLD//./\.}\.qualifier"
26 NEW="${NEW//./\.}\.qualifier"
27
28 # Now find the same files but this time use sed to replace in-place with
29 # the new pattern. Old files get backuped with the .old extension.
30 grep -rl "$OLD" * | grep -E "\.xml$|\.MF$" | xargs -n 1 sed -i -e "s/$OLD/$NEW/g"
31