@@ -25,23 +25,56 @@ if [ "$OVERWRITE_PLANET_FILE" == "true" ]; then
25
25
cloud_planetHistoryPBFFile=planet/planet-history-latest.osm.pbf
26
26
fi
27
27
28
+
28
29
# ===============================
29
30
# Download db .dump file
30
31
# ===============================
31
32
download_dump_file () {
32
- echo " Downloading db .dump file from cloud..."
33
- if [ " $CLOUDPROVIDER " == " aws" ]; then
34
- if [[ " $DUMP_CLOUD_URL " == * .txt ]]; then
35
- temp_txt=" $VOLUME_DIR /tmp_dump_url.txt"
36
- aws s3 cp " $DUMP_CLOUD_URL " " $temp_txt "
37
- first_line=$( head -n 1 " $temp_txt " )
38
- aws s3 cp " $first_line " " $dumpFile "
39
- else
40
- aws s3 cp " $DUMP_CLOUD_URL " " $dumpFile "
41
- fi
42
- elif [ " $CLOUDPROVIDER " == " gcp" ]; then
43
- gsutil cp " $DUMP_CLOUD_URL " " $dumpFile "
44
- fi
33
+ echo " Downloading db .dump file from cloud..."
34
+
35
+ if [ " $CLOUDPROVIDER " == " aws" ]; then
36
+ if [[ " $DUMP_CLOUD_URL " == * .txt ]]; then
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
+ # Set dump file name based on extension
45
+ if [[ " $first_line " == * .gz ]]; then
46
+ dumpFile=" ${dumpFile} .gz"
47
+ fi
48
+
49
+ aws s3 cp " $first_line " " $dumpFile "
50
+ if [[ " $dumpFile " == * .gz ]]; then
51
+ echo " Decompressing gzip file..."
52
+ gunzip -f " $dumpFile "
53
+ dumpFile=" ${dumpFile% .gz} "
54
+ fi
55
+ rm -f " $temp_txt "
56
+
57
+ else
58
+ # Set dump file name based on extension
59
+ if [[ " $DUMP_CLOUD_URL " == * .gz ]]; then
60
+ dumpFile=" ${dumpFile} .gz"
61
+ fi
62
+ aws s3 cp " $DUMP_CLOUD_URL " " $dumpFile "
63
+ if [[ " $dumpFile " == * .gz ]]; then
64
+ echo " Decompressing gzip file..."
65
+ gunzip -f " $dumpFile "
66
+ dumpFile=" ${dumpFile% .gz} "
67
+ fi
68
+ fi
69
+
70
+ elif [ " $CLOUDPROVIDER " == " gcp" ]; then
71
+ gsutil cp " $DUMP_CLOUD_URL " " $dumpFile "
72
+ else
73
+ echo " Unsupported CLOUDPROVIDER: $CLOUDPROVIDER "
74
+ exit 1
75
+ fi
76
+
77
+ echo " Dump file ready at: $dumpFile "
45
78
}
46
79
47
80
# ===============================
0 commit comments