Quiet
This commit is contained in:
parent
454e48a53e
commit
953a33ee06
|
@ -511,8 +511,8 @@ function show_tor_bridges {
|
|||
echo ''
|
||||
echo ''
|
||||
fi
|
||||
if ! grep "#BridgeRelay" /etc/tor/torrc; then
|
||||
if grep "BridgeRelay 1" /etc/tor/torrc; then
|
||||
if ! grep -q "#BridgeRelay" /etc/tor/torrc; then
|
||||
if grep -q "BridgeRelay 1" /etc/tor/torrc; then
|
||||
read_config_param 'TOR_BRIDGE_PORT'
|
||||
read_config_param 'TOR_BRIDGE_NICKNAME'
|
||||
if [ ${#TOR_BRIDGE_NICKNAME} -gt 0 ]; then
|
||||
|
|
|
@ -420,14 +420,14 @@ function tor_add_bridge {
|
|||
|
||||
apt-get -yq install obfs4proxy
|
||||
|
||||
if grep "ClientTransportPlugin" /etc/tor/torrc; then
|
||||
if grep -q "ClientTransportPlugin" /etc/tor/torrc; then
|
||||
sed -i 's|#ClientTransportPlugin|ClientTransportPlugin|g' /etc/tor/torrc
|
||||
sed -i 's|# ClientTransportPlugin|ClientTransportPlugin|g' /etc/tor/torrc
|
||||
sed -i 's|ClientTransportPlugin.*|ClientTransportPlugin obfs4 exec /usr/bin/obfs4proxy managed|g' /etc/tor/torrc
|
||||
else
|
||||
echo 'ClientTransportPlugin obfs4 exec /usr/bin/obfs4proxy managed' >> /etc/tor/torrc
|
||||
fi
|
||||
if grep "UseBridges" /etc/tor/torrc; then
|
||||
if grep -q "UseBridges" /etc/tor/torrc; then
|
||||
sed -i 's|#UseBridges|UseBridges|g' /etc/tor/torrc
|
||||
sed -i 's|# UseBridges|UseBridges|g' /etc/tor/torrc
|
||||
sed -i 's|UseBridges.*|UseBridges 1|g' /etc/tor/torrc
|
||||
|
@ -436,7 +436,7 @@ function tor_add_bridge {
|
|||
fi
|
||||
|
||||
bridge_str="Bridge $bridge_type ${bridge_ip_address}:${bridge_port} ${bridge_key}"
|
||||
if ! grep "${bridge_str}" /etc/tor/torrc; then
|
||||
if ! grep -q "${bridge_str}" /etc/tor/torrc; then
|
||||
sed -i "/UseBridges/a ${bridge_str}" >> /etc/tor/torrc
|
||||
fi
|
||||
|
||||
|
@ -450,22 +450,22 @@ function tor_remove_bridge {
|
|||
if [[ "$bridge_ip_address" == *"."* ]]; then
|
||||
bridge_str="Bridge $bridge_type ${bridge_ip_address}"
|
||||
else
|
||||
if grep " ${bridge_ip_address}" /etc/tor/torrc; then
|
||||
if grep -q " ${bridge_ip_address}" /etc/tor/torrc; then
|
||||
bridge_str=" ${bridge_ip_address}"
|
||||
else
|
||||
return
|
||||
fi
|
||||
fi
|
||||
if grep "${bridge_str}" /etc/tor/torrc; then
|
||||
if grep -q "${bridge_str}" /etc/tor/torrc; then
|
||||
sed -i "/${bridge_str}/d" /etc/tor/torrc
|
||||
fi
|
||||
|
||||
# If there are no bridges remaining then remove UseBridges
|
||||
if ! grep "Bridge " /etc/tor/torrc; then
|
||||
if ! grep "#UseBridges" /etc/tor/torrc; then
|
||||
if ! grep -q "Bridge " /etc/tor/torrc; then
|
||||
if ! grep -q "#UseBridges" /etc/tor/torrc; then
|
||||
sed -i 's|UseBridges|#UseBridges|g' /etc/tor/torrc
|
||||
fi
|
||||
if ! grep "#ClientTransportPlugin" /etc/tor/torrc; then
|
||||
if ! grep -q "#ClientTransportPlugin" /etc/tor/torrc; then
|
||||
sed -i 's|ClientTransportPlugin|#ClientTransportPlugin|g' /etc/tor/torrc
|
||||
fi
|
||||
fi
|
||||
|
@ -493,7 +493,7 @@ function tor_create_bridge_relay {
|
|||
sed -i 's|#ServerTransportPlugin.*|ServerTransportPlugin obfs4 exec /usr/bin/obfs4proxy|g' /etc/tor/torrc
|
||||
sed -i 's|ServerTransportPlugin.*|ServerTransportPlugin obfs4 exec /usr/bin/obfs4proxy|g' /etc/tor/torrc
|
||||
|
||||
if ! grep 'ExtORPort ' /etc/tor/torrc; then
|
||||
if ! grep -q 'ExtORPort ' /etc/tor/torrc; then
|
||||
echo "ExtORPort $TOR_BRIDGE_PORT" >> /etc/tor/torrc
|
||||
else
|
||||
sed -i "s|#ExtORPort .*|ExtORPort $TOR_BRIDGE_PORT|g" /etc/tor/torrc
|
||||
|
@ -512,19 +512,19 @@ function tor_create_bridge_relay {
|
|||
}
|
||||
|
||||
function tor_remove_bridge_relay {
|
||||
if ! grep '#BridgeRelay ' /etc/tor/torrc; then
|
||||
if ! grep -q '#BridgeRelay ' /etc/tor/torrc; then
|
||||
sed -i 's|BridgeRelay |#BridgeRelay |g' /etc/tor/torrc
|
||||
fi
|
||||
if ! grep '#ServerTransportPlugin ' /etc/tor/torrc; then
|
||||
if ! grep -q '#ServerTransportPlugin ' /etc/tor/torrc; then
|
||||
sed -i 's|ServerTransportPlugin |#ServerTransportPlugin |g' /etc/tor/torrc
|
||||
fi
|
||||
if ! grep '#ExtORPort ' /etc/tor/torrc; then
|
||||
if ! grep -q '#ExtORPort ' /etc/tor/torrc; then
|
||||
sed -i 's|ExtORPort |#ExtORPort |g' /etc/tor/torrc
|
||||
fi
|
||||
if ! grep '#ContactInfo ' /etc/tor/torrc; then
|
||||
if ! grep -q '#ContactInfo ' /etc/tor/torrc; then
|
||||
sed -i "s|ContactInfo |#ContactInfo |g" /etc/tor/torrc
|
||||
fi
|
||||
if ! grep '#Nickname ' /etc/tor/torrc; then
|
||||
if ! grep -q '#Nickname ' /etc/tor/torrc; then
|
||||
sed -i "s|Nickname |#Nickname |g" /etc/tor/torrc
|
||||
fi
|
||||
read_config_param 'TOR_BRIDGE_PORT'
|
||||
|
|
Loading…
Reference in New Issue