Mercurial > hg > dml-home
changeset 1:bf3354229297
Root setup script now working correctly.
author | samer |
---|---|
date | Sun, 18 Jan 2015 17:31:08 +0000 |
parents | 7d34f4b6df69 |
children | 3255717f4e6b |
files | .hgignore etc/setup_as_root.sh etc/xorg.conf |
diffstat | 3 files changed, 130 insertions(+), 55 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Sun Jan 18 17:31:08 2015 +0000 @@ -0,0 +1,22 @@ +.bash_history +.viminfo +.java +.Xauthority +.xsession-errors +src/github +src/hg +.hgrc +var/dml/cache +.cache +.dbus +.ipython +.matlab +.ssh +.config +.gitconfig +.swipl-dir-history +lib/charm +var/dml/.swipl_history +var/dml/storage +var/dml/users.db +var/log
--- a/etc/setup_as_root.sh Sun Jan 18 16:18:01 2015 +0000 +++ b/etc/setup_as_root.sh Sun Jan 18 17:31:08 2015 +0000 @@ -1,54 +1,107 @@ #!/bin/sh - -echo 'THIS IS NOT READY YET!' -exit 1 # ---------------------- CONFIGURATION PART ---------------------- HAVE_MATLAB=yes SWI_GUI=no +SETUP_X=yes +HEADLESS=yes +DRY_RUN=yes + +if [ $# -gt 0 ]; then + echo "Setting DRY_RUN to $1" 1>&2 + DRY_RUN=$1 +fi + +# If DRY_RUN=yes, then this script will do nothing, but will output the commands +# it would have done to stdout. # ------------------- END OF CONFIGURATION PART ------------------ + +if [ $DRY_RUN == yes ]; then + echo "I am doing a DRY RUN ONLY. The commands to be executed (as root) will" 1>&2 + echo "be output to stdout. Messages (such as this one) are output to stderr." 1>&2 + echo "Run the following to write a script to run later:" 1>&2 + echo 1>&2 + echo " \$ sh setup_as_root.sh > install.sh" 1>&2 + echo 1>&2 + echo "Alternatively, run" 1>&2 + echo 1>&2 + echo " \$ sh setup_as_root.sh no" 1>&2 + echo 1>&2 + DO=echo +else + echo "I am going to do everything FOR REAL. Type 'yes' and hit return to continue" + read CONTINUE + if [ $CONTINUE == yes ]; then + echo "Ok, going ahead with setup" + else + exit 1 + fi + DO= +fi # APT GET installs -apt-get install build-essential autoconf mercurial git pkg-config -apt-get install libossp-uuid-dev libssl-dev zlib1g-dev unixodbc-dev libsmf-dev libsqlite3-dev -apt-get install graphviz lilypond pdf2svg texlive-font-utils p7zip-full -apt-get install vorbis-tools lame sox faad flac libsox-fmt-all fluidsynth +$DO apt-get install build-essential autoconf mercurial git pkg-config screen +$DO apt-get install libossp-uuid-dev libssl-dev zlib1g-dev unixodbc-dev libsmf-dev libsqlite3-dev +$DO apt-get install graphviz lilypond pdf2svg texlive-font-utils p7zip-full +$DO apt-get install vorbis-tools lame sox faad flac libsox-fmt-all fluidsynth # Only if you want SWI Prolog GUI -#sudo apt-get install libxpm-dev libxt-dev libjpeg-dev libx11-dev libxft-dev libxinerama1 libfontconfig1-dev +if [ $SWI_GUI == yes ]; then + $DO apt-get install libxpm-dev libxt-dev libjpeg-dev libx11-dev libxft-dev libxinerama1 libfontconfig1-dev +fi # If you have MATLAB if [ $HAVE_MATLAB == yes ]; then - MATLAB_ROOT=$(matlab -e | grep '^MATLAB=') - apt-get csh libtritonus-java libvorbisspi-java libmp3spi-java - ln -s /lib/x86_64-linux-gnu/libc.so.6 /lib64 - ln -s $(MATLAB_ROOT)/bin/matlab /usr/local/bin + echo "Checking for MATLAB..." 1>&2 + MATLAB_ROOT=$(matlab -e | grep '^MATLAB=' | sed -e 's/MATLAB=//') + echo "MATLAB installed in $MATLAB_ROOT" 1>&2 + $DO apt-get csh libtritonus-java libvorbisspi-java libmp3spi-java + $DO ln -sf /lib/x86_64-linux-gnu/libc.so.6 /lib64 + $DO ln -sf $MATLAB_ROOT/bin/matlab /usr/local/bin # MATLAB (R2012a at least) looks for Java extension jars in this directory - mkdir -p /usr/java/packages/lib/ext + $DO mkdir -p /usr/java/packages/lib/ext # NB - there may be some duplication of service providers here - I'm not sure # which of them works best. - ln -s /usr/shara/java/{vorbisspi,mp3spi}.jar /usr/java/packages/lib/ext - ln -s /usr/shara/java/tritonus_{aos,core,jorbis,mp3,remaining,share}.jar /usr/java/packages/lib/ext + $DO ln -sf /usr/shara/java/{vorbisspi,mp3spi}.jar /usr/java/packages/lib/ext + $DO ln -sf /usr/shara/java/tritonus_{aos,core,jorbis,mp3,remaining,share}.jar /usr/java/packages/lib/ext # need to add native library paths to this file - if [ ! grep '/usr/lib/jni' $(MATLAB_ROOT)/toolbox/local/librarypath.txt ]; then - echo '/usr/lib/jni' >> $(MATLAB_ROOT)/toolbox/local/librarypath.txt - end + if grep '/usr/lib/jni' $MATLAB_ROOT/toolbox/local/librarypath.txt; then + echo "MATLAB Library path already set." 1>&2 + else + if [ $DRY_RUN == yes ]; then + echo "echo '/usr/lib/jni' >> $MATLAB_ROOT/toolbox/local/librarypath.txt" + else + echo '/usr/lib/jni' >> $MATLAB_ROOT/toolbox/local/librarypath.txt + fi + fi fi -#if [ -x ~dml/.boot ]; then -# sudo -u dml -H mkdir -p ~dml/var/log -# sudo -u dml -H bash -l -c '~/.boot >> ~/var/log/boot.log' -#fi +$DO install -bC rc.local /etc -if $SETUP_X; then - if $HEADLESS; then - apt-get install xinit xserver-xorg-video-dummy - cp ~/etc/xorg.conf /etc/X11 + +if [ $SETUP_X == yes ]; then + echo "Setting up X server..." 1>&2 + if [ $HEADLESS == yes ]; then + echo "Installing dummy video driver for headless X server..." 1>&2 + $DO apt-get install xinit xserver-xorg-video-dummy + + $DO install --mode=644 -bC xorg.conf /etc/X11 else - apt-get install xinit blackbox + echo "Installing X server and window manager..." 1>&2 + $DO apt-get install xinit blackbox fi - dpkg-reconfigure x11-common + if [ $DRY_RUN == yes ]; then + $DO dpkg-reconfigure x11-common + else + echo + echo "I am about to call dpkg-reconfigure x11-common." + echo "Please select 'Anybody' to allow dml to start the X server automatically." + echo "Press RETURN to continue." + read + $DO dpkg-reconfigure x11-common + fi fi +
--- a/etc/xorg.conf Sun Jan 18 16:18:01 2015 +0000 +++ b/etc/xorg.conf Sun Jan 18 17:31:08 2015 +0000 @@ -1,50 +1,50 @@ # This xorg configuration file is meant to be used # to start a dummy X11 server. -Section "ServerFlags" - Option "DontVTSwitch" "true" - Option "AllowMouseOpenFail" "true" - Option "PciForceNone" "true" - Option "AutoEnableDevices" "false" - Option "AutoAddDevices" "false" +Section "ServerFlags" + Option "DontVTSwitch" "true" + Option "AllowMouseOpenFail" "true" + Option "PciForceNone" "true" + Option "AutoEnableDevices" "false" + Option "AutoAddDevices" "false" EndSection -Section "Device" - Identifier "DummyDevice" - Driver "dummy" +Section "Device" + Identifier "DummyDevice" + Driver "dummy" VideoRam 16384 - Option "NoDDC" "true" - Option "IgnoreEDID" "true" + Option "NoDDC" "true" + Option "IgnoreEDID" "true" EndSection -Section "InputDevice" - Identifier "DummyKeyboard" - Option "CoreKeyboard" "true" - Driver "void" +Section "InputDevice" + Identifier "DummyKeyboard" + Option "CoreKeyboard" "true" + Driver "void" EndSection -Section "Monitor" - Identifier "DummyMonitor" +Section "Monitor" + Identifier "DummyMonitor" HorizSync 10.0 - 300.0 VertRefresh 10.0 - 200.0 Modeline "800x600@25" 14.50 800 832 880 912 600 614 617 631 EndSection -Section "Screen" - Identifier "Screen0" - Monitor "DummyMonitor" - Device "DummyDevice" +Section "Screen" + Identifier "Screen0" + Monitor "DummyMonitor" + Device "DummyDevice" DefaultDepth 24 - SubSection "Display" + SubSection "Display" Viewport 0 0 Depth 24 - Modes "800x600" + Modes "800x600" Virtual 800 600 EndSubSection EndSection -Section "ServerLayout" - Identifier "DummyLayout" - Screen "Screen0" - InputDevice "DummyKeyboard" +Section "ServerLayout" + Identifier "DummyLayout" + Screen "Screen0" + InputDevice "DummyKeyboard" EndSection