aboutsummaryrefslogtreecommitdiff
path: root/bin/zchain-reset
blob: 2a289c0a9d13ca8885f70c16a7137e1a0ffc8e4c (plain)
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
#!/bin/bash
title(){
	echo "Zchain reset"
	echo "------------"
}
usage(){
	echo "Usage: $0 reset"
	exit 0
}
reset (){
	cp $ZGENESIS $ZLATEST
	ipfs name publish --key=zchain /ipfs/$ZLATEST
	ipfs files mkdir /zarchive
	ipfs files cp /zlatest /zarchive/$(date -u +%s)-$(ipfs files stat /zlatest | head -n 1)
	ipfs files rm /zlatest
	ipfs files cp /ipfs/$(cat $ZLATEST) /zlatest
	echo "Probably reset"
	exit 0
}
if [ ! -z $1 ]; then
	case $1 in
		reset) reset; exit;;
		* ) usage;;
	esac
else usage
fi