Last active
August 29, 2015 14:06
-
-
Save SagaieNet/32865064ff3a18d791c4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# generate.sh | |
# Version 2.1 | |
# Script to generate a new bootstrap.dat from a *coin-QT data directory | |
# Copyright (c) Felix Friedlander 2014 | |
##DD needs to have folders in it corresponding to the currencies you are going to generate | |
DD=$HOME | |
cd $DD | |
for i in $@ | |
do | |
echo "Preparing to generate bootstrap for ${i}" | |
WD="${DD}/${i}" | |
cd $WD | |
if [ -e bootstrap.dat ] | |
then | |
echo "bootstrap.dat exists. It will be deleted and re-created." | |
rm -f bootstrap.dat | |
##You could do this, but my version is meant to run automatically | |
#echo "File already exists." | |
#read -p "Overwrite (Y/n)? " -i "y" -n 1 choice | |
#if [ $choice = "n" ] | |
#then | |
# continue | |
#fi | |
#rm -f bootstrap.dat | |
else | |
echo "bootstrap.dat does not exist. It will be created." | |
fi | |
if [ -e bootstrap.dat.xz ] | |
then | |
echo "bootstrap.dat.xz exists. It will be overwrittten." | |
##You could do this, but my version is meant to run automatically | |
#echo "File already exists." | |
#read -p "Overwrite (Y/n)? " -i "y" -n 1 choice | |
#if [ $choice = "n" ] | |
#then | |
# continue | |
#fi | |
#rm -f bootstrap.dat.xz | |
else | |
echo "bootstrap.dat.xz does not exist. It will be created." | |
fi | |
echo "Concatenating to bootstrap.dat..." | |
cat /Users/frief17/Library/Application\ Support/${i}/blocks/blk* > bootstrap.dat | |
echo "Done." | |
echo "Compressing with xz..." | |
xz -kf9v bootstrap.dat | |
echo "Done." | |
echo "Marking files up to date..." | |
touch bootstrap.dat bootstrap.dat.xz | |
echo "Done." | |
##OLD METHOD | |
##========== | |
##This method is old, and unneccessarialy slow. | |
##It works, though, so feel free to reuse it. | |
#echo "Concatenating blockfiles to bootstrap.dat" | |
#for b in $(ls blk*) | |
#do | |
# cat $b >> ${WD}/bootstrap.dat | |
#done | |
#echo "Concatenation complete." | |
#cd $WD | |
#rm -f bootstrap.dat.gz | |
#echo "Compressing bootstrap.dat using using Lempel-Ziv coding (LZ77)" | |
#gzip -9f bootstrap.dat | |
#echo "Compression complete." | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment