aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.com>2021-03-15 02:06:26 +0200
committerkaotisk <kaotisk@arching-kaos.com>2021-03-15 02:06:26 +0200
commit7e6f0dd23f0d49c265396708309a110c4f7e6b49 (patch)
treedf15988ea5b290e788f048d31c80611a6617a236
parent386676e77abecf6b4f837ab2651980c263000482 (diff)
downloadpython-cjdns-peering-tools-7e6f0dd23f0d49c265396708309a110c4f7e6b49.tar.gz
python-cjdns-peering-tools-7e6f0dd23f0d49c265396708309a110c4f7e6b49.tar.bz2
python-cjdns-peering-tools-7e6f0dd23f0d49c265396708309a110c4f7e6b49.zip
Production ready! We check if cjdroute is there... yet no backup
-rwxr-xr-xgen.sh27
1 files changed, 14 insertions, 13 deletions
diff --git a/gen.sh b/gen.sh
index cbf6bcf..7af4a9c 100755
--- a/gen.sh
+++ b/gen.sh
@@ -1,18 +1,19 @@
-#!/bin/sh
-# Previous implementation
-#cjdroute --genconf > cjdroute.json
-#grep -v '^\s*//\|^\s*$' cjdroute.json > cjdroute-nc.json
-#perl -p0e 's!/\*.*?\*/!!sg' cjdroute-nc.json > cjdroute.conf
+#!/bin/bash
-# Nowadays :)
+# Nowadays :) <- we keep this in order to learn something valueable, soon to be deleted!
#cjdroute --genconf | sed -n '/^\/\*.*\*\//!p' | sed -n '/ \/\/.*/!p' | sed 's|/\*|\n&|g;s|*/|&\n|g' | sed '/\/\*/,/*\//d' > cjdroute.conf
# Futuristic way B-)
-sudo dnf install cjdns-tools -y
-sudo systemctl start cjdns
-sudo systemctl stop cjdns
-cjdroute --genconf | cjdroute --cleanconf > cjdroute.conf
+echo "gen.sh - Peering tools"
+echo "Checking for existing configuration (WARNING!! All comments will be stripped)"
+if [ -f /etc/cjdroute.conf ] then
+ cat /etc/cjdroute.conf | cjdroute --clean > cjdroute.conf
+else
+ cjdroute --genconf | cjdroute --cleanconf > cjdroute.conf
+fi
python appendPeers.py
-sudo cat cjdroute.conf > /etc/cjdroute.conf
-sudo systemctl enable cjdns
-sudo systemctl start cjdns
+cat cjdroute.conf > /etc/cjdroute.conf
+echo "Restart cjdns to get the new configuration up..."
+systemctl restart cjdns
+
+echo "Suppose it's done!"