2021-04-13 17:26:11 +02:00
|
|
|
set -eu
|
2021-04-13 18:25:28 +02:00
|
|
|
|
2021-04-18 22:41:35 +02:00
|
|
|
indb="$1"
|
|
|
|
outdir="$2"
|
2021-04-18 18:10:25 +02:00
|
|
|
|
2021-04-18 22:41:35 +02:00
|
|
|
bytes="$(stat --printf="%s" "$indb")"
|
2021-04-13 17:26:11 +02:00
|
|
|
serverChunkSize=$((50 * 1024 * 1024))
|
|
|
|
suffixLength=3
|
2021-04-18 22:41:35 +02:00
|
|
|
rm -f "$outdir/db.sqlite3"*
|
|
|
|
split "$indb" --bytes=$serverChunkSize "$outdir/db.sqlite3." --suffix-length=$suffixLength --numeric-suffixes
|
|
|
|
requestChunkSize="$(sqlite3 "$indb" 'pragma page_size')"
|
2021-04-13 18:25:28 +02:00
|
|
|
echo '
|
|
|
|
{
|
2021-04-18 18:10:25 +02:00
|
|
|
"requestChunkSize": '$requestChunkSize',
|
2021-04-13 18:25:28 +02:00
|
|
|
"databaseLengthBytes": '$bytes',
|
|
|
|
"serverChunkSize": '$serverChunkSize',
|
|
|
|
"urlPrefix": "db.sqlite3.",
|
|
|
|
"suffixLength": '$suffixLength'
|
|
|
|
}
|
2021-04-18 22:41:35 +02:00
|
|
|
' > "$outdir/config.json"
|