Commit 49ab11be authored by Pfeiffer, Götz's avatar Pfeiffer, Götz
Browse files

Allow all scripts to run directly from the bii_scripts directory.


When the file SETENV-RUN-LOCAL.sh is sourced it sets the enivronment for
running the scripts directly from the bii_scripts project without the need to
run "make install" first. This is useful for debugging the scripts.
parent e26d660e
......@@ -46,6 +46,17 @@ At BESSY (HZB) install on our development hosts with this command::
./install.sh
Running the scripts directly from the source directory
======================================================
In order to run the scripts directly from the source directory you have to
"source" the file SETENV-RUN-LOCAL.sh like shown here::
. ./SETENV-RUN-LOCAL.sh
This feature is here for making it easier to debug the scripts, usually you
should do a regular install as described above.
Documentation
=============
......
# Source this script in order to run the scripts locally!
BII_SCRIPTS_TOP=$(dirname $(readlink -e $0))
# make scripts executable:
chmod u+rwx $BII_SCRIPTS_TOP/bin/*
# set environment:
export PERL5LIB=$BII_SCRIPTS_TOP/lib/perl:$PERL5LIB
export PYTHONPATH=$BII_SCRIPTS_TOP/lib/python:$PYTHONPATH
PATH=$BII_SCRIPTS_TOP/bin:$PATH
export BII_SCRIPTS_SHARE_DIR=$BII_SCRIPTS_TOP/share
# set prompt:
PS1="bii-scr $PS1"
......@@ -93,6 +93,7 @@ $global_data{license}= [ "HZB License"];
$global_data{os} = $Config{osname};
# may be empty if file doesn't exist:
my %bii_scripts_config= read_biiscripts_config();
if (!GetOptions("help|h", "bigfonts|b"))
......@@ -132,7 +133,20 @@ $global_data{home} = $ENV{"HOME"};
if (!defined $global_data{home})
{ $global_data{home} = ""; };
my $share_dir= $bii_scripts_config{SHARE_INSTALL_DIR} . "/bii_scripts/browsedb";
my $share_dir;
if (exists $ENV{BII_SCRIPTS_SHARE_DIR})
{
$share_dir= $ENV{BII_SCRIPTS_SHARE_DIR} . "/bii_scripts/browsedb";
}
else
{
if (!exists $bii_scripts_config{SHARE_INSTALL_DIR})
{
die "error: share dir cannot be set";
}
$share_dir= $bii_scripts_config{SHARE_INSTALL_DIR} .
"/bii_scripts/browsedb";
}
$global_data{share_dir} = $share_dir;
......@@ -7342,11 +7356,15 @@ sub conn_f_find
sub read_biiscripts_config
{
my %bii_config;
my $filename = "$FindBin::RealBin/bii_scripts.config";
if (! -e $filename)
{
return %bii_config;
}
open(my $fh, '<:encoding(UTF-8)', $filename)
or die "Could not open file '$filename' $!";
my $TOP= dirname("$FindBin::RealBin");
my %bii_config;
while (my $line = <$fh>)
{
chomp $line;
......
......@@ -174,8 +174,18 @@ while true; do
esac
done
. $MYDIR/bii_scripts.config
CONFIGFILE_PATH=$SHARE_INSTALL_DIR/bii_scripts/rsync-dist
# read bii_scripts configuration variables:
if [ -e $MYDIR/bii_scripts.config ]; then
. $MYDIR/bii_scripts.config
fi
# the share directory is either set by BII_SCRIPTS_SHARE_DIR or by
# SHARE_INSTALL_DIR as it is defined in bii_scripts.config:
if [ -z "$BII_SCRIPTS_SHARE_DIR" ]; then
BII_SCRIPTS_SHARE_DIR="$SHARE_INSTALL_DIR"
fi
CONFIGFILE_PATH=$BII_SCRIPTS_SHARE_DIR/bii_scripts/rsync-dist
configfile="$CONFIGFILE_PATH/$app-$part"
......
......@@ -109,8 +109,18 @@ while true; do
esac
done
. $MYDIR/bii_scripts.config
CONFIGFILE_PATH=$SHARE_INSTALL_DIR/bii_scripts/rsync-dist
# read bii_scripts configuration variables:
if [ -e $MYDIR/bii_scripts.config ]; then
. $MYDIR/bii_scripts.config
fi
# the share directory is either set by BII_SCRIPTS_SHARE_DIR or by
# SHARE_INSTALL_DIR as it is defined in bii_scripts.config:
if [ -z "$BII_SCRIPTS_SHARE_DIR" ]; then
BII_SCRIPTS_SHARE_DIR="$SHARE_INSTALL_DIR"
fi
CONFIGFILE_PATH=$BII_SCRIPTS_SHARE_DIR/bii_scripts/rsync-dist
configfile="$CONFIGFILE_PATH/$app-$part"
......
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