Skip to content

Commit

Permalink
Merge pull request #3 from mavericm1/master
Browse files Browse the repository at this point in the history
adding bash script for install / start / stop
  • Loading branch information
D3VL-Jack authored May 11, 2021
2 parents 7dc370e + 7377064 commit 9682305
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions install-scripts/pi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/bin/bash

targetdir=/home/pi
pidfile=/tmp/voc.pid

case "$1" in

start)

if [ $(ls $pidfile) ] && [ $(ps $(cat $pidfile) | egrep -v "PID") ]
then
echo "VOC RUNNING PLEASE STOP PROCESS FIRST $0 stop"
else
sudo node $targetdir/index.js -o | ffplay -i - -analyzeduration 1 -probesize 32 -sync ext &
vocpid=$!
echo "$vocpid" > $pidfile
echo "VOC Started!"
fi


;;

stop)

if [[ $(ls $pidfile) ]]
then
kill $(cat $pidfile)
rm $pidfile
echo "VOC Stopped!"
else
sudo node $targetdir/index.js -o | ffplay -i - -analyzeduration 1 -probesize 32 -sync ext &
vocpid=$!
echo "$vocpid" > $pidfile
fi


;;

install)

sudo apt-get install -y ffmpeg curl
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs git
git clone https://github.com/fpv-wtf/voc-poc.git
cp -r voc-poc/* $targetdir/ # voc-poc expects /home/pi/index.js
npm install
sudo apt-get install -y libudev-dev

$0 start

;;

*)
if [ $(ls $pidfile)] && [ $(ps $(cat $pidfile) | egrep -v "PID") ]
then
echo "VOC RUNNING"
else
if [[ $(ls $targetdir/index.js) ]]
then
echo "VOC installed please run $0 start"
else
$0 install
fi
fi
;;
esac

0 comments on commit 9682305

Please sign in to comment.