-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall.py
More file actions
executable file
·51 lines (49 loc) · 2.43 KB
/
install.py
File metadata and controls
executable file
·51 lines (49 loc) · 2.43 KB
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
#!/usr/bin/python
import os
import Modules.TermOut.Logging as Logging
Logging.header("This is going to take a while and needs a stable internet connection. Continue? [ENTER]")
raw_input()
Logging.header("Updating package index")
os.system("sudo apt-get update")
os.system("sudo apt-get -y upgrade")
Logging.success("Package index up-to-date")
Logging.header("Fetching required packages")
os.system("sudo apt-get -y install linux-headers-$(uname -r) nano python-numpy usbutils build-essential make gcc python kernel-package texinfo texi2html libcwidget-dev libncurses5-dev libx11-dev binutils-dev bison flex libusb-1.0-0 libusb-dev libmpfr-dev libexpat1-dev tofrodos subversion autoconf automake libtool python-dev python2.7-dev fxload build-essential bzip2 libbz2-dev sqlite3 libsqlite3-dev libssl-dev git")
Logging.success("All required packages have been downloaded")
Logging.header("Installing linux-gpib")
os.system("wget https://raw.githubusercontent.com/elektronomikon/raspi_gpib_driver/master/gpib.conf")
os.system("sudo cp gpib.conf /etc/")
os.chdir("Libs/")
os.system("wget https://raw.githubusercontent.com/elektronomikon/raspi_gpib_driver/master/RasPi_GPIB_driver.patch")
os.system("sh patch_linux-gpib.sh")
os.chdir("linux-gpib-4.0.3")
os.system("sudo make install")
os.system("sudo adduser $USER gpib")
os.system("sudo ldconfig")
os.chdir("..")
Logging.header("Installing pyusb")
os.system("git clone https://github.com/walac/pyusb")
os.chdir("pyusb")
os.system("sudo python setup.py install")
os.chdir("..")
Logging.header("Installing usbtmc")
os.system("git clone https://github.com/python-ivi/python-usbtmc")
os.chdir("python-usbtmc")
os.system("sudo python setup.py install")
os.chdir("..")
Logging.header("Installing pip")
os.system("wget https://bootstrap.pypa.io/get-pip.py")
os.system("sudo python get-pip.py")
Logging.header("Installing pyserial")
os.system("sudo pip install pyserial")
Logging.header("Loading kernel modules")
os.system("sudo modprobe hp_82341 agilent_82350b agilent_82357a cec_gpib tnt4882 ines_gpib hp82335 ni_usb_gpib")
Logging.success("Installation of linux-gpib successful")
Logging.header("Compiling tool to reset usb connections")
os.system("gcc -o usbreset usbreset.c")
Logging.success("Finished compiling usb tool")
os.system("sudo mv usbreset /usr/bin/")
Logging.success("Installation complete!")
Logging.header("A reboot is required in order to use linux gpib. Continue? [ENTER] (^C to reboot later)")
raw_input()
os.system("sudo reboot")