view etc/setup_as_root.sh @ 30:2c279c979bcd

Pulled out MATLAB initialisation into a separate script.
author samer
date Mon, 16 Feb 2015 22:03:22 +0000
parents 11e21255b404
children ad0bfbaddf6a
line wrap: on
line source
#!/bin/sh
# ---------------------- 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
$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
$DO apt-get install mysql-server-5 libmyodbc

# Only if you want SWI Prolog GUI
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
	DO=$DO DRY_RUN=$DRY_RUN as_root.d/init_matlab.sh
fi

$DO install -bC rc.local /etc


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
		echo "Installing X server and window manager..." 1>&2
		$DO apt-get install xinit blackbox
	fi

	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