forked from mapbox/mbutil
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatch
More file actions
37 lines (30 loc) · 683 Bytes
/
patch
File metadata and controls
37 lines (30 loc) · 683 Bytes
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
#!/usr/bin/env bash
# Usage:
#
# $ patch [source] [dest]
#
# Inserts all tiles from [source] into [dest], replacing any old tiles
# in [dest].
SOURCE=$1
DEST=$2
if [ -z "$SOURCE" ] || [ -z "$DEST" ]; then
echo "Usage: merge [source] [dest]"
exit 1
fi
if [ ! -f $SOURCE ]; then
echo "File '$SOURCE' does not exist."
exit 1
fi
if [ ! -f $DEST ]; then
echo "File '$DEST' does not exist."
exit 1
fi
echo "Patch $SOURCE => $DEST ..."
echo "
PRAGMA journal_mode=PERSIST;
PRAGMA page_size=80000;
PRAGMA synchronous=OFF;
ATTACH DATABASE '$1' AS source;
REPLACE INTO map SELECT * FROM source.map;
REPLACE INTO images SELECT * FROM source.images;"\
| sqlite3 $2