Browse Source

Avoid duplicates

Bob Mottram 10 years ago
parent
commit
939d8f27a1
1 changed files with 5 additions and 2 deletions
  1. 5
    2
      src/zeronetavahi

+ 5
- 2
src/zeronetavahi View File

134
     if [ ${state} -eq "1" ]; then
134
     if [ ${state} -eq "1" ]; then
135
         if [[ $line == *"address ="* ]]; then
135
         if [[ $line == *"address ="* ]]; then
136
             address=$(echo $line | awk -F '[' '{print $2}' | awk -F ']' '{print $1}')
136
             address=$(echo $line | awk -F '[' '{print $2}' | awk -F ']' '{print $1}')
137
-            echo "    http://$peer:$TRACKER_PORT/announce" >> $ZERONET_CONFIG.new
137
+            tracker_url="http://$peer:$TRACKER_PORT/announce"
138
+            if ! grep -q "$tracker_url" $ZERONET_CONFIG.new; then
139
+                echo "    $tracker_url" >> $ZERONET_CONFIG.new
140
+                tracker_ctr=$((tracker_ctr + 1))
141
+            fi
138
             state=0
142
             state=0
139
-            tracker_ctr=$((tracker_ctr + 1))
140
         fi
143
         fi
141
     fi
144
     fi
142
     if [[ $line == *"hostname ="* ]]; then
145
     if [[ $line == *"hostname ="* ]]; then