-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathtab_stats_manage_generation.sh
More file actions
36 lines (35 loc) · 1.55 KB
/
tab_stats_manage_generation.sh
File metadata and controls
36 lines (35 loc) · 1.55 KB
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
#!/bin/bash
#########################################################################
# This script manage the generation/update of the tab represented by the
# file "tab_statistics.md".
#########################################################################
OSHP_SECURITY_HEADERS_EXTRA_FILE_LOCATION="../subprojects/statistics/scripts/oshp_headers_extra_to_include.txt"
OSHP_SECURITY_HEADERS_EXTRA_FILE="/tmp/oshp_headers_extra_to_include.txt"
DATA_DB_FILE_LOCATION="../subprojects/statistics/data/data.db"
DATA_DB_FILE="/tmp/data.db"
IMAGE_FOLDER_LOCATION="../assets/tab_stats_generated_images"
echo "[+] Prepare and validate datasources used..."
cp $OSHP_SECURITY_HEADERS_EXTRA_FILE_LOCATION $OSHP_SECURITY_HEADERS_EXTRA_FILE
cp $DATA_DB_FILE_LOCATION $DATA_DB_FILE
file $DATA_DB_FILE
sqlite3 $DATA_DB_FILE ".tables"
file $OSHP_SECURITY_HEADERS_EXTRA_FILE
wc -l $OSHP_SECURITY_HEADERS_EXTRA_FILE
echo "[+] Set correct access rights for the scripts as well as UNIX CRLF settings..."
dos2unix *.sh
chmod +x tab_stats_generate_*
echo "[+] Generate the MD file of the TAB and all the MMD files for every pie chart image..."
python tab_stats_generate_md_file.py
echo "[+] Generate the PNG image corresponding to each MMD file..."
bash tab_stats_generate_png_files.sh
echo "[+] Check correct generation of the images..."
img_count=$(find $IMAGE_FOLDER_LOCATION -name "*.png" | wc -l)
if [ $img_count -eq 0 ]
then
echo "[!] No image file was generated!"
exit 1
else
echo "[V] $img_count image files were generated!"
sha256sum $IMAGE_FOLDER_LOCATION/*.png
exit 0
fi