Commit e450707c authored by Arnaud Blanchard's avatar Arnaud Blanchard
Browse files

Rename to clone_and_install_ubuntu_blaar.sh and automatically update .bashrc

parent be7b83ca
#!/usr/bin/env bash
# Basic Libraries And Applications for Robotics (BLAAR)
# Copyright ETIS — ENSEA, University of Cergy-Pontoise, CNRS (2011 - 2017)
# Author: Arnaud Blanchard
......@@ -11,13 +12,21 @@
# Users are therefore encouraged to load and test the software's suitability as regards their requirements in conditions enabling the security of their systems and/or data to be ensured  and, more generally, to use and operate it in the same conditions as regards security.
# The fact that you are presently reading this means that you have had knowledge of the CeCILL v2.1 license and that you accept its terms.
#!/usr/bin/env bash #Use your $PATH to find bash
{ #Bracket to be sure the file is fully loaded before excuting
set -o errexit #Exit on first error
set -o nounset #Error if a variable is used but nont defined
set -o pipefail #Error if a pipe fail
set_bash_profile_and_refresh(){
echo "We create or update your $HOME/.bash_profile redefining env variables 'BLAAR_DIR' and 'PATH'"
{ echo "#Definitions for blaar (http://blaar.org)"
echo "export BLAAR_DIR=$PWD"
echo "export PATH=$PATH:$BLAAR_DIR/bin:$BLAAR_DIR/scripts"
echo
} >> $HOME/.bashrc
source $HOME/.bashrc
}
{ #Bracket to be sure the file is fully loaded before excuting
echo
echo "Standard blaar install"
echo "======================"
......@@ -55,6 +64,19 @@ echo
./install.sh all
./check_all.sh
echo
if [ "${BLAAR_DIR+set}" ]; then #Test if BLAAR_DIR is defined. "${BLAAR_DIR+set}" means content "set" if exist
if [ ! $BLAAR_DIR = "$PWD" ]; then
#We remove any reference to blaar in bash_profile
sed -i~ -e"s|#Definitions for blaar (http://blaar.org)||" -e"s|BLAAR_DIR=$BLAAR_DIR" -e "s|:$BLAAR_DIR/bin/||" -e "s|:$BLAAR_DIR/scripts||" $HOME/.bash_profile
#We remove also any reference to it in env varaibles
export PATH=$(echo $PATH|sed -e "s|:$BLAAR_DIR/bin/||" -e "s|:$BLAAR_DIR/scripts||")
unset $BLAAR_DIR
set_bash_profile_and_refresh
echo "You have a previous installation of blaar in '$BLAAR_DIR'. We have redefined your standard version to '$PWD'"
fi
else
set_bash_profile_and_refresh
fi
echo "**Success installing standard blaar**"
echo
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment