@@ -23,23 +23,50 @@ if [ "$OVERWRITE_PLANET_FILE" == "true" ]; then
23
23
cloud_planetPBFFile=planet/planet-latest.osm.pbf
24
24
fi
25
25
26
+ # ===============================
27
+ # Download db .dump file
28
+ # ===============================
26
29
# ===============================
27
30
# Download db .dump file
28
31
# ===============================
29
32
download_dump_file () {
30
- echo " Downloading db .dump file from cloud..."
31
- if [ " $CLOUDPROVIDER " == " aws" ]; then
32
- if [[ " $DUMP_CLOUD_URL " == * .txt ]]; then
33
- temp_txt=" $VOLUME_DIR /tmp_dump_url.txt"
34
- aws s3 cp " $DUMP_CLOUD_URL " " $temp_txt "
35
- first_line=$( head -n 1 " $temp_txt " )
36
- aws s3 cp " $first_line " " $dumpFile "
37
- else
38
- aws s3 cp " $DUMP_CLOUD_URL " " $dumpFile "
39
- fi
40
- elif [ " $CLOUDPROVIDER " == " gcp" ]; then
41
- gsutil cp " $DUMP_CLOUD_URL " " $dumpFile "
42
- fi
33
+ echo " Downloading db .dump file from cloud..."
34
+ if [ " $CLOUDPROVIDER " == " aws" ]; then
35
+ if [[ " $DUMP_CLOUD_URL " == * .txt ]]; then
36
+ # Download the .txt file containing the URL
37
+ temp_txt=" $VOLUME_DIR /tmp_dump_url.txt"
38
+ aws s3 cp " $DUMP_CLOUD_URL " " $temp_txt "
39
+
40
+ # Get the first line (S3 URL to the .dump or .dump.gz file)
41
+ first_line=$( head -n 1 " $temp_txt " )
42
+ echo " Found dump URL in txt: $first_line "
43
+
44
+ aws s3 cp " $first_line " " $dumpFile "
45
+
46
+ # Check if it's compressed (.gz) and decompress
47
+ if [[ " $first_line " == * .gz ]]; then
48
+ echo " Decompressing gzip file..."
49
+ gunzip -f " $dumpFile "
50
+ dumpFile=" ${dumpFile% .gz} "
51
+ fi
52
+ else
53
+ aws s3 cp " $DUMP_CLOUD_URL " " $dumpFile "
54
+ # If it's compressed, decompress
55
+ if [[ " $DUMP_CLOUD_URL " == * .gz ]]; then
56
+ echo " Decompressing gzip file..."
57
+ gunzip -f " $dumpFile "
58
+ dumpFile=" ${dumpFile% .gz} "
59
+ fi
60
+ fi
61
+
62
+ elif [ " $CLOUDPROVIDER " == " gcp" ]; then
63
+ gsutil cp " $DUMP_CLOUD_URL " " $dumpFile "
64
+ else
65
+ echo " Unsupported CLOUDPROVIDER: $CLOUDPROVIDER "
66
+ exit 1
67
+ fi
68
+
69
+ echo " Dump file ready at: $dumpFile "
43
70
}
44
71
45
72
0 commit comments