Last active
August 29, 2015 13:55
-
-
Save alghanmi/8699994 to your computer and use it in GitHub Desktop.
Update CSCI 103 VM to 104 Standards
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## Check if g++-4.8 is installed | |
_GPP_PREF_VER="4.8" | |
_GPP_LOC="$(readlink -f $(which g++))" | |
_GPP_VER="$(g++ --version | head -1 | sed 's/g++ \(.*\) \(.*\)/\2/' - | cut -d. -f1,2)" | |
if [ "$_GPP_LOC" == "/usr/bin/g++-$_GPP_PREF_VER" ]; then | |
if [ "$_GPP_VER" != "$_GPP_PREF_VER" ]; then | |
echo "Please contact your TA and inform them that you have g++-$_GPP_PREF_VER installed, but it is not the default g++ on your system" | |
exit 1 | |
else | |
echo "You have g++ v$_GPP_VER installed at $_GPP_LOC. No need to run this script" | |
exit 0 | |
fi | |
fi | |
## Force to run as root | |
if [ "$(id -u)" != "0" ]; then | |
echo "This script must be run as root" 1>&2 | |
exit 1 | |
fi | |
SCRIPT_USERNAME=$SUDO_USER | |
# Remove bad repo | |
rm -f /etc/apt/sources.list.d/medibuntu.list* | |
#Add Testing Tool Chain | |
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com BA9EF27F # ToolChain | |
echo "# Toolchain PPA" | tee /etc/apt/sources.list.d/toolchain.list | |
echo "deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu $(lsb_release -cs) main" | tee -a /etc/apt/sources.list.d/toolchain.list | |
echo "deb-src http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu $(lsb_release -cs) main " | tee -a /etc/apt/sources.list.d/toolchain.list | |
# Update current installation | |
aptitude update | |
aptitude -y upgrade | |
# Install required packages | |
aptitude install ssh openssh-server openssl build-essential binutils byobu \ | |
gcc-4.8 g++-4.8 \ | |
sudo ntp curl \ | |
gdb ddd valgrind cscope qemu colorgcc openjdk-7-jdk icedtea-7-plugin \ | |
bison flex \ | |
texinfo libncurses5-dev \ | |
libqt4-core libqt4-gui qt4-qmake qt4-qtconfig qt4-doc-html \ | |
qt4-dev-tools libqt4-dev libqt4-core libqt4-gui qtmobility-dev \ | |
doxygen \ | |
python-networkx python-matplotlib python-numpy graphviz \ | |
vim-gtk vim-scripts emacs23 emacs-goodies-el gedit gedit-plugins gedit-developer-plugins \ | |
nano enscript highlight astyle colordiff diffstat meld \ | |
subversion subversion-tools git mercurial \ | |
unzip zip gqview | |
# Make gcc 4.8 the latest | |
update-alternatives --remove-all gcc | |
update-alternatives --remove-all g++ | |
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20 | |
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20 | |
update-alternatives --config gcc | |
update-alternatives --config g++ | |
# Install the latest GDB | |
sudo aptitude remove --purge gdb | |
wget http://ftp.gnu.org/gnu/gdb/gdb-7.6.2.tar.gz | |
tar zxvf gdb-*.tar.gz | |
cd gdb-* | |
./configure --prefix=/usr | |
make | |
make install | |
cd .. | |
rm -rf gdb-* | |
# Clean-up | |
aptitude clean | |
aptitude autoclean |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To run this, you would need the following commands: