1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/duniter_ynh.git synced 2024-09-03 18:26:35 +02:00
duniter_ynh/scripts/install

38 lines
957 B
Text
Raw Normal View History

2015-05-24 23:01:16 +02:00
#!/bin/bash
# Retrieve arguments
2015-06-13 15:40:35 +02:00
#ipv4=$(ifconfig | grep "inet addr:" | sed '1!d' | cut -d : -f 2 | cut -b -14)
#ipv4=$(traceroute -4 maelstro.me | grep ms | cut -d " " -f 4)
2015-05-24 23:01:16 +02:00
domain=$1
port=$2
sync_node=$3
sync_port=$4
salt=$5
pwd=$6
#cpu=$(($7/100))
2015-06-02 23:57:56 +02:00
#cpu=`expr $7 / 100`
2015-05-24 23:01:16 +02:00
# Install dependencies: nodejs, npm
sudo apt-get -y -qq install nodejs npm nodejs-legacy
# Install uCoin node and pm2 daemon manager
git clone https://github.com/ucoin-io/ucoin /tmp/ucoin
2015-06-13 15:00:17 +02:00
sudo npm install -g /tmp/ucoin pm2
2015-05-24 23:01:16 +02:00
# Check port availability
sudo yunohost app checkport $port
if [[ ! $? -eq 0 ]]; then
exit 1
fi
# Open port on firewall
2015-05-24 23:01:16 +02:00
sudo yunohost firewall allow TCP $port > /dev/null 2>&1
2015-06-02 22:53:19 +02:00
# Configure and sync uCoin node
ucoind config --noupnp --ipv4 $ipv4 --remote4 $ipv4 --remoteh $domain --port $port --remotep $port --salt $salt --passwd $pwd
# --cpu $cpu
2015-06-02 22:53:19 +02:00
ucoind sync $sync_node $sync_port
2015-05-24 23:01:16 +02:00
# Launch uCoin node with pm2 daemon
2015-06-02 23:57:56 +02:00
pm2 start /usr/bin/ucoind -- start