aboutsummaryrefslogtreecommitdiff
path: root/bin/zchain-reset
diff options
context:
space:
mode:
Diffstat (limited to 'bin/zchain-reset')
-rwxr-xr-xbin/zchain-reset27
1 files changed, 27 insertions, 0 deletions
diff --git a/bin/zchain-reset b/bin/zchain-reset
new file mode 100755
index 0000000..2a289c0
--- /dev/null
+++ b/bin/zchain-reset
@@ -0,0 +1,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
+