Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tor_public_pool.sh #154

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 23 additions & 18 deletions src/public_pool/tor_public_pool.sh
Original file line number Diff line number Diff line change
@@ -1,34 +1,39 @@
function enable_tor_public_pool {
if [[ $OS == Mac ]] ; then no_mac ; return 1 ; fi
if [[ $OS == Mac ]]; then no_mac; return 1; fi
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't mind much either way, but I use spaces before every ; all through Parmanode.
If I'm going to use C or C++, I don't use the space.


enable_tor_general || return 1
enable_tor_general || return 1

if sudo grep "HiddenServiceDir $varlibtor/public_pool-service/" \
$torrc | grep -v "^#" >$dn 2>&1 ; then true ; debug "true" ; else debug "else"
echo "HiddenServiceDir $varlibtor/public_pool-service/" | sudo tee -a $torrc >$dn 2>&1
if sudo grep "HiddenServiceDir $varlibtor/public_pool-service/" $torrc | grep -v "^#" >$dn 2>&1; then
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, the original was ugly and uncalled for.

true
debug "true"
else
debug "else"
echo "HiddenServiceDir $varlibtor/public_pool-service/" | sudo tee -a $torrc >$dn 2>&1
fi

if sudo grep "HiddenServicePort 5055 127.0.0.1:5052" \
$torrc | grep -v "^#" >$dn 2>&1 ; then true ; else
echo "HiddenServicePort 5055 127.0.0.1:5052" | sudo tee -a $torrc >$dn 2>&1
if sudo grep "HiddenServicePort 5055 127.0.0.1:5052" $torrc | grep -v "^#" >$dn 2>&1; then
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that I look, it's probably better to have no else and put the code under "then" by adding a "!" before sudo

true
else
echo "HiddenServicePort 5055 127.0.0.1:5052" | sudo tee -a $torrc >$dn 2>&1
fi

restart_tor
restart_tor

get_onion_address_variable "public_pool"
get_onion_address_variable "public_pool"

set_terminal ; echo -e "
set_terminal
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set_terminal ; echo -e "
is my commonly used style on hundreds of pages.

echo -e "
########################################################################################
FYI, changes have been made to torrc file, and Tor has been restarted.
########################################################################################
"
enter_continue ; jump $enter_cont
enter_continue
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commonly used style, and helps the search if I want to refactor, looking for this specific line

jump $enter_cont
}

function disable_tor_public_pool {

sudo gsed -i "/public_pool/d" $torrc
sudo gsed -i "/127.0.0.1:5052/d" $torrc
restart_tor
success "Public Pool Tor" "being disabled"
}
sudo gsed -i "/public_pool/d" $torrc
sudo gsed -i "/127.0.0.1:5052/d" $torrc
restart_tor
success "Public Pool Tor" "being disabled"
}