From 12f64331372e6fc24eee0ea7be136544b3cadb87 Mon Sep 17 00:00:00 2001 From: Zen Date: Thu, 24 Feb 2022 21:01:45 -0600 Subject: [PATCH] move tor config to copper --- ingredients/copper | 58 ++++++++++++++++++++++++++++++++++++++++++++++ ingredients/silver | 7 ++++++ recipes/ao.sh | 22 ++---------------- 3 files changed, 67 insertions(+), 20 deletions(-) create mode 100644 ingredients/silver diff --git a/ingredients/copper b/ingredients/copper index 11282a8..8a13d3c 100644 --- a/ingredients/copper +++ b/ingredients/copper @@ -1,3 +1,61 @@ +#!/bin/sh +# Bare Metal Alchemist, 2022 + +############################################# +# Copper - ♀ # +############################################# + +# Copper wires form the backbone of electrical systems worldwide +# and much of the internet as a whole. + +# This ingredient is focused around scripts that make it easier to +# interact with and create new networks on your system. + +locate_torrc() { + if [ -n $TORRCPATH ]; then + if [ -e /usr/local/etc/tor/torrc ]; then + TORRCPATH='/usr/local/etc/tor/torrc' + elif [ -e /etc/tor/torrc ]; then + TORRCPATH='/etc/tor/torrc' + elif [ -e $HOME/.tor/torrc ]; then + TORRCPATH="${HOME}/.tor/torrc" + else + echo -e "${RED}Uh oh...${RESET} I couldn't figure out where your torrc file is. That might cause some issues" + exit 1 + fi + fi + + echo -e "Your torrc is located at ${BLUE}${TORRCPATH}${RESET}" + echo "TORRCPATH=${TORRCPATH}" > .env +} + +configure_tor() { + locate_torrc + + echo -e "Your existing torrc file has the following settings: " + echo "" + cat $TORRCPATH | grep '^[^#]' + echo "" + echo -en "Would you like to reset them?: ${BLUE}(y/n)${RESET} " + read torrc_reset + case $torrc_reset in + "Y" | "y") + cp resources/torrc-template . + sudo sed -i "s#USER#${USER}#g" torrc-template + sudo sed -i "s#HOME#${HOME}#g" torrc-template + sudo mv torrc-template $TORRCPATH + echo -e "${GREEN}Torrc file reset!${RESET}" + ;; + '*') + echo "Okay, we'll leave it as is." + ;; + esac + echo "" + + echo -e "Tor configuration ${GREEN}complete!${RESET}" +} + + # internet connections? copper wires etc. # using yggdrasil could maybe fit in here # nginx setup diff --git a/ingredients/silver b/ingredients/silver new file mode 100644 index 0000000..f8c7403 --- /dev/null +++ b/ingredients/silver @@ -0,0 +1,7 @@ +silver corresponds to the moon, and therefore darkness and shadow. + +should system daemon creation go in here? +equitable crypto + +Eventually, this will implement full moonbeam. for now, moonbeam +as a python script. diff --git a/recipes/ao.sh b/recipes/ao.sh index 0260c09..db20f15 100755 --- a/recipes/ao.sh +++ b/recipes/ao.sh @@ -4,6 +4,7 @@ # Bare Metal Alchemist, 2022 source ingredients/lead +source ingredients/copper source ingredients/gold clear @@ -133,26 +134,7 @@ echo '' if [ $AO = "3" ] || [ $AO = 'react' ]; then echo -e "${BOLD}Installing and configuring Tor${RESET}\n" install_if_needed tor - - if [ -e /usr/local/etc/tor/torrc ]; then - TORRCPATH='/usr/local/etc/tor/torrc' - elif [ -e /etc/tor/torrc ]; then - TORRCPATH='/etc/tor/torrc' - fi - - # Configure and write torrc file - cp resources/torrc-template . - sudo sed -i "s#USER#${USER}#g" torrc-template - sudo sed -i "s#HOME#${HOME}#g" torrc-template - - if [ -z "$TORRCPATH" ]; then - echo -e "${RED}Uh oh...${RESET} I couldn't figure out where your torrc file is. That might cause some issues" - sleep 3 - echo -e "\nAnyways...\n" - sleep 2 - else - sudo mv torrc-template $TORRCPATH - fi + configure_tor fi # ------------------- Step 3 - AO Installation -------------------