-
Notifications
You must be signed in to change notification settings - Fork 4
/
platform2_set.sh
121 lines (105 loc) · 5.4 KB
/
platform2_set.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# ##################################################################################################
# Install platform
# --------------------------------------------------------------------------------------------------
# This file script should be placed inside .../platform/plat_installation ($BUILD_DIR or plat_repo) and
# the tar.gz package in the packages_targz dir ($BUILD_DIR/packages_targz)
# --------------------------------------------------------------------------------------------------
# run from plat_repo as ./install_script/platform.sh
# ##################################################################################################
cd PLAT_BUILD
SCRIPT_NAME=platform_scripts
dir_script=install_scripts
if [ -d $dir_script ] ; then
# =============================================================================
# 1) ================== environment setup =====================================
# =============================================================================
# ===============================================================================================
# FIRST LEVEL DIRECTORIES
# ================================================================================================
# $PLAT_DIR(platform) $BUILD_DIR(PLAT_REPO) $INSTALL_BUILD_TAR_DIR(packages_targz)
# $INSTALL_PLAT_LOG_DIR(packages_log)
# $PLAT_THIRD_PARTY_DIR(PLAT_THIRD_PARTY)
# $PLAT_USERS_DIR(PLAT_USERS)
# $PLAT_CODES_DIR(PLAT_CODES)
# $PLAT_VISU_DIR(PLAT_VISU)
# =================================================================================================
echo
echo platform_script ": Script platform set up "
echo
# 1a building and plat dir setup ---------> BUILD_DIR
BUILD_DIR=$PWD
# down to platform dir ------------------> INSTALL_DIR
cd ../; PLAT_DIR=$PWD
sed -e "4s|.*|export PLAT_DIR=$PLAT_DIR|" $PLAT_DIR/PLAT_BUILD/install_scripts/plat_conf_template.sh>$PLAT_DIR/platform_conf.sh
# 1b make directory -------------------------------------------------------------
ok=1
echo "platform_script": 1b set up: Check main installation directories:
# if [ ! -d $PLAT_DIR ];
# then echo -e " Directory .../platform/plat_repo does not already exists !!!!!";
# ok=1 ;
# else echo -e " Directory .../platform/plat_repo does already exists. Overwriting ";
# ok=0;
# fi
# ZIPPED PACKAGE DIRECTORY
INSTALL_BUILD_TAR_DIR=$BUILD_DIR/packages_targz/
if [ ! -d $INSTALL_BUILD_TAR_DIR ];
then echo -e "Directory $BUILD_DIR/packages_targz dir dos not already exists";
mkdir $INSTALL_BUILD_TAR_DIR
ok=1 ;
else echo -e "Directory $BUILD_DIR/packages_targz does already exists. Overwriting ";
ok=0;
fi
# INSTALLATION LOG DIRECTORY
INSTALL_PLAT_LOG_DIR=$BUILD_DIR/package_logs
if [ ! -d $INSTALL_PLAT_LOG_DIR ];
then mkdir $INSTALL_PLAT_LOG_DIR;
else echo -e " Directory .../platform/package_logs does already exists. Overwriting ";
fi
echo Check main installation directories 1 level = $ok
echo "platform_script": make level 1 directories:
PLAT_THIRD_PARTY_DIR=$PLAT_DIR/PLAT_THIRD_PARTY
if [ ! -d $PLAT_THIRD_PARTY_DIR ]; then mkdir $PLAT_THIRD_PARTY_DIR;
else echo -e " Directory .../platform/plat_third_party does already exist! "; fi
PLAT_USERS_DIR=$PLAT_DIR/PLAT_USERS
if [ ! -d $PLAT_USERS_DIR ]; then mkdir $PLAT_USERS_DIR;
else echo -e " Directory .../platform/plat_users does already exist! "; fi
PLAT_CODES_DIR=$PLAT_DIR/PLAT_CODES
if [ ! -d $PLAT_CODES_DIR ]; then mkdir $PLAT_CODES_DIR;
else echo -e " Directory .../platform/plat_codes does already exist! "; fi
PLAT_VISU_DIR=$PLAT_DIR/PLAT_VISU
if [ ! -d $PLAT_VISU_DIR ]; then mkdir $PLAT_VISU_DIR;
else echo -e " Directory .../platform/plat_visu does already exist! "; fi
# 1c --------------- platform setup -------------------------------------------
echo
echo
echo
echo $SCRIPT_NAME ": 1c Platform set up 1 Level directory ------> platform_conf.sh: summary "
echo "-----------------------------------------------------------------------------------------"
echo $SCRIPT_NAME ": 1c Platform DIR (platform or software or ...) is = " $PLAT_DIR
echo
echo $SCRIPT_NAME ": 1c BUILD dir (BUILD_DIR) is = " $BUILD_DIR
echo $SCRIPT_NAME ": 1c INSTALL_BUILD_TAR_DIR (package archive dir) = " $INSTALL_BUILD_TAR_DIR
echo $SCRIPT_NAME ": 1c INSTALL_PLAT_LOG_DIR (log dir) = " $INSTALL_PLAT_LOG_DIR
echo
echo $SCRIPT_NAME ": 1c PLAT_THIRD_PARTY_DIR (third party code dir) = " $PLAT_THIRD_PARTY_DIR
echo $SCRIPT_NAME ": 1c PLAT_USERS_DIR (users dir) = " $PLAT_USERS_DIR
echo $SCRIPT_NAME ": 1c PLAT_CODES_DIR (codes dir) = " $PLAT_CODES_DIR
echo $SCRIPT_NAME ": 1c PLAT_VISU (visualization dir) = " $PLAT_VISU_DIR
echo "-----------------------------------------------------------------------------------------"
echo
echo " platform_conf.sh " generated
echo
cd $BUILD_DIR
else
echo "Wrong directory for this script !!!!! Go to plat_repo (BUILD_DIR) !!!!!!"
fi
#
# ADDING NumericPlatform ALIAS TO ~/.bashrc if not already there
#
export PLAT_NAME=$(basename $PLAT_DIR)
isThere=`type -t $PLAT_NAME`
if [ -z "$isThere" ]; then
echo "alias $PLAT_NAME='export NUPLAT=$PLAT_DIR && cd \$NUPLAT && source platform_conf.sh && cd - '" >> ~/.bashrc;
else echo "$PLAT_NAME alias is already in your ~/.bashrc" ;
fi
cd ../