This repository has been archived by the owner on Jul 6, 2023. It is now read-only.
forked from Bluefire2/xic
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Unzipped the course-supplied vm.zip and added the setup files for common use. - Added vim swap file extension and vm/.vagrant to gitignore since they are local files.
- Loading branch information
1 parent
c00cd64
commit e5d901b
Showing
9 changed files
with
323 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
# Custom ignores | ||
*.swp | ||
vm/.vagrant | ||
|
||
# Created by .ignore support plugin (hsz.mobi) | ||
### Gradle template | ||
.gradle | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
== INSTALL ==================================================================== | ||
|
||
(1) Install VirtualBox _and_ VirtualBox Extension Pack: | ||
https://www.virtualbox.org/wiki/Downloads | ||
|
||
(2) Install Vagrant: | ||
* Windows, Mac OS X: https://www.vagrantup.com/downloads.html | ||
* Ubuntu: apt-get install vagrant | ||
|
||
(2.5) Under Windows, you may have to reboot... | ||
|
||
(3) Make sure you are connected to the Internet, preferably via a fast | ||
connection. Run 'vagrant up && vagrant ssh' from inside this directory (NOT the "base" directory). | ||
|
||
(4) You are now accessing the VM via ssh. | ||
To look around, run 'ls -l'. (Note the shared folder.) | ||
To exit, run 'exit'. | ||
|
||
(5) To halt the VM, run 'vagrant halt'. | ||
To spin it back up, run 'vagrant up && vagrant ssh' again. | ||
To remove the VM, run 'vagrant destroy'. | ||
|
||
(6) The folder ./shared on your host machine is accessible from the virtual | ||
machine at ~/shared. You can do all editing etc on your physical machine and | ||
use the virtual machine only for building & running your application. | ||
|
||
(7) Refer to the README for more options and frequently asked questions. | ||
|
||
(*) Tip: You may want to run `vagrant plugin install vagrant-vbguest` in the | ||
vagrant folder on your physical machine. This will ensure your | ||
"VirtualBox Guest Additons" are always up to date (outdated Guest Additions | ||
can sometimes cause problems). | ||
|
||
(*) Tip: You can restart the virtual machine by running `vagrant reload`. This | ||
can sometimes fix problems (and will update your Guest Additions, provided | ||
you followed the tip above). | ||
|
||
-------------------------------------------------------------------------------- | ||
- Jan 2019 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
== CS 4120 VM ================================================================== | ||
|
||
We provide this virtual machine to avoid cross-platform issues. It comes | ||
with Java 11, Scala, (Ant, Maven, Gradle, sbt), JFlex, OCaml (Opam, Oasis), Haskell (ghcup, | ||
cabal-install, stack), and Python 2/3 preinstalled. | ||
|
||
It also comes with the test harness (xth) preinstalled. To execute it, simple | ||
execute `xth` inside the VM. | ||
|
||
Note that the folder 'shared' is mounted at the path '~/shared' in the VM to | ||
facilitate easy sharing of project files. You can do all editing etc. on your | ||
physical machine and use the virtual machine only to build and run your | ||
application. | ||
|
||
To get started, refer to the INSTALL file. | ||
|
||
Note: do NOT use the files inside the "base" folder, unless you would like to customize the VM | ||
and/or troubleshoot environment issues with the course staff. | ||
|
||
Note that the Scala, OCaml, and Haskell installs have not been extensively verified. | ||
If you run into issues, please let us know. | ||
|
||
|
||
-- FAQ ------------------------------------------------------------------------- | ||
|
||
How can I mount my xic folder on the physical machine to the virtual machine? | ||
|
||
Modify the file "Vagrantfile.local" in the vagrant directory and add the | ||
following command to it: | ||
config.vm.synced_folder "<path on physical machine>", "/home/vagrant/xic" | ||
Then run `vagrant reload`. | ||
|
||
|
||
The course VM has been updated. How do I update my machine? | ||
|
||
First, make sure that any files on the VM are backed up. Then, just | ||
run `vagrant box update`, `vagrant destroy`, then `vagrant up` to bring | ||
it back up. | ||
|
||
|
||
How can I make my compiler executable by typing just `xic` instead of | ||
`<path>/xic`? | ||
|
||
Your xic executable must be on the PATH. The easiest way to achieve this is to | ||
execute | ||
ln -s <absolute path to xic> ~/bin | ||
which creates a symbolic link to xic in the folder ~/bin; ~/bin is on the PATH | ||
by default. | ||
|
||
|
||
I want to use a custom Vagrant file! | ||
|
||
Sure. Add any commands you want to "Vagrantfile.local" in the vagrant folder. | ||
add any vagrant commands you want. Execute `vagrant reload` to restart the VM | ||
and reload the Vagrantfiles. | ||
|
||
|
||
-------------------------------------------------------------------------------- | ||
- Jan 2019 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
|
||
Vagrant.configure("2") do |config| | ||
config.vm.box = "cs4120-cornell/cs4120-sp19" | ||
# config.vm.box_version = " = 4.0.0" # to declare a specific version | ||
|
||
# Add local definitions. | ||
eval File.read("Vagrantfile.local") if File.exist?("Vagrantfile.local") | ||
|
||
config.ssh.forward_x11 = true | ||
|
||
config.vm.provider "virtualbox" do |vb| | ||
vb.customize [ "modifyvm", :id, "--uartmode1", "disconnected" ] | ||
end | ||
|
||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
### Default shared folder | ||
config.vm.synced_folder "./shared", "/home/vagrant/shared" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
|
||
include_root_bootstrap = File.expand_path("../include/root-bootstrap.sh", __FILE__) | ||
include_user_bootstrap = File.expand_path("../include/user-bootstrap.sh", __FILE__) | ||
|
||
Vagrant.configure(2) do |config| | ||
|
||
config.vm.box = "ubuntu/bionic64" | ||
|
||
config.vm.provider "virtualbox" do |vb| | ||
vb.memory = "1024" | ||
vb.cpus = 1 | ||
end | ||
|
||
config.vm.hostname = "cs4120" | ||
|
||
# Add local definitions. | ||
eval File.read("Vagrantfile.local") if File.exist?("Vagrantfile.local") | ||
|
||
config.ssh.forward_x11 = true | ||
# Don't replace insecure SSH key in the base image. This will automatically be overwritten by | ||
# Vagrant when running the derived image. | ||
config.ssh.insert_key = false | ||
|
||
config.vm.provision "shell", path: include_root_bootstrap | ||
config.vm.provision "shell", privileged: false, path: include_user_bootstrap | ||
|
||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
# Prompt | ||
PROMPT_COMMAND="RET=$?; printf '\n'" | ||
PS1="\[\e[0;32m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\]\[\e[0;32m\]$ \[\e[m\]" | ||
|
||
# Aliases for convenience | ||
alias grep='grep --color=always' | ||
alias less='less -R' | ||
alias ls="ls -G" | ||
|
||
# update xth on login | ||
~/xth/update |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#!/bin/bash | ||
set -x | ||
set -e | ||
|
||
export DEBIAN_FRONTEND="noninteractive" | ||
|
||
# basics - do not modify! | ||
apt-get -qq update | ||
apt-get -qq install \ | ||
software-properties-common \ | ||
python3-software-properties \ | ||
pkg-config \ | ||
wget \ | ||
unzip \ | ||
zip \ | ||
dpkg \ | ||
m4 \ | ||
nano vim \ | ||
ncdu \ | ||
htop \ | ||
x11-apps | ||
|
||
# Oracle JDK 11 (LTS) | ||
add-apt-repository ppa:linuxuprising/java | ||
apt-get -qq update | ||
echo oracle-java11-installer shared/accepted-oracle-license-v1-2 select true | debconf-set-selections | ||
echo oracle-java11-installer shared/accepted-oracle-license-v1-2 seen true | debconf-set-selections | ||
apt-get -qq install oracle-java11-installer | ||
|
||
# Ant | ||
apt-get -qq install ant | ||
|
||
# Maven | ||
apt-get -qq install maven | ||
|
||
# Qt | ||
apt-get -qq install cmake libqt4-dev libqt4-designer libqt4-opengl libqt4-svg libqtgui4 libqtwebkit4 libstdc++-4.8-dev g++ | ||
|
||
# Gradle | ||
GRADLE=gradle-5.1.1 | ||
GRADLEZIP=gradle-5.1.1-bin.zip | ||
wget -nv -N https://services.gradle.org/distributions/$GRADLEZIP | ||
unzip -d /opt/ $GRADLEZIP | ||
ln -s /opt/$GRADLE/bin/gradle /usr/local/bin/ | ||
rm $GRADLEZIP | ||
|
||
# Scala | ||
SCALA=scala-2.12.8.deb | ||
wget -nv -N www.scala-lang.org/files/archive/$SCALA | ||
dpkg -i $SCALA &>/dev/null | ||
apt-get -qq update &>/dev/null | ||
apt-get -qq install scala 2>/dev/null | ||
rm "$SCALA" | ||
|
||
# Scala sbt | ||
echo "deb https://dl.bintray.com/sbt/debian /" | tee -a /etc/apt/sources.list.d/sbt.list | ||
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823 | ||
apt-get -qq update | ||
apt-get -qq install sbt | ||
sbt update | ||
|
||
# OCaml | ||
apt-get -qq install ocaml opam | ||
|
||
# Haskell dependencies | ||
apt-get -qq install libgmp-dev libnuma-dev | ||
|
||
# for backwards compatability | ||
chown -R vagrant $HOME | ||
|
||
# see user-bootstrap.sh for more non-sudo bootstrapping |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
#!/bin/bash | ||
set -x | ||
set -e | ||
|
||
command_exists () { | ||
type "$1" &> /dev/null ; | ||
} | ||
|
||
# put or link binaries here | ||
BIN=$HOME/bin | ||
|
||
# put things that should only be run once here | ||
MARK=$HOME/.initialized | ||
if [ ! -e $MARK ] ; then | ||
# add $BIN to PATH | ||
mkdir -p $BIN | ||
echo "PATH+=:$BIN" >> $HOME/.profile | ||
|
||
# nice prompt | ||
cat /vagrant/include/profile >> $HOME/.profile | ||
|
||
# Jflex | ||
JFLEX="jflex-1.6.1" | ||
ARCHIVE="$JFLEX.tar.gz" | ||
wget -nv -N http://jflex.de/release/$ARCHIVE | ||
tar -zxf $ARCHIVE | ||
rm $ARCHIVE | ||
ln -sf $HOME/$JFLEX/bin/jflex $HOME/bin | ||
echo -e "\nexport JFLEX_HOME=$HOME/jflex/" >> $HOME/.profile | ||
|
||
# OCaml opam | ||
if command_exists opam ; then | ||
opam init -y #&>/dev/null | ||
eval `opam config env` | ||
echo '' >> $HOME/.profile | ||
echo '#OPAM' >> $HOME/.profile | ||
echo 'eval `opam config env`' >> $HOME/.profile | ||
|
||
# Oasis | ||
opam install oasis -y &>/dev/null | ||
fi | ||
|
||
# Haskell - install ghcup, GHC, and cabal-install | ||
mkdir -p ~/.ghcup/bin | ||
curl -sSL https://raw.githubusercontent.com/haskell/ghcup/master/ghcup > ~/.ghcup/bin/ghcup | ||
chmod +x ~/.ghcup/bin/ghcup | ||
PATH+=:"$HOME/.cabal/bin:$HOME/.ghcup/bin:$PATH" | ||
echo 'PATH+=:"$HOME/.cabal/bin:$HOME/.ghcup/bin:$PATH"' >> $HOME/.profile | ||
ghcup install | ||
ghcup set | ||
ghcup install-cabal | ||
cabal new-update | ||
|
||
# Haskell stack - install to $BIN | ||
curl -sSL https://get.haskellstack.org/ | sh -s - -d $BIN | ||
|
||
# insecure SSH setup | ||
# https://www.vagrantup.com/docs/boxes/base.html | ||
curl -sSL https://github.com/hashicorp/vagrant/raw/master/keys/vagrant.pub >> ~/.ssh/authorized_keys | ||
|
||
touch $MARK | ||
echo "VAGRANT: DO NOT REMOVE" >> $MARK | ||
fi | ||
|
||
WEBSEMESTER=2019sp | ||
|
||
#Everything below will be used later in the semester | ||
|
||
# test harness - do not modify! | ||
XTH=xth.tar.gz | ||
wget -nv -N http://www.cs.cornell.edu/courses/cs4120/$WEBSEMESTER/project/$XTH | ||
mkdir -p xth | ||
tar -zxf $XTH -C xth --owner=vagrant | ||
ln -sf $HOME/xth/xth $BIN | ||
|
||
## runtime libraries - do not modify! | ||
#XIRT=pa5-release.zip | ||
#wget -nv -N -q http://www.cs.cornell.edu/courses/cs4120/$WEBSEMESTER/pa/pa5/$XIRT && \ | ||
# mkdir -p runtime && \ | ||
# unzip -q $XIRT "pa5_student/runtime/*" -d runtime && \ | ||
# (cd runtime ; cp -frp pa5_student/runtime/* . ; rm -rf pa5_student ; make) || \ | ||
#true | ||
# | ||
## QtXi libraries - do not modify! | ||
#XIRT=pa7-release.zip | ||
#wget -nv -N -q http://www.cs.cornell.edu/courses/cs4120/$WEBSEMESTER/pa/pa7/$XIRT && \ | ||
# mkdir -p runtime && \ | ||
# unzip -q $XIRT "pa7_student/QtXi/*" -d QtXi && \ | ||
# (cd QtXi ; cp -frp pa7_student/QtXi/* . ; rm -rf pa7_student ; make) || \ | ||
#true |