Fixing i2p deploy script

main
Bob Mottram 2020-06-18 21:03:29 +01:00
parent 70b0277468
commit 46ff17f7c5
1 changed files with 13 additions and 12 deletions

View File

@ -89,17 +89,18 @@ fi
chown -R epicyon:epicyon /opt/epicyon chown -R epicyon:epicyon /opt/epicyon
echo 'Creating a command script to obtain i2p domain names from dat files' echo 'Creating a command script to obtain i2p domain names from dat files'
{ echo '#!/usr/bin/env python3'; { echo '#!/bin/bash';
echo 'import base64, hashlib, sys'; echo "tunnelname=\"\$1\"";
echo "with open(sys.argv[1], 'rb') as f:"; echo 'domainfile=/tmp/i2pdomain.txt';
echo ' isRead=False'; echo "if [ -f \${domainfile} ]; then";
echo ' try:'; echo " rm \${domainfile}";
echo " print(base64.b32encode(hashlib.sha256(base64.b64decode(f.read(), '-~')).digest()).decode().strip('=').lower()+\".b32.i2p\")"; echo 'fi';
echo ' isRead=True'; echo "wget http://127.0.0.1:7070/?page=i2p_tunnels -O \${domainfile} 2> /dev/null";
echo ' except:'; echo "if [ ! -f \${domainfile} ]; then";
echo ' pass'; echo ' exit 9';
echo ' if not isRead:'; echo 'fi';
echo " print(base64.b32encode(hashlib.sha256(base64.b64decode(f.read(516), '-~')).digest()).decode().strip('=').lower()+\".b32.i2p\")"; } > /usr/bin/i2pdomain echo "awk -F \">\${tunnelname}<\" '{print \$2}' < \${domainfile} | awk -F ';' '{print \$2}' | awk -F ':' '{print \$1}' | tr -d '[:space:]'";
echo "rm \${domainfile}"; } > /usr/bin/i2pdomain
chmod +x /usr/bin/i2pdomain chmod +x /usr/bin/i2pdomain
echo 'Creating Epicyon i2p tunnel file' echo 'Creating Epicyon i2p tunnel file'
@ -182,7 +183,7 @@ fi
echo '/var/lib/i2pd/epicyon.dat file was created' echo '/var/lib/i2pd/epicyon.dat file was created'
I2P_DOMAIN=$(i2pdomain /var/lib/i2pd/epicyon.dat) I2P_DOMAIN=$(i2pdomain epicyon)
if [[ "$I2P_DOMAIN" != *'.i2p' ]]; then if [[ "$I2P_DOMAIN" != *'.i2p' ]]; then
echo 'Epicyon i2p domain not created' echo 'Epicyon i2p domain not created'
echo "$I2P_DOMAIN" echo "$I2P_DOMAIN"