From 822d9f417146c76792c4b60281d603c0ed9c3fdf Mon Sep 17 00:00:00 2001 From: adrien-matta <a.matta@surrey.ac.uk> Date: Wed, 23 Apr 2014 12:40:30 +0100 Subject: [PATCH] * adding a simpler system to edit the rootlogon.C of the user - A simple target rootlogon has been added to the makefile - The target call a script that add the need line to .rootlogon - if the file does not exist it is created --- NPLib/Makefile | 5 ++++ NPLib/scripts/RootLogon.sh | 51 +++++++++++++++++++++++++++++++++ NPLib/scripts/rootlogon_basic.C | 4 +++ 3 files changed, 60 insertions(+) create mode 100755 NPLib/scripts/RootLogon.sh create mode 100644 NPLib/scripts/rootlogon_basic.C diff --git a/NPLib/Makefile b/NPLib/Makefile index 4a5302489..9845b444b 100644 --- a/NPLib/Makefile +++ b/NPLib/Makefile @@ -32,6 +32,11 @@ liblistfile: $(FILLLIB) $(SHARELIB) $(FILLIB) # where the wanted detector are defined include $(NPTOOL)/NPLib/Makefile.detector +######## rootlogon modification ######## +rootlogon: + ./scripts/RootLogon.sh + + ############# Clean and More ########## clean: rm -f ./*/*.o diff --git a/NPLib/scripts/RootLogon.sh b/NPLib/scripts/RootLogon.sh new file mode 100755 index 000000000..f406333ed --- /dev/null +++ b/NPLib/scripts/RootLogon.sh @@ -0,0 +1,51 @@ +# ***************************************************************************** +# * Copyright (C) 2014 this file is part of the NPTool Project * +# * * +# * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * +# * For the list of contributors see $NPTOOL/Licence/Contributors * +# *****************************************************************************/ + +# ***************************************************************************** +# * Original Author: A. Matta contact address: a.matta@surrey.ac.uk * +# * * +# * Creation Date : 23/4/2014 * +# * Last update : * +# *---------------------------------------------------------------------------* +# * Decription: This script edit the user .rootlogon.C file to load NPTool * +# * Libraries. * +# * * +# *---------------------------------------------------------------------------* +# * Comment: * +# * * +# * * +# ***************************************************************************** + +#! /bin/bash + +# test if the ~/.rootlogon.C file exist, if no create it +if [ -f ~/.rootlogon.C ]; +then + echo 'File .rootlogon.C already exist: attempt to modified it' + # Check if NPTOOL stuff is already in + SEARCH=$(grep NPTOOL ~/test.C) + echo $SEARCH + if [ ! -n "$SEARCH" ]; + then + echo 'Appending missing line to the file' + sed -i -e 's#{#{\ + TString NPLPath = gSystem->Getenv(\"NPTOOL\");\ + gROOT->ProcessLine(Form(\".x %s/NPLib/scripts/NPToolLogon.C+\", NPLPath.Data()));\ +#g' ~/.rootlogon.C + else + echo 'Some NPTool Lib already loading in .rootlogon.C : please check the file' + fi + +else + echo 'File .rootlogon.C was created' + cp rootlogon_basic.C ~/.rootlogon.C +fi + + + + + diff --git a/NPLib/scripts/rootlogon_basic.C b/NPLib/scripts/rootlogon_basic.C new file mode 100644 index 000000000..eb15e958e --- /dev/null +++ b/NPLib/scripts/rootlogon_basic.C @@ -0,0 +1,4 @@ +{ + TString NPLPath = gSystem->Getenv("NPTOOL"); + gROOT->ProcessLine(Form(".x %s/NPLib/scripts/NPToolLogon.C+", NPLPath.Data())); +} -- GitLab