Loading bin/select-candidate 0 → 100755 +85 −0 Original line number Diff line number Diff line #!/usr/bin/env bash # # Test Onion Service keys. # # Copyright (C) 2022 Silvio Rhatto <rhatto@torproject.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, # or any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # # Parameters BASENAME="`basename $0`" DIRNAME="`dirname $0`" source $DIRNAME/params # Additional parameters CANDIDATE="$2" function usage() { echo "usage: onionmine $BASENAME <pool> <candidate>" echo "" echo "Select a keypair among candidates from a mining pool" echo "" echo " pool: the mining pool to operate on" echo " candidate: which candidate in the pool to test" } function selected() { if [ -e "$POOL/selected" ]; then echo "Current selected candidate for the $CONFIG pool:" echo "" basename `readlink $POOL/selected` | sed -e 's/^/ /' echo "" fi } # Check for a config if [ -z "$CONFIG" ]; then usage echo "" echo "Available pools:" echo "" ls -1 $POOLS | sed -e 's/^/ /' echo "" exit 1 fi # Check for a candidate if [ -z "$CANDIDATE" ]; then usage echo "" echo "Available candidates in pool $CONFIG: " echo "" ls -1 $CANDIDATES | sed -e 's/^/ /' echo "" selected exit 1 fi # Check if pool exists if [ ! -e "$POOL" ]; then echo "$BASENAME: pool not found: $POOL" exit 1 fi # Check if candidate exists if [ ! -e "$CANDIDATES/$CANDIDATE" ]; then echo "$BASENAME: candidate not found: $CANDIDATES/$CANDIDATE" exit 1 fi # Select cd $POOL rm -f selected && ln -s $CANDIDATES/$CANDIDATE selected || exit 1 selected bin/test-keys +12 −0 Original line number Diff line number Diff line Loading @@ -82,6 +82,18 @@ if [ -z "$CANDIDATE" ]; then exit 1 fi # Check if pool exists if [ ! -e "$POOL" ]; then echo "$BASENAME: pool not found: $POOL" exit 1 fi # Check if candidate exists if [ ! -e "$CANDIDATES/$CANDIDATE" ]; then echo "$BASENAME: candidate not found: $CANDIDATES/$CANDIDATE" exit 1 fi # Check for Tor if ! which tor &> /dev/null; then echo "$BASENAME: cannot find the 'tor' executable; is it installed?" Loading Loading
bin/select-candidate 0 → 100755 +85 −0 Original line number Diff line number Diff line #!/usr/bin/env bash # # Test Onion Service keys. # # Copyright (C) 2022 Silvio Rhatto <rhatto@torproject.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, # or any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # # Parameters BASENAME="`basename $0`" DIRNAME="`dirname $0`" source $DIRNAME/params # Additional parameters CANDIDATE="$2" function usage() { echo "usage: onionmine $BASENAME <pool> <candidate>" echo "" echo "Select a keypair among candidates from a mining pool" echo "" echo " pool: the mining pool to operate on" echo " candidate: which candidate in the pool to test" } function selected() { if [ -e "$POOL/selected" ]; then echo "Current selected candidate for the $CONFIG pool:" echo "" basename `readlink $POOL/selected` | sed -e 's/^/ /' echo "" fi } # Check for a config if [ -z "$CONFIG" ]; then usage echo "" echo "Available pools:" echo "" ls -1 $POOLS | sed -e 's/^/ /' echo "" exit 1 fi # Check for a candidate if [ -z "$CANDIDATE" ]; then usage echo "" echo "Available candidates in pool $CONFIG: " echo "" ls -1 $CANDIDATES | sed -e 's/^/ /' echo "" selected exit 1 fi # Check if pool exists if [ ! -e "$POOL" ]; then echo "$BASENAME: pool not found: $POOL" exit 1 fi # Check if candidate exists if [ ! -e "$CANDIDATES/$CANDIDATE" ]; then echo "$BASENAME: candidate not found: $CANDIDATES/$CANDIDATE" exit 1 fi # Select cd $POOL rm -f selected && ln -s $CANDIDATES/$CANDIDATE selected || exit 1 selected
bin/test-keys +12 −0 Original line number Diff line number Diff line Loading @@ -82,6 +82,18 @@ if [ -z "$CANDIDATE" ]; then exit 1 fi # Check if pool exists if [ ! -e "$POOL" ]; then echo "$BASENAME: pool not found: $POOL" exit 1 fi # Check if candidate exists if [ ! -e "$CANDIDATES/$CANDIDATE" ]; then echo "$BASENAME: candidate not found: $CANDIDATES/$CANDIDATE" exit 1 fi # Check for Tor if ! which tor &> /dev/null; then echo "$BASENAME: cannot find the 'tor' executable; is it installed?" Loading