-
Notifications
You must be signed in to change notification settings - Fork 27
/
arduino-install
executable file
·56 lines (49 loc) · 1.16 KB
/
arduino-install
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
#!/bin/bash
root=$(
while true; do
pwd=$(pwd)
if [ $pwd = / ]; then
echo "not in esp8266/arduino"
break;
fi
if [ -r platform.txt -a -d tools/sdk ]; then
echo $pwd
break;
fi
cd ..
done
)
[ -d "$root" ] || exit 1
case "$1" in
install) install=true;;
uninstall) install=false;;
*) echo "need 'install' or 'uninstall'"
exit 1;;
esac
replace()
{
dir="$1"
old="$2"
new="$3"
if $install; then
[ -r "$root/$dir/$old.orig" ] || mv "$root/$dir/$old" "$root/$dir/$old.orig"
rm -f "$root/$dir/$old"
ln -s "$new" "$root/$dir/$old"
else
if [ -r "$root/$dir/$old.orig" ]; then
rm -f "$root/$dir/$old"
mv "$root/$dir/$old.orig" "$root/$dir/$old"
else
echo "$root/$dir/$old was not installed"
fi
fi
}
replace tools xtensa-lx106-elf $(pwd)/xtensa-lx106-elf
replace tools/sdk/lib libgcc.a $(pwd)/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/7.2.0/libgcc.a
replace tools/sdk/lib libhal.a $(pwd)/xtensa-lx106-elf/lib/libhal.a
replace tools/sdk/libc xtensa-lx106-elf $(pwd)/xtensa-lx106-elf/xtensa-lx106-elf
echo ""
echo "Current toolchain version:"
echo ""
"$root/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc" -v
echo ""