-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup.sh
executable file
·86 lines (68 loc) · 3.8 KB
/
setup.sh
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#/bin/sh
# prepare basic tools
apt-get update
apt-get -y install git expect wget screen rsync terminator vim librxtx-java setserial xautomation unclutter xscreensaver openssh-server setserial librxtx-java
# git the DSMPi repo (for script assets)
mkdir /opt/github
cd /opt/github
git clone https://github.com/kami-nashi/DSMPi.git
# create work dirs
mkdir /tmp/dsm_rpi
cd /tmp/dsm_rpi
# get the packages we need
wget --output-document=ecmlink_3_36_73.sh http://moddy.kami-nashi.com/dsm_rpi/sources/ecmlink_3_36_73.sh
wget --output-document=jdk-8u221-linux-arm32-vfp-hflt.tar.gz http://moddy.kami-nashi.com/dsm_rpi/sources/jdk-8u221-linux-arm32-vfp-hflt.tar.gz
wget --output-document=librxtxserial_2_1_7.so http://moddy.kami-nashi.com/dsm_rpi/sources/librxtxserial_2_1_7.so
wget --output-document=RXTXcomm.jar http://moddy.kami-nashi.com/dsm_rpi/sources/RXTXcomm.jar
# get rid of openjdk because of reasons (ecmlink compatiblity issues)
apt-get purge openjdk*
# unzip java, install that crap
tar xvzf /tmp/dsm_rpi/jdk-8u221-linux-arm32-vfp-hflt.tar.gz -C /opt/
update-alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_221/bin/javac 1
update-alternatives --install /usr/bin/java java /opt/jdk1.8.0_221/bin/java 1
update-alternatives --config javac
update-alternatives --config java
# install ECMLink
chmod +x /tmp/dsm_rpi/ecmlink_3_36_73.sh
chmod +x /opt/github/DSMPi/assets/ecmlink_answers.sh
/opt/github/DSMPi/assets/ecmlink_answers.sh
# Setup ECMLink/Java to use the ARM version of RXTX
# borrowed from http://www.ecmtuning.com/forums/showthread.php?t=78448&highlight=raspberry&page=4
cd /opt/ECMLink/libs/
cp /tmp/dsm_rpi/librxtxserial_2_1_7.so .
cp /tmp/dsm_rpi/RXTXcomm.jar .
ln -sf /usr/lib/jni/librxtxSerial.so
chmod +x /opt/ECMLink/ecmlink
# sparkles secret sauce
## predictible ttyUSB naming of the link cable (based on serial number of cable -> always ttyUSB98, because my dsm is a 98)
## Dropped support for this on 2/24/2021 because it didnt work as expected in CentOS 7. Its ust ttyUSB0 now
sh /opt/github/DSMPi/assets/udev_linkcable_rules.sh
## predefined pref's
mkdir -p /home/pi/.java/.userPrefs/ecmtuning/ecmlink/serialport/
mkdir -p /home/pi/.java/.userPrefs/ecmtuning/ecmlink/device/ECMLinkDevice/
mkdir -p /home/pi/.java/.userPrefs/ecmtuning/ecmlink/filenames/
cp /opt/github/DSMPi/assets/file_prefs.xml /home/pi/.java/.userPrefs/ecmtuning/ecmlink/filenames/prefs.xml
cp /opt/github/DSMPi/assets/serial_port_prefs.xml /home/pi/.java/.userPrefs/ecmtuning/ecmlink/serialport/prefs.xml
cp /opt/github/DSMPi/assets/device_prefs.xml /home/pi/.java/.userPrefs/ecmtuning/ecmlink/device/ECMLinkDevice/prefs.xml
## permission problems do not have my permission to be a problem.
chown pi:pi -R /home/pi/.java
chmod 755 /home/pi/.java/.userPrefs/ecmtuning/ecmlink/serialport/
chmod 755 /home/pi/.java/.userPrefs/ecmtuning/ecmlink/device/ECMLinkDevice/
chmod 755 /home/pi/.java/.userPrefs/ecmtuning/ecmlink/filenames/
chmod 644 /home/pi/.java/.userPrefs/ecmtuning/ecmlink/filenames/prefs.xml
chmod 644 /home/pi/.java/.userPrefs/ecmtuning/ecmlink/serialport/prefs.xml git/DSMPi/assets/prefs.xml
chmod 644 /home/pi/.java/.userPrefs/ecmtuning/ecmlink/device/ECMLinkDevice/prefs.xml
# get powerline fonts
wget https://github.com/powerline/powerline/raw/develop/font/PowerlineSymbols.otf
wget https://github.com/powerline/powerline/raw/develop/font/10-powerline-symbols.conf
mv PowerlineSymbols.otf /usr/share/fonts/
mv 10-powerline-symbols.conf /etc/fonts/conf.d/
fc-cache -vf /usr/share/fonts/
# install raspberry pi stuff for things
pip3 install Adafruit_DHT
pip3 install Adafruit_Python_SSD1306
# create and clone additional dev resources
cd /opt/github
git clone https://github.com/adafruit/Adafruit_SSD1306.git
git clone https://github.com/adafruit/Adafruit_Python_DHT.git
#cp assets/systemd/status_checker.service /lib/systemd/system/status_checker.service