forked from jnuyens/freedomev
-
Notifications
You must be signed in to change notification settings - Fork 1
/
install
executable file
·66 lines (61 loc) · 2.09 KB
/
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
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
echo
echo Script to install FreedomEV
#detect if we are running chrooted by checking if the root of the init process
#is the same as the root of this process
if [[ "$(stat -c %d:%i /)" != "$(stat -c %d:%i /proc/1/root/.)" ]]
then
echo This is not supposed to run chrooted
exit 2
fi
echo Not running chrooted: OK
#detecting if it's already installed
alreadyinstalled=$(crontab -l | grep /var/freedomev)
if [[ "$alreadyinstalled" != "" ]]
then
echo FreedomEV is already installed: installation aborted
exit 3
fi
echo Not yet installed: OK
#detecting if its a supported car
hw_ap=$(cat /var/etc/dashw)
# empty is pre-DAS
# 0 is DAS0 (harnessed for DAS2.0, but no DAS ECU installed)
# 1 is DAS1
# 2 is DAS2.0
# 3 is DAS2.5
# 4 is DAS3.0
# /var/etc/dashw doesn't exist on Model 3
case "$hw_ap" in
0 | 3 )
echo Detected DAS${hw_ap}, support for FreedomEV currently unconfirmed.
echo Are you sure you want to continue?
echo press y and enter to confirm or something else to abort.
read feedback
if [[ "$feedback" != "y" ]]
then
echo Not confirmed, aborting. Not installed.
echo Hope to see you back when support for your car is confirmed
exit 4
else
echo Please Report back if FreedomEV works on your car so we can confirm it works as it should
echo If it does not behave as it should, use the remove script to clean up or just disable the crontab entry.
fi
;;
1 | 2 )
echo Detected DAS${hw_ap}.0: OK
;;
*)
echo "You can try to help support FreedomEV on these Intel based cars, but it requires another Intel based Ubuntu rootfs and probably many other modifications. Aborting automatic installation."
;;
esac
#installing crontab
curl -s https://raw.githubusercontent.com/jnuyens/freedomev/master/freedomevstart > /var/freedomevstart || exit 5
echo /var/freedomevstart download: OK
crontab -l > /tmp/crontab
echo '* * * * * /bin/bash /var/freedomevstart' >> /tmp/crontab
echo '@reboot /bin/bash /var/freedomevstart' >> /tmp/crontab
cat /tmp/crontab | crontab || exit 6
echo Crontab installed: OK
/var/freedomevstart 2> /dev/null
echo FreedomEV installed! Have fun!