task(scripts): Update adb-reverse script

Because:
- Script was outdated
- More ports are needed to get this working with android emulator on localhost.

This Commit:
- Introduces a list of known ports
- Uses this list for adb-reverse.sh
- Uses this list for check-ports.sh
This commit is contained in:
dschom 2024-07-15 17:52:45 -07:00
Родитель 3dcf99ed7d
Коммит 640a3cc739
Не найден ключ, соответствующий данной подписи
3 изменённых файлов: 36 добавлений и 34 удалений

Просмотреть файл

@ -1,8 +1,12 @@
#!/bin/bash -ex
#!/bin/bash -e
adb reverse tcp:3030 tcp:3030 # Content server
adb reverse tcp:9000 tcp:9000 # Auth server
adb reverse tcp:9010 tcp:9010 # OAuth server
adb reverse tcp:1111 tcp:1111 # Profile server
adb reverse tcp:1111 tcp:1112 # Profile server "CDN"
adb reverse tcp:5000 tcp:5000 # Sync server
while IFS= read -r line
do
echo "Running adb reverse for: $line"
port=`echo "$line" | cut -d'#' -f1`
# Edge case for profile server cdn
if [ "$port" == "1111" ]; then
adb reverse tcp:1111 tcp:1112
fi
adb reverse tcp:$port tcp:$port
done < "_scripts/ports.txt"

Просмотреть файл

@ -1,34 +1,14 @@
#!/bin/bash -ex
PORTS=(
3306 # MySQL server
6379 # redis
4100 # Fake SQS/SNS
8085 # google-pubsub-emulator
9090 # google-firestore-emulator
5000 # sync server
8001 # cirrus (experimenter)
8000 # auth-server db mysql
9000 # auth-server key server
3030 # content-server
1111 # profile-server
9292 # Fortress
8080 # 123done
10139 # 321done
5050 # browserid-verifier
3031 # payments server
7100 # support admin panel
8002 # pushbox
)
#!/bin/bash -e
occupied=()
for port in "${PORTS[@]}"; do
if echo PING | nc localhost "$port" >/dev/null; then
while IFS= read -r line
do
port=`echo "$line" | cut -d'#' -f1`
if echo PING | nc localhost $port >/dev/null; then
occupied=("${occupied[@]}" "$port")
fi
done
done < "_scripts/ports.txt"
if [ ${#occupied[@]} -ge 1 ]; then
echo "\033[0;33mHeads up!\033[0m Some required ports are already occupied and may cause problems: \033[0;31m${occupied[@]}\033[0m\n"
echo "Heads up! Some required ports are already occupied and may cause problems: ${occupied[@]}"
fi

18
_scripts/ports.txt Normal file
Просмотреть файл

@ -0,0 +1,18 @@
3306 # MySQL server
6379 # redis
4100 # Fake SQS/SNS
8085 # google-pubsub-emulator
9090 # google-firestore-emulator
5000 # sync server
8001 # cirrus (experimenter)
8000 # auth-server db mysql
9000 # auth-server key server
3030 # content-server
1111 # profile-server
9292 # Fortress
8080 # 123done
10139 # 321done
5050 # browserid-verifier
3031 # payments server
7100 # support admin panel
8002 # pushbox