-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdeploy.sh
executable file
·50 lines (46 loc) · 1.02 KB
/
deploy.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
#!/bin/bash
BASE=`pwd`
PYTHON=python3
MODULES=modules
DESTINATION=sources
map_folder() {
local DIR=$1
local FUNCTION=$2
local FOLDERS=`ls $MODULES$DIR`
local f
echo -e " "$FOLDERS
echo
local TAB="$3."
for f in $FOLDERS; do
$FUNCTION $DIR/$f $TAB
done
}
do_deploy() {
if [ -f $MODULES$1 ]; then
echo $2 Deploiement de : $MODULES$1
if [ "${1#*.}" = "w" ]; then
filename=`basename $1`
if [ "${filename%.*}" = "root" ]; then
echo $2 "=>" Fichier web racine
$PYTHON literale/prepare.py -b `dirname $MODULES$1` `basename $1` | \
$PYTHON literale/tangle.py -d `dirname $DESTINATION$1`
fi
else
cp -fpr $MODULES$1 $DESTINATION$1
fi
fi
if [ -d $MODULES$1 ]; then
echo $2 Deploiement de : $MODULES$1/
mkdir -p $DESTINATION$1
map_folder $1 do_deploy $2
fi
}
do_all() {
echo Dossier de travail : $MODULES
echo Dossier destination : $DESTINATION
echo
echo Deploiement de : $MODULES
map_folder "" do_deploy ""
}
# Point d'entrée
do_all