-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmk
executable file
·68 lines (57 loc) · 1.36 KB
/
mk
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
#!/bin/bash
function check_okay {
if [ $? -ne 0 ]
then
echo
echo "FAILED"
echo
exit 1
fi
}
# Define directories to be created
DIRS=(
"LOGS"
"LOGS/SED"
"data/filters"
"data/MIST"
"data/stellar_models"
)
# Create directories if they don't exist
for dir in "${DIRS[@]}"; do
if [ ! -d "$dir" ]; then
mkdir -p "$dir"
fi
done
# Define remote data file location
REMOTE_FILE="https://nialljmiller.com/media/bigdata/MESA/testdata.txz"
LOCAL_FILE="testdata.txz"
EXTRACTED_FLAG="data/extracted_marker" # Marker file to track extraction
# Download the file if it doesn't exist locally
if [ ! -f "$EXTRACTED_FLAG" ]; then
if [ ! -f "$LOCAL_FILE" ]; then
echo "Downloading test data from $REMOTE_FILE..."
curl -L -o "$LOCAL_FILE" "$REMOTE_FILE" || { echo "Download failed"; exit 1; }
else
echo "Test data file already exists locally. Skipping download."
fi
if [ -f "$LOCAL_FILE" ]; then
echo "Extracting test data..."
tar -xJf "$LOCAL_FILE" --directory=data --strip-components=1 || { echo "Extraction failed"; exit 1; }
touch "$EXTRACTED_FLAG" # Create marker file
rm "$LOCAL_FILE"
else
echo "Missing test data file. Extraction skipped."
fi
else
echo "Test data exists"
fi
# Proceed to make
cd make
make
check_okay
if [ -f "$LOCAL_FILE" ]; then
rm "$LOCAL_FILE"
echo "Custom colours has been made"
else
echo "Custom colours has been made"
fi