-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsimple_setup.sh
executable file
·67 lines (55 loc) · 1.62 KB
/
simple_setup.sh
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
# Define variables
JUNEO_NODE_DIR="$HOME/juneogo-binaries"
JUNEO_BIN="$HOME/juneogo"
JUNEO_SERVICE_DIR="$HOME/.config/systemd/user"
JUNEO_SERVICE_FILE="$JUNEO_SERVICE_DIR/juneogo.service"
PLUGINS_DIR="$HOME/.juneogo/plugins"
BINARIES_REPO="https://github.com/Juneo-io/juneogo-binaries"
# Check that the script is not run as root
if [ "$EUID" -eq 0 ]; then
echo "This script should not be run as root"
exit 1
fi
# Clone the binaries repository
echo "Cloning juneogo binaries from $BINARIES_REPO..."
if ! git clone "$BINARIES_REPO" "$JUNEO_NODE_DIR"; then
echo "Error: Failed to clone juneogo binaries."
exit 1
fi
# Moving binary and config file to the home directory
mv $JUNEO_NODE_DIR/juneogo $HOME
mv $JUNEO_NODE_DIR/config.json $HOME
# Set up binaries and plugins
chmod +x "$JUNEO_BIN"
mkdir -p "$PLUGINS_DIR"
if [ -d "$JUNEO_NODE_DIR/plugins" ]; then
mv "$JUNEO_NODE_DIR/plugins/"* "$PLUGINS_DIR"
chmod +x "$PLUGINS_DIR"/*
fi
echo "Node files have been set up in $JUNEO_NODE_DIR"
echo
# Create a systemd service to run the node
mkdir -p "$JUNEO_SERVICE_DIR"
cat << EOF > "$JUNEO_SERVICE_FILE"
[Unit]
Description=JuneoGo Node
After=network.target
[Service]
Type=simple
ExecStart=$JUNEO_BIN --config-file="./config.json"
LimitNOFILE=32768
Restart=on-failure
RestartSec=10
[Install]
WantedBy=default.target
EOF
# Enable and start the node service
systemctl --user daemon-reload
systemctl --user enable juneogo.service
systemctl --user start juneogo.service
rm -Rf $JUNEO_NODE_DIR
echo
echo "Done! Your JuneoGo node setup is complete."
echo
echo "To check the node's process, use: journalctl --user -u juneogo"