/
setup
67 lines (55 loc) · 2.05 KB
/
setup
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
#!/bin/bash
# install and update git repos in ~/code
source "$HOME"/setup/updatecode
# ensure that apt is installed before continuing
[[ -x "/usr/bin/apt" ]] || { echo "ERROR: Unsupported operating system! Supported operating systems: Debian, Ubuntu" && exit 1 ; }
# need to add repos to get latest compilers
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
# updates
# if the rest of this script runs, this won't
# do anything since automatic updates would have
# been configured
sudo apt update
sudo apt upgrade -y
sudo apt autoremove -y
# useful stuff
sudo apt install net-tools
sudo apt install git
sudo apt install screen
sudo apt install htop
sudo apt install cifs-utils
# compilers
sudo apt install gcc -y
sudo apt install g++ -y
# configure the shell to behave nicely
rm "$HOME"/.bash_profile
rm "$HOME"/.bashrc
cp "$HOME"/setup/marder_lab_bashrc.sh "$HOME"/.bash_profile
# configure automatic updates
sudo apt install unattended-upgrades
sudo cp "$HOME"/setup/50unattended-upgrades /etc/apt/apt.conf.d/
sudo cp "$HOME"/setup/20auto-upgrades /etc/apt/apt.conf.d/
# create a shortcut so we can just call setup
sudo cp "$HOME"/setup/setup /usr/local/bin/setup
sudo chmod a+x /usr/local/bin/setup
# now, prepend this to the PATH so that this is found first
rm "$HOME"/.bash_profile2
echo "PATH=$MATLAB_HERE:\$PATH" > "$HOME"/new_path.txt
cat "$HOME"/new_path.txt "$HOME"/.bash_profile > "$HOME"/.bash_profile2
rm "$HOME"/.bash_profile
rm "$HOME"/new_path.txt
mv "$HOME"/.bash_profile2 "$HOME"/.bash_profile
# copy screenrc
rm "$HOME"/.screenrc
cp "$HOME"/setup/screenrc "$HOME"/.screenrc
# figure out where matlab is, and make sure we use the
# correct version. MATLAB is commonly installed (incorrectly)
# on the system path, which is a terrible thing to do
# we want to use our local copy of MATLAB, which should be some
# where in our home directory. Let's first find where it is
echo "Setting up MATLAB paths..."
MATLAB_HERE=$(find "$HOME"/ -name matlab | grep "bin/matlab")
MATLAB_HERE=$(dirname "$MATLAB_HERE")
echo "MATLAB found in: "
echo "$MATLAB_HERE"