1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/cjdns_ynh.git synced 2024-09-03 18:16:29 +02:00

cjdroute.conf not shown in the logs

This commit is contained in:
dkoukoul 2023-12-06 11:29:18 +02:00
parent c5194a9d54
commit 53702cb2c5
2 changed files with 5 additions and 10 deletions

View file

@ -42,8 +42,6 @@ ynh_script_progression --message="Getting cjdns peers..." --weight=1
json=$(curl -s https://vpn.anode.co/api/0.3/vpn/cjdns/peeringlines/) json=$(curl -s https://vpn.anode.co/api/0.3/vpn/cjdns/peeringlines/)
echo "Got peering lines" echo "Got peering lines"
config=$(cat $install_dir/cjdroute.conf | jq .)
length=$(echo $json | jq '. | length') length=$(echo $json | jq '. | length')
ynh_script_progression --message="Adding $length cjdns peers..." --weight=1 ynh_script_progression --message="Adding $length cjdns peers..." --weight=1
for (( i=0; i<$length; i++ )) for (( i=0; i<$length; i++ ))
@ -54,8 +52,7 @@ do
login=$(echo $json | jq -r --argjson i $i '.[$i].login') login=$(echo $json | jq -r --argjson i $i '.[$i].login')
password=$(echo $json | jq -r --argjson i $i '.[$i].password') password=$(echo $json | jq -r --argjson i $i '.[$i].password')
publicKey=$(echo $json | jq -r --argjson i $i '.[$i].publicKey') publicKey=$(echo $json | jq -r --argjson i $i '.[$i].publicKey')
#echo "Read peer $ip:$port $login $password $publicKey"
#read -p "Enter to continue"
# Prepare the peer to be inserted # Prepare the peer to be inserted
peer=$(jq -n \ peer=$(jq -n \
--arg ip_port "$ip:$port" \ --arg ip_port "$ip:$port" \
@ -63,14 +60,13 @@ do
--arg password "$password" \ --arg password "$password" \
--arg publicKey "$publicKey" \ --arg publicKey "$publicKey" \
'{($ip_port): {"login": $login, "password": $password, "publicKey": $publicKey}}') '{($ip_port): {"login": $login, "password": $password, "publicKey": $publicKey}}')
#echo "Prepared peer $peer"
# Insert the peer into the cjdroute.conf file
config=$(echo $config | jq --argjson peer "$peer" '(.interfaces.UDPInterface[] | select(.beaconPort == 64512) .connectTo) |= . + $peer') # Insert the peer into the cjdroute.conf file
jq --argjson peer "$peer" '(.interfaces.UDPInterface[] | select(.beaconPort == 64512) .connectTo) |= . + $peer' $install_dir/cjdroute.conf > $install_dir/cjdroute.conf.tmp
mv $install_dir/cjdroute.conf.tmp $install_dir/cjdroute.conf
done done
echo $config > $install_dir/cjdroute.conf cjdns_ipv6=$(jq -r '.ipv6' < $install_dir/cjdroute.conf)
cjdns_ipv6=$(echo $config | jq '.ipv6')
#================================================= #=================================================

View file

@ -33,7 +33,6 @@ ynh_remove_systemd_config
#================================================= #=================================================
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
systemctl stop cjdns
killall cjdroute killall cjdroute
# Remove other various files specific to the app... such as : # Remove other various files specific to the app... such as :