From 41ae242ce37d1af369bf472b8b253e22b4d44b03 Mon Sep 17 00:00:00 2001 From: snamber Date: Fri, 14 Feb 2014 19:27:08 +0100 Subject: [PATCH 1/5] modified path to python executable in pizza.py --- src/lpp.py | 1 + src/pizza.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lpp.py b/src/lpp.py index d021541..1af4166 100755 --- a/src/lpp.py +++ b/src/lpp.py @@ -1,4 +1,5 @@ #!/usr/bin/env python + oneline = "writing pp-data in vtk format automatically, saving memory" docstr = """this is the docstr of LIGGGHTSPostProcessing""" diff --git a/src/pizza.py b/src/pizza.py index ec88f13..138c1c4 100755 --- a/src/pizza.py +++ b/src/pizza.py @@ -1,4 +1,4 @@ -#!/usr/local/bin/python -i +#!/usr/bin/python -i # Pizza.py toolkit, www.cs.sandia.gov/~sjplimp/pizza.html # Steve Plimpton, sjplimp@sandia.gov, Sandia National Laboratories From b682f1d949e5f93092719b6b3921dceca2a086a0 Mon Sep 17 00:00:00 2001 From: snamber Date: Fri, 14 Feb 2014 20:50:39 +0100 Subject: [PATCH 2/5] modified installation script --- install.sh | 86 ++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 71 insertions(+), 15 deletions(-) diff --git a/install.sh b/install.sh index 2004cc5..7170b1d 100755 --- a/install.sh +++ b/install.sh @@ -1,22 +1,78 @@ #!/bin/bash -if test "`id -u`" -ne 0 - then - echo "ERROR: You need to run this script as root" - exit -fi +PREFIX=$HOME/bin -echo "checking for old installations..." -if [[ -L /usr/bin/lpp ]]; then - echo "ERROR: you need to uninstall old lpp versions first." - echo "you can do by so executing" - echo "sudo rm /usr/bin/lpp /usr/bin/pizza" +USAGE="usage\n\t./install.sh [-p path] [-h]\n\ +\t-p\tset install directory\n\ +\t-h\thelp" + +# get prefix if passed +while getopts "p:h" OPTION; do + case $OPTION in + p ) + PREFIX=$OPTARG + ;; + h ) + echo -e $USAGE + exit 4 + ;; + ? ) + echo -e $USAGE + exit 4 + ;; + esac +done + + +# check prefix +if [[ ! -d $PREFIX ]]; then + echo "directory '$PREFIX' not found" + echo "create directory or choose different install directory using the -p flag" exit 1 fi -echo "setting symbolic links..." -ln -s $(pwd)/src/lpp.py /usr/bin/lpp -echo "checking installation..." -echo "which lpp" -echo $(which lpp) \ No newline at end of file +# check old installations +echo "checking for old installations..." +if hash lpp 2>/dev/null ; then + echo "WARNING: lpp is already installed on your system." + echo " please remove $(which lpp) before reinstalling." +fi +if hash pizza 2>/dev/null ; then + echo "WARNING: pizza is already installed on your system." + echo " please remove $(which pizza) before reinstalling." +fi +if hash lpp 2>/dev/null ; then + exit 2; +fi +if hash pizza 2>/dev/null ; then + exit 2; +fi + + +# create symlinks +echo "creating symlinks..." +ln -s $(pwd)/src/lpp.py $PREFIX/lpp +if [ $? -ne 0 ]; then + echo "cannot create symbolic link for lpp" + echo "use a different install directory or try calling this script as root" + exit 3 +fi + +ln -s $(pwd)/src/pizza.py $PREFIX/pizza +if [ $? -ne 0 ]; then + echo "cannot create symbolic link for pizza" + echo "use a different install directory or try calling this script as root" + exit 3 +fi + + +# update path if lpp cannot be found +if ! hash lpp 2>/dev/null; then + echo "updating path..." + echo -e "\n" >> $HOME/.bashrc + echo 'export PATH='$PREFIX':$PATH' >> $HOME/.bashrc + echo -e "\n" >> $HOME/.bashrc + export PATH=$PREFIX:$PATH + echo "please execute the command 'bash' to finalize the installation" +fi From ea353da9073ce929971b385671f6e518399f047a Mon Sep 17 00:00:00 2001 From: snamber Date: Fri, 14 Feb 2014 20:52:32 +0100 Subject: [PATCH 3/5] updated INSTALL.txt --- INSTALL.txt | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/INSTALL.txt b/INSTALL.txt index 5ad389c..b4c693f 100644 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -1,12 +1,3 @@ -to install *liggghts post processing* (lpp) execute the following -./install.sh +to install *liggghts post processing* (lpp) and pizza.py execute - - - -to install *pizza.py* copy the following lines of code -into your bashrc (please change the variable CFDEM_lppPath according -to your system): - -CFDEM_pizzaPath=/Users/s/work/parallelpizza/nightly_build -alias pizza ="python -i $CFDEM_pizzaPath/src/pizza.py" +./install.sh \ No newline at end of file From 0a520a4ba78203831075376268ddc2f2677f912b Mon Sep 17 00:00:00 2001 From: snamber Date: Fri, 14 Feb 2014 21:03:38 +0100 Subject: [PATCH 4/5] extended INSTALL.txt to include non-default case --- INSTALL.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/INSTALL.txt b/INSTALL.txt index b4c693f..4aecbd7 100644 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -1,3 +1,7 @@ to install *liggghts post processing* (lpp) and pizza.py execute -./install.sh \ No newline at end of file +./install.sh + +or if you want to specify an install directory other then ~/bin + +./install.sh -p path/to/install/directory \ No newline at end of file From b8a7b6afdf74190dee41c28e0e3cad8d2cfd9a79 Mon Sep 17 00:00:00 2001 From: snamber Date: Fri, 14 Feb 2014 21:04:46 +0100 Subject: [PATCH 5/5] whitespace error --- INSTALL.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/INSTALL.txt b/INSTALL.txt index 4aecbd7..7ff56c1 100644 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -4,4 +4,4 @@ to install *liggghts post processing* (lpp) and pizza.py execute or if you want to specify an install directory other then ~/bin -./install.sh -p path/to/install/directory \ No newline at end of file +./install.sh -p path/to/install/directory