various fixes, add emacs wrappers
[distro-setup] / distro-end
index 8034fb918383b7a2df3a6f7fab19a1b36c3fc047..1878ebe31a6bea2b6337654cde3f90d0b7c5cd67 100755 (executable)
@@ -81,6 +81,7 @@ case $HOSTNAME in
             manpages
             manpages-dev
             meld
+            mumble
             nmap
             offlineimap
             p7zip
@@ -90,11 +91,13 @@ case $HOSTNAME in
             pianobar
             pidgin
             python3-mutagen
+            reportbug
             squashfs-tools
             swh-plugins
             tcpdump
             transmission-remote-gtk
             vlc
+            wcd
         )
         ;;
 esac
@@ -233,6 +236,7 @@ fi
 pi "${simple_packages[@]}"
 simple_packages=()
 
+# website setup
 case $HOSTNAME in
     lj|li)
 
@@ -246,11 +250,16 @@ case $HOSTNAME in
         sudo -E /a/bin/mediawiki-setup/mw-setup-script
         #$src/phab-setup
 
+        pi-nostart mumble-server
+        s sed -ri "s/^ *(serverpassword=).*/\1$(< /a/bin/bash_unpublished/mumble_pass)/" mumble-server.ini
+        sgo mumble-server
+
         echo "$0: $(date): ending now)"
         exit 0
         ;;
 esac
 
+
 ########### end section including li/lj ###############
 
 
@@ -355,6 +364,10 @@ EOF
             # I originaly setup rpc-whitelist, but after using
             # routing to a network namespace, it doesn't see the
             # real source address, so it's disabled.
+            #
+            # Changed the cache-size to 128 mb, reduces disk use.
+            # It is a read & write cache.
+            #
             # todo: setup a password.
             s ruby <<'EOF'
 require 'json'
@@ -365,9 +378,10 @@ File.write(p, JSON.pretty_generate(JSON.parse(File.read(p)).merge({
 'incomplete-dir' => '/k/partial-torrents',
 'incomplete-dir-enabled' => true,
 'download-dir' => '/i/k/torrents',
-"speed-limit-up" => 700,
+"speed-limit-up" => 800,
 "speed-limit-up-enabled" => true,
 "peer-port" => 61486,
+"cache-size-mb" => 128,
 "ratio-limit" => 1.4000,
 "ratio-limit-enabled" => false,
 "pidfile": "/var/lib/transmission-daemon/transmission-daemon.pid",
@@ -678,16 +692,29 @@ case $distro in
             # has no unstable dependencies
             spa bitcoin-qt/unstable
         fi
-        ;;
-    s cp /a/opt/bitcoin/contrib/init/bitcoind.service /usr/lib/systemd/system
-    ser daemon-reload
-    sgo bitcoind
-
-    s mkdir -p $dir
-    s touch $f
-    s chmod -R o-rwx $dir
-    s chown -R bitcoin:bitcoin $dir
-    s dd of=$f <<EOF
+        s cp /a/opt/bitcoin/contrib/init/bitcoind.service /etc/systemd/system
+        ser daemon-reload
+
+        dir=/nocow/.bitcoin
+        s mkdir -p $dir
+        s chown -R bitcoin:bitcoin $dir
+        dir=/etc/bitcoin
+        s mkdir -p $dir
+        s chown -R root:bitcoin $dir
+        s chmod 750 $dir
+        f=$dir/bitcon.conf
+
+        # pruning decreases the bitcoin dir to 2 gb, keeps
+        # just the recent blocks. can't do a few things like
+        # import a wallet dump.
+        # pruning works, but people had to do
+        # some manual stuff in joinmarket. I dun need the
+        # disk space, so not bothering yet, maybe in a year or so.
+        # https://github.com/JoinMarket-Org/joinmarket/issues/431
+        #https://bitcoin.org/en/release/v0.12.0#wallet-pruning
+        #prune=550
+
+        s dd of=$f <<EOF
 rpcbind=127.0.0.1
 server=1
 rpcpassword=$(openssl rand -base64 32)
@@ -697,11 +724,57 @@ rpcuser=$(openssl rand -base64 32)
 walletnotify=curl -sI --connect-timeout 1 http://localhost:62602/walletnotify?%s
 alertnotify=curl -sI --connect-timeout 1 http://localhost:62602/alertnotify?%s
 EOF
+        ;;
     # other distros unknown
 esac
 if [[ $HOSTNAME == treetowl ]]; then
-    # dunno about sharing a wallet between multiple instances
+    pi libsodium-dev python3-pip
+    cd /a/opt/joinmarket
+    # using develop branch, as it seems to be mostly bug fixes,
+    # and this is quite new software.
+    # note: python3 does not work.
+    pip install -r requirements.txt
+    # we need bitcoin.conf in the data dir according to
+    # https://github.com/JoinMarket-Org/joinmarket/wiki/Running-JoinMarket-with-Bitcoin-Core-full-node
+    # following the example .service script, I don\'t have it there,
+    # and I generate it, so lets just symlink it.
+    sudo -u bitcoin ln -sf /etc/bitcoin/bitcoin.conf /nocow/.bitcoin
+
+    # one time, manually did python wallet-tool.py generate.
+    # The "wallet" is just a key which deterministically generates addresses.
+    # One time: move the wallet, then link to it.
+    # ln -s /p/joinmarket/wallet.json wallets
+    #
+    # see wallet addresses via:
+    # python wallet-tool.py wallet.json
+    # send to the first 3 mixing depth 0 addresses.
+    # depths are like "identities", to separate out association with
+    # each other. the big hash in that output is the depth/branch id,
+    # ignore it afaik.
+    #
+    # after sending btc to wallet from a 3rd party service, check that
+    # at least 20% of utxo of each transaction was sent to you,
+    # btc listtransactions 10 0 true
+    # btc getrawtransaction TXID 1
+    #
+    # to view status, do
+    # python wallet-tool.py wallet.json history
+    #
+    # to help make other people,
+    # python yield-generator-basic.py wallet.json
+
+    for var in rpcuser rpcpassword; do
+        u="$(s sed -rn "s/^$var=(.*)/\1/p" /etc/bitcoin/bitcoin.conf)"
+        # escape backslashes
+        u="${u//\\/\\\\\\\\}"
+        # escape commas
+        u="${u//,/\\,}"
+        sed -ri "s,^(rpc_${var#rpc}\s*=).*,\1 $u," joinmarket.cfg
+    done
+    sed -ri "s/^\s*(blockchain_source\s*=).*/\1 bitcoin-rpc/" joinmarket.cfg
 
+    # dunno about sharing a wallet between multiple instances
+    # manually did, wallet.dat symlinked in /nocow/.bitcoin
     sgo bitcoind
 fi