Extract geth data directly to destination directory
This commit is contained in:
parent
b7ccf24c93
commit
0bbce517e3
@ -28,13 +28,18 @@ ADDITIONAL_FLAGS=""
|
|||||||
if [ ! -d "$geth_dir" ] && [ "${CERC_USE_SNAPSHOT}" = "true" ] && [ -n "$snapshot_file" ]; then
|
if [ ! -d "$geth_dir" ] && [ "${CERC_USE_SNAPSHOT}" = "true" ] && [ -n "$snapshot_file" ]; then
|
||||||
echo "Using snapshot $snapshot_file"
|
echo "Using snapshot $snapshot_file"
|
||||||
|
|
||||||
temp_dir=$(mktemp -d)
|
|
||||||
case $snapshot_file in
|
case $snapshot_file in
|
||||||
*.lz4)
|
*.lz4)
|
||||||
lz4 -d $snapshot_file | tar -C $temp_dir -xvf -
|
archive_geth_path=$(lz4 -c -d $snapshot_file | tar -tf - | grep -m1 -E 'geth/?$')
|
||||||
|
to_strip=$(($(echo "$archive_geth_path" | grep -o '/' | wc -l) - 1))
|
||||||
|
|
||||||
|
lz4 -c -d $snapshot_file | tar -C ${DATA_DIR}/ -xvf - --strip-components=$to_strip $archive_geth_path
|
||||||
;;
|
;;
|
||||||
*.zst)
|
*.zst)
|
||||||
zstd -c -d $snapshot_file | tar -C $temp_dir -xvf -
|
archive_geth_path=$(zstd -c -d $snapshot_file | tar -tf - | grep -m1 -E 'geth/?$')
|
||||||
|
to_strip=$(($(echo "$archive_geth_path" | grep -o '/' | wc -l) - 1))
|
||||||
|
|
||||||
|
zstd -c -d $snapshot_file | tar -C ${DATA_DIR}/ -xvf - --strip-components=$to_strip $archive_geth_path
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unsupported archive format for the snapshot file: $snapshot_file"
|
echo "Unsupported archive format for the snapshot file: $snapshot_file"
|
||||||
@ -42,11 +47,6 @@ if [ ! -d "$geth_dir" ] && [ "${CERC_USE_SNAPSHOT}" = "true" ] && [ -n "$snapsho
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Move geth data to data dir
|
|
||||||
extracted_geth_dir=$(find $temp_dir -type d -name "geth" -print -quit)
|
|
||||||
mv $extracted_geth_dir ${DATA_DIR}/
|
|
||||||
rm -rf $temp_dir
|
|
||||||
|
|
||||||
if [ "${CERC_FAST_NODE}" = "true" ]; then
|
if [ "${CERC_FAST_NODE}" = "true" ]; then
|
||||||
echo "Pruning trie data and turning snapshot verification off"
|
echo "Pruning trie data and turning snapshot verification off"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user