Quellcode durchsuchen

rolame implemented

Gamaliel Espinoza vor 7 Jahren
Ursprung
Commit
2a5d734e2a
1 geänderte Dateien mit 14 neuen und 2 gelöschten Zeilen
  1. 14 2
      fourier_install.sh

+ 14 - 2
fourier_install.sh

@@ -32,8 +32,20 @@ clonerepo() {
 
 read -p "Whats this box port (last 3 numbers with zero for padding)? " PORT
 read -p "How many receivers has this box? " RECEIVERS_COUNT
-read -p "Box ID (from API): " BOX_ID
-read -p "API secret: " API_SECRET
+read -p "Box ID (or rolame url id): " BOX_ID
+
+curl -f -H "Accept: text/plain" "https://rola.me/$BOX_ID" \
+			1>/tmp/fourier-api \
+			2>/dev/null
+
+if [ "$?" -eq 0 ]; then
+	IFS=':' read -ra APIDATA <<< "$(cat /tmp/fourier-api)"
+	BOX_ID="${APIDATA[0]}"
+	API_SECRET="${APIDATA[1]}"
+	rm /tmp/fourier-api
+else
+	read -p "API secret: " API_SECRET
+fi
 
 sudo apt-get install -y python python-pip