Verified Commit 197f0d8f authored by Silvio Rhatto's avatar Silvio Rhatto
Browse files

Feat(config): adds MINE_ONLY_IF_NO_SELECTED_KEY_EXISTS parameter

parent c87fbfcf
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -40,6 +40,14 @@ fi
# Create folders
mkdir -p $CANDIDATES $LOGS

# Check if there are already selected keys
if [ "$MINE_ONLY_IF_NO_SELECTED_KEY_EXISTS" != "0" ]; then
  if [ -L "$POOL/selected" ]; then
    echo "$BASENAME: $CONFIG poll already have a selected key, and MINE_ONLY_IF_NO_SELECTED_KEY_EXISTS option is enabled. Skipping."
    exit 1
  fi
fi

# Check the total number of any existing candidates
if [ ! -z "$MAX_GENERATED_KEYS" ] && [ "$MAX_GENERATED_KEYS" != "0" ]; then
  TOTAL_KEYS="`ls -1 $CANDIDATES | wc -l`"
+5 −1
Original line number Diff line number Diff line
@@ -61,9 +61,13 @@ if [ -z "$CANDIDATE" ]; then
  echo ""
  echo "Available candidates in pool $CONFIG: "
  echo ""
  ls -1 $CANDIDATES | sed -e 's/^/    /'
  [ -d "$CANDIDATES" ] && ls -1 $CANDIDATES | sed -e 's/^/    /'
  echo ""
  selected
  echo ""
  echo "Configured filters:"
  echo ""
  cat $POOL/filters.lst | sed -e 's/^/    /'
  exit 1
fi

+4 −0
Original line number Diff line number Diff line
@@ -134,3 +134,7 @@ RSYNC_EXCLUDES="--exclude=candidates --exclude=daemon --exclude=checkpoint.save
#
# Setting to "0" disables the limit.
#MAX_GENERATED_KEYS="0"

# Whether to mine keys only if a selected key does not already exists for a
# given pool.
MINE_ONLY_IF_NO_SELECTED_KEY_EXISTS="1"