Skip to content

Instantly share code, notes, and snippets.

@ifndefJOSH
Last active February 15, 2022 19:58
Show Gist options
  • Save ifndefJOSH/fc3f9e6702f864d02b2fd9e2010c2621 to your computer and use it in GitHub Desktop.
Save ifndefJOSH/fc3f9e6702f864d02b2fd9e2010c2621 to your computer and use it in GitHub Desktop.
Installs the stuff we use in FluentVerification
#!/bin/bash
###########################################
#
# Install Script for FluentVerification tools
# Tools installed:
# 1. PRISM
# 2. Stamina 2.0 with PRISM
# 3. STORM
# 4. IVy
###########################################
# === Where everything is to be installed to ===
INSTALL_DIRECTORY='/opt'
# === Toggles which packages we should attempt to install
INSTALL_PRISM=true
INSTALL_STAMINA=true
INSTALL_STORM=true
INSTALL_IVY=true
# === Attempt to install the required packages on DEBIAN or ARCH based systems
DEBIAN_BASED=true
ARCH_BASED=false
echo "Attempting to install the required packages to set up PRISM, STORM, and STAMINA"
if [ $DEBIAN_BASED && $INSTALL_PRISM ]
then
echo "Attempting to use apt, as this is a Debian-system"
sudo apt-get update
sudo apt-get -y install openjdk-11-jre openjdk-11-jdk git build-essential
else if [ $ARCH_BASED && $INSTALL_PRISM ]
then
echo "Attempting to use pacman as this is an Arch System"
sudo pacman -Syu
sudo pacman -S base-devel # Equivalent to build-essential
sudo pacman -S git
sudo pacman -S jdk11-openjdk
sudo pacmman -S jre11-openjdk
else
then
echo "No dependencies to install!"
fi
sudo mkdir -P $INSTALL_DIRECTORY/verificationTools/
# ==== Install and Set up the latest version of PRISM ===
if [ $INSTALL_PRISM ]
then
echo "Installing PRISM"
cd $INSTALL_DIRECTORY/verificationTools/
git clone https://github.com/prismmodelchecker/prism prism-source
cd prism-source/prism
git checkout v4.5
make -j$(nproc)
make test
cp bin/prism $INSTALL_DIRECTORY/verificationTools
cp bin/xprism $INSTALL_DIRECTORY/verificationTools
PRISM_HOME=$(pwd)
echo "Finished installing PRISM to $INSTALL_DIRECTORY/verificationTools"
fi
# ==== Install and Set up the latest version of STAMINA PRISM ====
if [ $INSTALL_STAMINA && $INSTALL_PRISM ]
then
echo "Installing STAMINA with PRISM"
cd $INSTALL_DIRECTORY/verificationTools
git clone https://github.com/fluentverification/stamina.git stamina-source
cd stamina/stamina
make PRISM_HOME=$(PRISM_HOME) -j$(nproc)
cp bin/stamina $INSTALL_DIRECTORY/verificationTools
echo "Finished installing STAMINA"
elif [ $INSTALL_STAMINA ]
then
echo "[ERROR] Cannot install STAMINA without installing PRISM!"
fi
# === Remove the source directories for PRISM and STAMINA as we don't need them
if [ $INSTALL_STAMINA && $INSTALL_PRISM ]
then
echo -n "Cleaning source directories for STAMINA..."
sudo rm -rf $INSTALL_DIRECTORY/verificationTools/stamina-source
echo "done."
fi
if [ $INSTALL_PRISM ]
then
echo -n "Cleaning source directories for PRISM..."
sudo rm -rf $INSTALL_DIRECTORY/verificationTools/prism-source
echo "done."
fi
# ==== Install the STORM model checker
if [ $INSTALL_STORM ]
then
echo "Getting STORM Source code"
cd $INSTALL_DIRECTORY/verificationTools
git clone -b stable https://github.com/moves-rwth/storm.git storm-source
mkdir -P storm-source/build
cd storm-source/build
cmake ..
make binaries -j8
sudo mv storm $INSTALL_DIRECTORY/verificationTools
echo "Finished installing STORM"
cd $INSTALL_DIRECTORY/verificationTools
rm -rf storm-source
fi
# ==== Install the IVy Modelling language ====
if [ $INSTALL_IVY ]
then
echo "Installing needed dependencies for IVy"
sudo apt update
sudo apt-get install python python-pip g++ cmake python-ply python-pygraphviz git python-tk tix pkg-config libssl-dev
echo "Installing IVy"
cd $INSTALL_DIRECTORY/verificationTools
git clone --recurse-submodules https://github.com/kenmcmil/ivy.git ivy-source
cd ivy-source
python build_submodules.py
sudo python setup.py install
echo "Finished installing IVy"
fi
echo -n "Updating your \$PATH variable to include $INSTALL_DIRECTORY/verificationTools..."
cd ~
# NOTE: This script ONLY supports bash and zsh
export PATH=$INSTALL_DIRECTORY/verificationTools:$PATH
if [ -f .bashrc ]
then
echo "export PATH=$INSTALL_DIRECTORY/verificationTools:$PATH" >> .bashrc
fi
if [ -f .zshrc ]
then
echo "export PATH=$INSTALL_DIRECTORY/verificationTools:$PATH" >> .zshrc
fi
echo "done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment