summarylogtreecommitdiffstats
path: root/ergo-node
diff options
context:
space:
mode:
Diffstat (limited to 'ergo-node')
-rwxr-xr-xergo-node23
1 files changed, 23 insertions, 0 deletions
diff --git a/ergo-node b/ergo-node
new file mode 100755
index 000000000000..2fc2abb054a2
--- /dev/null
+++ b/ergo-node
@@ -0,0 +1,23 @@
+#!/bin/sh
+# Ergo node normally writes all its data in the current working directory
+# This is a wrapper script to make Ergo node use Xdg base directories
+if [ -z $XDG_DATA_HOME ]; then
+ DATA_DIR=~/.local/share/ergo-node
+else
+ DATA_DIR=$XDG_DATA_HOME/ergo-node
+fi
+if [ -z $XDG_CONFIG_HOME ]; then
+ CONFIG_DIR=~/.config/ergo-node
+else
+ CONFIG_DIR=$XDG_CONFIG_HOME/ergo-node
+fi
+
+mkdir -p $DATA_DIR
+mkdir -p $CONFIG_DIR
+if ! [ -f $CONFIG_DIR/local.conf ]; then
+ # Copy sample config file if the user hasn't created one
+ cp /usr/share/ergo-node/local.conf.sample $CONFIG_DIR/local.conf
+fi
+
+cd $DATA_DIR
+java -jar /usr/share/ergo-node/ergo.jar --mainnet -c $CONFIG_DIR/local.conf "$@"