samer@0
|
1 #!/bin/sh
|
samer@0
|
2 # ---------------------- CONFIGURATION PART ----------------------
|
samer@0
|
3
|
samer@0
|
4 HAVE_MATLAB=yes
|
samer@0
|
5 SWI_GUI=no
|
samer@1
|
6 SETUP_X=yes
|
samer@1
|
7 HEADLESS=yes
|
samer@1
|
8 DRY_RUN=yes
|
samer@1
|
9
|
samer@1
|
10 if [ $# -gt 0 ]; then
|
samer@1
|
11 echo "Setting DRY_RUN to $1" 1>&2
|
samer@1
|
12 DRY_RUN=$1
|
samer@1
|
13 fi
|
samer@1
|
14
|
samer@1
|
15 # If DRY_RUN=yes, then this script will do nothing, but will output the commands
|
samer@1
|
16 # it would have done to stdout.
|
samer@0
|
17
|
samer@0
|
18 # ------------------- END OF CONFIGURATION PART ------------------
|
samer@1
|
19
|
samer@1
|
20 if [ $DRY_RUN == yes ]; then
|
samer@1
|
21 echo "I am doing a DRY RUN ONLY. The commands to be executed (as root) will" 1>&2
|
samer@1
|
22 echo "be output to stdout. Messages (such as this one) are output to stderr." 1>&2
|
samer@1
|
23 echo "Run the following to write a script to run later:" 1>&2
|
samer@1
|
24 echo 1>&2
|
samer@1
|
25 echo " \$ sh setup_as_root.sh > install.sh" 1>&2
|
samer@1
|
26 echo 1>&2
|
samer@1
|
27 echo "Alternatively, run" 1>&2
|
samer@1
|
28 echo 1>&2
|
samer@1
|
29 echo " \$ sh setup_as_root.sh no" 1>&2
|
samer@1
|
30 echo 1>&2
|
samer@1
|
31 DO=echo
|
samer@1
|
32 else
|
samer@1
|
33 echo "I am going to do everything FOR REAL. Type 'yes' and hit return to continue"
|
samer@1
|
34 read CONTINUE
|
samer@1
|
35 if [ $CONTINUE == yes ]; then
|
samer@1
|
36 echo "Ok, going ahead with setup"
|
samer@1
|
37 else
|
samer@1
|
38 exit 1
|
samer@1
|
39 fi
|
samer@1
|
40 DO=
|
samer@1
|
41 fi
|
samer@0
|
42 # APT GET installs
|
samer@1
|
43 $DO apt-get install build-essential autoconf mercurial git pkg-config screen
|
samer@1
|
44 $DO apt-get install libossp-uuid-dev libssl-dev zlib1g-dev unixodbc-dev libsmf-dev libsqlite3-dev
|
samer@1
|
45 $DO apt-get install graphviz lilypond pdf2svg texlive-font-utils p7zip-full
|
samer@1
|
46 $DO apt-get install vorbis-tools lame sox faad flac libsox-fmt-all fluidsynth
|
samer@0
|
47
|
samer@0
|
48 # Only if you want SWI Prolog GUI
|
samer@1
|
49 if [ $SWI_GUI == yes ]; then
|
samer@1
|
50 $DO apt-get install libxpm-dev libxt-dev libjpeg-dev libx11-dev libxft-dev libxinerama1 libfontconfig1-dev
|
samer@1
|
51 fi
|
samer@0
|
52
|
samer@0
|
53 # If you have MATLAB
|
samer@0
|
54 if [ $HAVE_MATLAB == yes ]; then
|
samer@1
|
55 echo "Checking for MATLAB..." 1>&2
|
samer@1
|
56 MATLAB_ROOT=$(matlab -e | grep '^MATLAB=' | sed -e 's/MATLAB=//')
|
samer@1
|
57 echo "MATLAB installed in $MATLAB_ROOT" 1>&2
|
samer@1
|
58 $DO apt-get csh libtritonus-java libvorbisspi-java libmp3spi-java
|
samer@1
|
59 $DO ln -sf /lib/x86_64-linux-gnu/libc.so.6 /lib64
|
samer@1
|
60 $DO ln -sf $MATLAB_ROOT/bin/matlab /usr/local/bin
|
samer@0
|
61
|
samer@0
|
62 # MATLAB (R2012a at least) looks for Java extension jars in this directory
|
samer@1
|
63 $DO mkdir -p /usr/java/packages/lib/ext
|
samer@0
|
64 # NB - there may be some duplication of service providers here - I'm not sure
|
samer@0
|
65 # which of them works best.
|
samer@1
|
66 $DO ln -sf /usr/shara/java/{vorbisspi,mp3spi}.jar /usr/java/packages/lib/ext
|
samer@1
|
67 $DO ln -sf /usr/shara/java/tritonus_{aos,core,jorbis,mp3,remaining,share}.jar /usr/java/packages/lib/ext
|
samer@0
|
68
|
samer@0
|
69 # need to add native library paths to this file
|
samer@1
|
70 if grep '/usr/lib/jni' $MATLAB_ROOT/toolbox/local/librarypath.txt; then
|
samer@1
|
71 echo "MATLAB Library path already set." 1>&2
|
samer@1
|
72 else
|
samer@1
|
73 if [ $DRY_RUN == yes ]; then
|
samer@1
|
74 echo "echo '/usr/lib/jni' >> $MATLAB_ROOT/toolbox/local/librarypath.txt"
|
samer@1
|
75 else
|
samer@1
|
76 echo '/usr/lib/jni' >> $MATLAB_ROOT/toolbox/local/librarypath.txt
|
samer@1
|
77 fi
|
samer@1
|
78 fi
|
samer@0
|
79 fi
|
samer@0
|
80
|
samer@1
|
81 $DO install -bC rc.local /etc
|
samer@0
|
82
|
samer@1
|
83
|
samer@1
|
84 if [ $SETUP_X == yes ]; then
|
samer@1
|
85 echo "Setting up X server..." 1>&2
|
samer@1
|
86 if [ $HEADLESS == yes ]; then
|
samer@1
|
87 echo "Installing dummy video driver for headless X server..." 1>&2
|
samer@1
|
88 $DO apt-get install xinit xserver-xorg-video-dummy
|
samer@1
|
89
|
samer@1
|
90 $DO install --mode=644 -bC xorg.conf /etc/X11
|
samer@0
|
91 else
|
samer@1
|
92 echo "Installing X server and window manager..." 1>&2
|
samer@1
|
93 $DO apt-get install xinit blackbox
|
samer@0
|
94 fi
|
samer@0
|
95
|
samer@1
|
96 if [ $DRY_RUN == yes ]; then
|
samer@1
|
97 $DO dpkg-reconfigure x11-common
|
samer@1
|
98 else
|
samer@1
|
99 echo
|
samer@1
|
100 echo "I am about to call dpkg-reconfigure x11-common."
|
samer@1
|
101 echo "Please select 'Anybody' to allow dml to start the X server automatically."
|
samer@1
|
102 echo "Press RETURN to continue."
|
samer@1
|
103 read
|
samer@1
|
104 $DO dpkg-reconfigure x11-common
|
samer@1
|
105 fi
|
samer@0
|
106 fi
|
samer@1
|
107
|