forked from dral3x/AndroidAVDRepo
-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathlinkavd
executable file
·60 lines (45 loc) · 1.02 KB
/
linkavd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
WD="$(pwd)"
function linker {
# hlink source, destination
"$WD/hlink" "$1" "$2"
}
function unlinker {
# hlink -u destination
"$WD/hlink" -u "$1"
}
if [ "$ANDROID_SDK_HOME" == "" ];
then
HOMEDIR="$HOME/.android"
else
HOMEDIR="$ANDROID_SDK_HOME"
fi
if [ ! -d "ini" ];
then
mkdir ini 2>&1
fi
cd avd
if [ $# -gt 1 ]; then
FILELIST="$@"
else
FILELIST="$(ls *.ini)"
fi
unlinker "$HOMEDIR/devices.xml"
linker "$WD/devices.xml" "$HOMEDIR/devices.xml"
for FILE in $FILELIST
do
BASE="${FILE%.*}"
echo -e "Cleaning path in $FILE ..."
sed 's|path=/Users/user/.android/avd|path='"$HOMEDIR"'/avd|g' "$FILE" > "../ini/$FILE"
echo -e "Linking to $BASE from .android/avd ..."
unlinker "$HOMEDIR/avd/$FILE"
linker "$WD/ini/$FILE" "$HOMEDIR/avd/$FILE"
unlinker "$HOMEDIR/avd/${BASE}.avd"
linker "$WD/avd/${BASE}.avd" "$HOMEDIR/avd/${BASE}.avd"
# repairs path issues in the disk images
echo -e "Repairing any issues in config.ini for $BASE ..."
android update avd -n "$BASE"
echo -e "Done."
echo ""
done
cd "$WD"