From 16052f34562affcc4f60b8a7daab1695005cbc87 Mon Sep 17 00:00:00 2001
From: d3v11 <d3v11@d3v11.ano>
Date: Fri, 13 Jan 2012 23:15:56 +0000
Subject: added tor usage note

---
 contrib/peer2anonet/README.html | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/contrib/peer2anonet/README.html b/contrib/peer2anonet/README.html
index 52c732b..7aa031d 100644
--- a/contrib/peer2anonet/README.html
+++ b/contrib/peer2anonet/README.html
@@ -48,6 +48,17 @@
 
 <b>RTFM:</b>
 
+    <b>TORIFY:</b>
+
+        --install-* flags should be compatible with Tor:
+
+        export http_proxy='http://127.0.0.1:8118/'
+        ./contrib/peer2anonet/peer2anonet --install-*
+
+        torify ./contrib/peer2anonet/peer2anonet --install-*
+
+        usewithtor ./contrib/peer2anonet/peer2anonet --install-*
+
     <b>CONFIGURE:</b>
 
         I highly recommend that before you use peer2anonet
-- 
cgit v1.2.3


From e50e62ea947ed8c9cc782d2749f90ea49739e3a3 Mon Sep 17 00:00:00 2001
From: d3v11 <d3v11@d3v11.ano>
Date: Fri, 13 Jan 2012 23:19:29 +0000
Subject: added --install-nacl to readme

---
 contrib/peer2anonet/README.html | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/contrib/peer2anonet/README.html b/contrib/peer2anonet/README.html
index 7aa031d..6afc4bd 100644
--- a/contrib/peer2anonet/README.html
+++ b/contrib/peer2anonet/README.html
@@ -42,6 +42,8 @@
 
         ./contrib/peer2anonet/peer2anonet --install-djbdns        installs djbdns
 
+        ./contrib/peer2anonet/peer2anonet --install-nacl          installs nacl
+
         ./contrib/peer2anonet/peer2anonet --configure-dns         configures dnscache and tinydns zones
 
         ./contrib/peer2anonet/peer2anonet --update-dns            updates tinydns-ano zone
-- 
cgit v1.2.3


From 660160694efdc857930957acb05f7b73ce3898d1 Mon Sep 17 00:00:00 2001
From: d3v11 <d3v11@d3v11.ano>
Date: Sun, 15 Jan 2012 02:49:46 +0000
Subject: changed peer2anonet to support "slackware", nick please confirm new
 code will work. if not i am happy to create fix

---
 contrib/peer2anonet/peer2anonet | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/contrib/peer2anonet/peer2anonet b/contrib/peer2anonet/peer2anonet
index f1ab538..1917bc2 100755
--- a/contrib/peer2anonet/peer2anonet
+++ b/contrib/peer2anonet/peer2anonet
@@ -337,8 +337,16 @@ INSTALL_DAEMONTOOLS(){
     cd admin/daemontools-0.76
     sed -i 's/gcc/gcc -include errno.h/g' src/conf-cc
     package/install
-    cp /etc/rc.local /etc/peer2anonet/rc.local.backup
-    sed -i "s/exit 0/csh -cf \'\/command\/svscanboot \&\'/" /etc/rc.local
+    if [ -e /etc/rc.d/rc.local ]; then
+        sed -i "s/exit 0/csh -cf \'\/command\/svscanboot \&\'/" /etc/rc.d/rc.local
+        chmod +x /etc/rc.d/rc.local
+    elif [ -e /etc/rc.local ]; then
+        sed -i "s/exit 0/csh -cf \'\/command\/svscanboot \&\'/" /etc/rc.local
+        chmod +x /etc/rc.local
+    else
+        echo '   fatal error: cannot find rc startup script'
+        exit 1
+    fi
     chmod +x /etc/rc.local
     }
 
-- 
cgit v1.2.3


From 332ae8e92f5575cabd73d931737c9882951b8596 Mon Sep 17 00:00:00 2001
From: d3v11 <d3v11@d3v11.ano>
Date: Sun, 15 Jan 2012 02:52:25 +0000
Subject: bugfixes

---
 contrib/peer2anonet/peer2anonet | 1 -
 1 file changed, 1 deletion(-)

diff --git a/contrib/peer2anonet/peer2anonet b/contrib/peer2anonet/peer2anonet
index 1917bc2..d5dbc2b 100755
--- a/contrib/peer2anonet/peer2anonet
+++ b/contrib/peer2anonet/peer2anonet
@@ -347,7 +347,6 @@ INSTALL_DAEMONTOOLS(){
         echo '   fatal error: cannot find rc startup script'
         exit 1
     fi
-    chmod +x /etc/rc.local
     }
 
 INSTALL_UCSPI_TCP(){
-- 
cgit v1.2.3


From 42f3c4eebf5c3d6f932d0440704d6bfe5b110180 Mon Sep 17 00:00:00 2001
From: d3v11 <d3v11@d3v11.ano>
Date: Sun, 15 Jan 2012 03:06:31 +0000
Subject: bugs suck

---
 contrib/peer2anonet/peer2anonet | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/contrib/peer2anonet/peer2anonet b/contrib/peer2anonet/peer2anonet
index d5dbc2b..715b326 100755
--- a/contrib/peer2anonet/peer2anonet
+++ b/contrib/peer2anonet/peer2anonet
@@ -263,7 +263,8 @@ exec /usr/sbin/quicktun.nacltai" > /etc/peer2anonet/peers/$PEER/run
         fi
         chmod +x /services/"$PEER"/run
         test -L "/service/$PEER" || ln -s "/services/$PEER" "/service/$PEER"
-        svc -t "/service/$PEER"
+        sleep 1
+        svc -d "/service/$PEER" ; svc -u "/service/$PEER"
     done
     test -L /service/bird || ln -s /services/bird /service/bird
     echo configure | birdc
-- 
cgit v1.2.3


From f3610aba6ff6d2ecc7525d0d492de5c86d7d8f9a Mon Sep 17 00:00:00 2001
From: d3v11 <d3v11@d3v11.ano>
Date: Sun, 15 Jan 2012 08:21:58 +0000
Subject: bugfixes

---
 contrib/peer2anonet/peer2anonet | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/contrib/peer2anonet/peer2anonet b/contrib/peer2anonet/peer2anonet
index 715b326..b087aa3 100755
--- a/contrib/peer2anonet/peer2anonet
+++ b/contrib/peer2anonet/peer2anonet
@@ -328,6 +328,16 @@ INSTALL_DAEMONTOOLS(){
     [[ $(echo X`which make`) == X ]] && exit 1
     [[ $(echo X`which csh`) == X ]] && echo '   fatal error: cannot find csh'
     [[ $(echo X`which csh`) == X ]] && exit 1
+
+    if [ -w /etc/inittab ]; then :
+    elif [ -w /etc/rc.local ] && ! [ -w /etc/inittab ]; then
+        sed -i "s/exit 0/csh -cf \'\/command\/svscanboot \&\'/" /etc/rc.local
+        chmod +x /etc/rc.local
+    else
+        echo '   fatal error: cannot create reliable startup'
+        exit 1
+    fi
+
     mkdir -p /package
     chmod 1755 /package
     cd /package
@@ -338,16 +348,6 @@ INSTALL_DAEMONTOOLS(){
     cd admin/daemontools-0.76
     sed -i 's/gcc/gcc -include errno.h/g' src/conf-cc
     package/install
-    if [ -e /etc/rc.d/rc.local ]; then
-        sed -i "s/exit 0/csh -cf \'\/command\/svscanboot \&\'/" /etc/rc.d/rc.local
-        chmod +x /etc/rc.d/rc.local
-    elif [ -e /etc/rc.local ]; then
-        sed -i "s/exit 0/csh -cf \'\/command\/svscanboot \&\'/" /etc/rc.local
-        chmod +x /etc/rc.local
-    else
-        echo '   fatal error: cannot find rc startup script'
-        exit 1
-    fi
     }
 
 INSTALL_UCSPI_TCP(){
-- 
cgit v1.2.3


From 2d12af923db0e2ed936c23c4e3c977fd5ee73ee4 Mon Sep 17 00:00:00 2001
From: d3v11 <d3v11@d3v11.ano>
Date: Sun, 15 Jan 2012 22:09:32 +0000
Subject: slackware support for     ./contrib/peer2anonet/peer2anonet
 --configure-dns

---
 contrib/peer2anonet/peer2anonet | 44 +++++++++++++++++++++++++++++------------
 1 file changed, 31 insertions(+), 13 deletions(-)

diff --git a/contrib/peer2anonet/peer2anonet b/contrib/peer2anonet/peer2anonet
index b087aa3..d699287 100755
--- a/contrib/peer2anonet/peer2anonet
+++ b/contrib/peer2anonet/peer2anonet
@@ -435,24 +435,42 @@ CONFIGURE_DNS(){
     GIT_IP=`cat conf/gitd_ip` || exit 1
     GIT_DOMAIN="git.$NICK.ano"
 
+    if [ -w /etc/rc.local ]; then
+        if [[ $(cat /etc/rc.local) != *"ip addr add $TINYDNS_ROOT_IP/32 dev lo &"* ]]; then
+            echo "ip addr add $TINYDNS_ROOT_IP/32 dev lo &" >> /etc/rc.local
+        fi
+        if [[ $(cat /etc/rc.local) != *"ip addr add $TINYDNS_IP/32 dev lo &"* ]]; then
+            echo "ip addr add $TINYDNS_IP/32 dev lo &" >> /etc/rc.local
+        fi
+        if [[ $(cat /etc/rc.local) != *"ip addr add $TINYDNS_ANO_IP/32 dev lo &"* ]]; then
+            echo "ip addr add $TINYDNS_ANO_IP/32 dev lo &" >> /etc/rc.local
+        fi
+        if [[ $(cat /etc/rc.local) != *"ip addr add $GIT_IP/32 dev lo &"* ]]; then
+        echo "ip addr add $GIT_IP/32 dev lo &" >> /etc/rc.local
+        fi
+    elif [ -w /etc/rc.d/rc.local ]; then
+        if [[ $(cat /etc/rc.d/rc.local) != *"ip addr add $TINYDNS_ROOT_IP/32 dev lo &"* ]]; then
+            echo "ip addr add $TINYDNS_ROOT_IP/32 dev lo &" >> /etc/rc.d/rc.local
+        fi
+        if [[ $(cat /etc/rc.d/rc.local) != *"ip addr add $TINYDNS_IP/32 dev lo &"* ]]; then
+            echo "ip addr add $TINYDNS_IP/32 dev lo &" >> /etc/rc.d/rc.local
+        fi
+        if [[ $(cat /etc/rc.d/rc.local) != *"ip addr add $TINYDNS_ANO_IP/32 dev lo &"* ]]; then
+            echo "ip addr add $TINYDNS_ANO_IP/32 dev lo &" >> /etc/rc.d/rc.local
+        fi
+        if [[ $(cat /etc/rc.d/rc.local) != *"ip addr add $GIT_IP/32 dev lo &"* ]]; then
+        echo "ip addr add $GIT_IP/32 dev lo &" >> /etc/rc.d/rc.local
+        fi
+    else
+        echo "   fatal error: cannot reliably assign ip's to startup"
+        exit 1
+    fi
+
     ip addr add $TINYDNS_ROOT_IP/32 dev lo > /dev/null 2>&1
     ip addr add $TINYDNS_IP/32 dev lo > /dev/null 2>&1
     ip addr add $TINYDNS_ANO_IP/32 dev lo > /dev/null 2>&1
     ip addr add $GIT_IP/32 dev lo > /dev/null 2>&1
 
-    if [[ $(cat /etc/rc.local) != *"ip addr add $TINYDNS_ROOT_IP/32 dev lo &"* ]]; then
-        echo "ip addr add $TINYDNS_ROOT_IP/32 dev lo &" >> /etc/rc.local
-    fi
-    if [[ $(cat /etc/rc.local) != *"ip addr add $TINYDNS_IP/32 dev lo &"* ]]; then
-        echo "ip addr add $TINYDNS_IP/32 dev lo &" >> /etc/rc.local
-    fi
-    if [[ $(cat /etc/rc.local) != *"ip addr add $TINYDNS_ANO_IP/32 dev lo &"* ]]; then
-        echo "ip addr add $TINYDNS_ANO_IP/32 dev lo &" >> /etc/rc.local
-    fi
-    if [[ $(cat /etc/rc.local) != *"ip addr add $GIT_IP/32 dev lo &"* ]]; then
-        echo "ip addr add $GIT_IP/32 dev lo &" >> /etc/rc.local
-    fi
-
     useradd Gdnscache
     useradd Gdnslog
     useradd Gtinydns
-- 
cgit v1.2.3


From 12cc61913cab58125febd21337b879a92b7f61c9 Mon Sep 17 00:00:00 2001
From: d3v11 <d3v11@d3v11.ano>
Date: Sun, 15 Jan 2012 22:40:56 +0000
Subject: peer2anonet:     fix potential for unexecutable rc.local bug,    
 added visual support to README for guys with small     terminals.

---
 contrib/peer2anonet/README.html | 173 +++++++++++++++++-----------------------
 contrib/peer2anonet/peer2anonet |   3 +
 2 files changed, 78 insertions(+), 98 deletions(-)

diff --git a/contrib/peer2anonet/README.html b/contrib/peer2anonet/README.html
index 6afc4bd..4fb5721 100644
--- a/contrib/peer2anonet/README.html
+++ b/contrib/peer2anonet/README.html
@@ -2,148 +2,125 @@
 <pre>
 <b>DESCRIPTION:</b>
 
-    peer2anonet is an autoconfiguration utility for setting
-    up core services on AnoNet2. Enjoy :-).
+    peer2anonet is an autoconfiguration utility for
+    setting up core services on AnoNet2. Enjoy :-).
 
 <b>DEPENDS ON:</b>
 
-    quicktun, bird, bash for now. it also installs some cool shit
-    that you'll use later.
+    quicktun, bird, bash for now. it also installs
+    some cool shit that you'll use later.
 
 <b>AUTHOR:</b>
 
     d3v11 from <a href="http://www.d3v11.ano/">www.d3v11.ano</a>, somtimes, maybe, dunno.
 
-    <b>REPORT BULLSHIT TO:</b>
-
-        <b>IRC:</b>
+<b>REPORT BULLSHIT TO:</b>
         
-            /relayhell/d3v11
+    /relayhell/d3v11
 
-        <b>EMAIL:</b>
-        
-            d3v11@d3v11.ano
+    d3v11@d3v11.ano
 
 <b>USAGE:</b>
 
-    <b>From $RESDB_ROOT do:</b>
-
-        ./contrib/peer2anonet/peer2anonet --configure             generate a new local configuration and exit
-
-        ./contrib/peer2anonet/peer2anonet --update                regenerate peer configurations
-
-        ./contrib/peer2anonet/peer2anonet --configure-peer        generate a new peer configuration and update
-
-        ./contrib/peer2anonet/peer2anonet --rm-peer               remove a peer configuration and update
-
-        ./contrib/peer2anonet/peer2anonet --install-daemontools   installs daemontools
+    ./contrib/peer2anonet/peer2anonet --help
+    ./contrib/peer2anonet/peer2anonet --rtfm
 
-        ./contrib/peer2anonet/peer2anonet --install-ucspi-tcp     installs ucspi-tcp
+<b>TORIFY:</b>
 
-        ./contrib/peer2anonet/peer2anonet --install-djbdns        installs djbdns
+    --install-* flags should be compatible with Tor:
 
-        ./contrib/peer2anonet/peer2anonet --install-nacl          installs nacl
+    export http_proxy='http://127.0.0.1:8118/'
+    ./contrib/peer2anonet/peer2anonet --install-*
 
-        ./contrib/peer2anonet/peer2anonet --configure-dns         configures dnscache and tinydns zones
+    torify ./contrib/peer2anonet/peer2anonet --install-*
 
-        ./contrib/peer2anonet/peer2anonet --update-dns            updates tinydns-ano zone
+    usewithtor ./contrib/peer2anonet/peer2anonet --install-*
 
-<b>RTFM:</b>
+<b>CONFIGURE:</b>
 
-    <b>TORIFY:</b>
+    I highly recommend that before you use peer2anonet
+    you ./configure resdb with tinydns support.
 
-        --install-* flags should be compatible with Tor:
+    ./contrib/peer2anonet/peer2anonet --configure
 
-        export http_proxy='http://127.0.0.1:8118/'
-        ./contrib/peer2anonet/peer2anonet --install-*
+    <b>EXAMPLES:</b>
 
-        torify ./contrib/peer2anonet/peer2anonet --install-*
+        Enter your AnoNet subnet: 1.1.5.0
+        Enter your AnoNet router: 1.1.5.1
+        Enter your peering ip: 1.1.5.2
+        Enter your AnoNet asn: 1150
 
-        usewithtor ./contrib/peer2anonet/peer2anonet --install-*
+<b>CONFIGURE PEER:</b>
 
-    <b>CONFIGURE:</b>
+    ./contrib/peer2anonet/peer2anonet --configure-peer
 
-        I highly recommend that before you use peer2anonet
-        you ./configure resdb with tinydns support.
+    <b>KEY PAIRS:</b>
 
-        ./contrib/peer2anonet/peer2anonet --configure
+        before running peer2anonet to configure peers
+        you can use quicktun to generate keypairs:
 
-        <b>EXAMPLES:</b>
+        quicktun.keypair < /dev/random
 
-            Enter your AnoNet subnet: 1.1.5.0
-            Enter your AnoNet router: 1.1.5.1
-            Enter your peering ip: 1.1.5.2
-            Enter your AnoNet asn: 1150
+    <b>EXAMPLES:</b>
 
-    <b>CONFIGURE PEER:</b>
+        Enter your peer's name: d3v11
+        Enter your peer's remote ip: 11.11.55.1
+        Enter your peer's peering ip: 1.1.5.2
+        Enter your peer's remote port: 21150
+        Enter your local port: 61150
+        Enter your peer's asn: 1150
+        Enter your peer's public key: * see KEY PAIRS above *
+        Enter your private key: * see KEY PAIRS above *
 
-        ./contrib/peer2anonet/peer2anonet --configure-peer
+    <b>/SERVICE/$PEER/RUN CHANGES:</b>
 
-            <b>KEY PAIRS:</b>
+        peer2anonet exports the /service/$PEER/run file to
+        /etc/peer2anonet/peers/$PEER/run. If you need to
+        create customizations for peerings then make 
+        adjustments to that file.
 
-                before running peer2anonet to configure peers you can use
-                quicktun to generate keypairs:
+    <b>CONFIGURATION FILES:</b>
 
-                    quicktun.keypair < /dev/random
+        If /etc/peer2anonet/bird.conf exists, then
+        peer2anonet will not create a new bird. Instead
+        it will use this bird.conf and append new protocols
+        to it. 
 
-            <b>EXAMPLES:</b>
-
-                Enter your peer's name: d3v11
-                Enter your peer's remote ip: 11.11.55.1
-                Enter your peer's peering ip: 1.1.5.2
-                Enter your peer's remote port: 21150
-                Enter your local port: 61150
-                Enter your peer's asn: 1150
-                Enter your peer's public key: * see KEY PAIRS above *
-                Enter your private key: * see KEY PAIRS above *
-
-            <b>RUN CHANGES:</b>
-
-                peer2anonet exports the /service/$PEER/run file to
-                /etc/peer2anonet/peers/$PEER/run. If you need to
-                create customizations for peerings then make adjustments
-                to that file.
-
-            <b>CONFIGURATION FILES:</b>
-
-                If /etc/peer2anonet/bird.conf exists, then peer2anonet
-                will not create a new bird. Instead it will use this
-                bird.conf and append new protocols to it. 
-
-                /etc/peer2anonet/peers/$PEER/* contains:
+        /etc/peer2anonet/peers/$PEER/* contains:
                 
-                    asn  local_port  peering_ip  pubkey  remote_ip  remote_port  run  seckey
-
-                In the event you want to reconfigure a peer's tunnel you can alter the run
-                file and do `--update', rm run and modify the above files then use `--update',
-                or reconfigure the peering tunnel altogether with --configure-peer and choose
-                that peer's name. If you think this is absurd then you're probably right! I 
-                plan on doing something with these files later.
+        asn  local_port  peering_ip  pubkey
+        remote_ip  remote_port  run  seckey
 
-    <b>CONFIGURE DNS:</b>
+        In the event you want to reconfigure a peer's tunnel
+        you can alter the run file and do `--update', rm run
+        and modify the above files then use `--update',  or
+        reconfigure the peering tunnel altogether with
+        --configure-peer and choose that peer's name. If you
+        think this is absurd then you're probably right! I 
+        plan on doing something with these files later.
 
-        If you did not ./configure resdb with tinydns support
-        then you need to do that before using this function.
+<b>CONFIGURE DNS:</b>
 
-        also before using you will need to have installed
-        daemontools, djbdns, and ucspi-tcp. peer2anonet
-        can do this for you with --install-* options.
+    If you did not ./configure resdb with tinydns support
+    then you need to do that before using this function.
 
-        ./contrib/peer2anonet/peer2anonet --configure-dns
+    also before using you will need to have installed
+    daemontools, djbdns, and ucspi-tcp. peer2anonet
+    can do this for you with --install-* options.
 
-        <b>UPDATE DNS:</b>
+    ./contrib/peer2anonet/peer2anonet --configure-dns
 
-            After a successful `--configure-dns', you can now
-            enjoy to use `--update-dns' to bring your AnoNet
-            domains up to speed.
+<b>UPDATE DNS:</b>
 
-    <b>COMPLAIN:</b>
+    After a successful `--configure-dns', you can now
+    enjoy to use `--update-dns' to bring your AnoNet
+    domains up to speed.
 
-        If this README doesn't tell you what you need to know
-        you can head over to www.d3v11.ano/peering. If that
-        doesn't get you what you want then either complain to
-        me or shoot both of us in the face.
+<b>COMPLAIN:</b>
 
+    If this README doesn't tell you what you need to know
+    you can head over to www.d3v11.ano/peering. If that
+    doesn't get you what you want then either complain to
+    me or shoot both of us in the face.
 
-      
 </pre></font></body></html>
diff --git a/contrib/peer2anonet/peer2anonet b/contrib/peer2anonet/peer2anonet
index d699287..f8b9de2 100755
--- a/contrib/peer2anonet/peer2anonet
+++ b/contrib/peer2anonet/peer2anonet
@@ -12,6 +12,9 @@ fi
 [ -e contrib/peer2anonet/peer2anonet ] || echo "peer2anonet: not in \$RESDB_ROOT"
 [ -e contrib/peer2anonet/peer2anonet ] || exit 1
 
+[ -w /etc/rc.local ] && chmod +x /etc/rc.local
+[ -w /etc/rc.d/rc.local ] && chmod +x /etc/rc.d/rc.local
+
 USAGE(){
     echo -e '\npeer2anonet:'
     echo -e '\n    ./contrib/peer2anonet/peer2anonet --configure             generate a new local configuration and exit'
-- 
cgit v1.2.3


From 0f221e9b06d668695c6ec75e6f722398eab68d8f Mon Sep 17 00:00:00 2001
From: d3v11 <d3v11@d3v11.ano>
Date: Sun, 15 Jan 2012 23:05:12 +0000
Subject: added automatic addition of nameservers to resdb

---
 contrib/peer2anonet/peer2anonet | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/contrib/peer2anonet/peer2anonet b/contrib/peer2anonet/peer2anonet
index f8b9de2..c7a3478 100755
--- a/contrib/peer2anonet/peer2anonet
+++ b/contrib/peer2anonet/peer2anonet
@@ -438,6 +438,8 @@ CONFIGURE_DNS(){
     GIT_IP=`cat conf/gitd_ip` || exit 1
     GIT_DOMAIN="git.$NICK.ano"
 
+    ./scripts/add_dom $NICK.ano $NICK $TINYDNS_DOMAIN/$TINYDNS_IP > /dev/null 2>&1
+
     if [ -w /etc/rc.local ]; then
         if [[ $(cat /etc/rc.local) != *"ip addr add $TINYDNS_ROOT_IP/32 dev lo &"* ]]; then
             echo "ip addr add $TINYDNS_ROOT_IP/32 dev lo &" >> /etc/rc.local
-- 
cgit v1.2.3