Procházet zdrojové kódy

added api secret and others fixes

Gamaliel Espinoza před 8 roky
rodič
revize
efcec7d4c0
2 změnil soubory, kde provedl 26 přidání a 18 odebrání
  1. 2 0
      configure.py
  2. 24 18
      fourier_install.sh

+ 2 - 0
configure.py

@@ -14,6 +14,7 @@ parser.add_argument('src', nargs=1)
 parser.add_argument('dst', nargs=1)
 parser.add_argument('-programs', dest='programspath')
 parser.add_argument('-receivers', dest='receivers', type=int)
+parser.add_argument('-api-secret', dest='api_secret')
 arg = parser.parse_args()
 
 infile = arg.src
@@ -24,6 +25,7 @@ with open(infile[0], 'rb') as fpin:
 	data['device_id'] = theid
 	data['installDir'] = arg.programspath
 	data['receivers_count'] = arg.receivers
+	data['apiSecret'] = arg.api_secret
 	with open(outfile[0], 'w') as fpout:
 		fpout.write(json.dumps(data, indent=4))
 		print(theid)

+ 24 - 18
fourier_install.sh

@@ -6,7 +6,7 @@ installer_version=1.0.2
 programspath=~/programs
 installerpath=$(pwd)
 configfile='/etc/fourier-config.json'
-gitbase="https://git.miralo.xyz/AudioValid"
+gitbase="gogs@git.miralo.xyz:AudioValid"
 tunnel_user=rtunnel
 datapath='/var/fourier'
 serverhost='monitor.audiovalid.com'
@@ -22,10 +22,21 @@ if [[ "$OSTYPE" == darwin* ]]; then
 	programspath=~/fourier
 fi
 
+clonerepo() {
+	GIT_SSH_COMMAND="ssh -i $installerpath/repokey" \
+					git clone $gitbase/$1 $2
+}
+
 [ ! -d "$programspath" ] && mkdir $programspath
 
-read -p "Whats this box port (last 3 numbers with zero for padding)?" PORT
+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 "API secret: " API_SECRET
+
+findmnt /media/datadrive
+if [ "$?" -neq 0 ]; then
+	echo -e '\e[34mData drive is not mounted\e[0m'
+fi
 
 if [[ "$OSTYPE" == darwin* ]]; then
 	keyfile="$programspath/fourier.key"
@@ -37,7 +48,7 @@ else
 	ssh-keygen -t rsa -b 2048 -C "$HOSTNAME" -f $keyfile
 fi
 
-echo "\e[33mPlease add the following public key to server's authorized keys:\e[0m"
+echo -e "\e[33mPlease add the following public key to server's authorized keys:\e[0m"
 cat $keyfile.pub
 read -p "Press enter to continue"
 
@@ -96,26 +107,20 @@ fi
 
 cd $programspath
 
-#download fourier software
-git config core.sshCommand "ssh -i $installerpath/repokey -F /dev/null"
-git clone $gitbase/fourier-common.git common
-git clone $gitbase/fourier-server.git server
-git clone $gitbase/fourier-fourier.git fourier
-git clone $gitbase/fourier-alt.git fourier-alt
-git clone $gitbase/fourier-monitor.git monitor
-git clone $gitbase/fourier-uploader.git uploader
-git clone $gitbase/fourier-ondemand.git ondemand
-
-#install fourier-server dependencies
+clonerepo fourier-common.git common
+clonerepo fourier-server.git server
+clonerepo fourier-fourier.git fourier
+clonerepo fourier-alt.git fourier-alt
+clonerepo fourier-monitor.git monitor
+clonerepo fourier-uploader.git uploader
+clonerepo fourier-ondemand.git ondemand
+
 cd $programspath/server
 npm install
-#install fourier-monitor dependencies
 cd $programspath/monitor
 npm install
-#install fourier-uploader dependencies
 cd $programspath/uploader
 npm install
-#install fourier-ondemand dependencies
 cd $programspath/ondemand
 npm install
 
@@ -125,7 +130,7 @@ sudo npm install -g pm2
 if [[ "$OSTYPE" != darwin* ]]; then
 	sudo apt-get install -y libusb-1.0-0-dev
 	cd $programspath
-	git clone https://git.miralo.xyz/AudioValid/rtl-sdr
+	clonerepo rtl-sdr.git rtl-sdr
 	cd $programspath/rtl-sdr
 	mkdir build
 	cd build
@@ -154,6 +159,7 @@ nimble build
 		  		$configfile \
 		   		-programs "$programspath" \
 		   		-receivers $RECEIVERS_COUNT
+		   		-api-secret $API_SECRET
 	
 if [[ "$OSTYPE" != darwin* ]]; then
 	sudo mysql -u root -e "create database $mysql_db;"