mirror of https://bitbucket.org/ausocean/av.git
cmd/audio-player/looper: added make file
This commit is contained in:
parent
17c7ef857e
commit
0399051e0e
|
@ -0,0 +1,41 @@
|
|||
# Install rc.local file
|
||||
USER := $(shell whoami)
|
||||
PATH := /usr/local/go/bin:$(PATH)
|
||||
|
||||
.SILENT:copy_files
|
||||
.SILENT:hard_copy_files
|
||||
.SILENT:clean
|
||||
|
||||
install: as_root copy_files build
|
||||
@echo "Install complete"
|
||||
|
||||
install_hard: as_root hard_copy_files build
|
||||
@echo "Install complete"
|
||||
|
||||
as_root:
|
||||
ifneq ($(USER),root)
|
||||
$(error Must run as superuser!)
|
||||
endif
|
||||
|
||||
copy_files:
|
||||
if [ -f /etc/rc.local ] ; then \
|
||||
echo "/etc/rc.local left unmodified" ; \
|
||||
else \
|
||||
cp rc.local /etc; \
|
||||
fi
|
||||
|
||||
hard_copy_files:
|
||||
if [ -f /etc/rc.local ] ; then \
|
||||
echo "Backed up rc.local to /etc/rc.local.bak" ; \
|
||||
cp /etc/rc.local /etc/rc.local.bak ; \
|
||||
fi
|
||||
cp -f rc.local /etc
|
||||
|
||||
build:
|
||||
if grep -q 'Raspberry Pi 3' '/proc/device-tree/model'; then \
|
||||
echo "Compiling for Raspberry pi 3";\
|
||||
go build -tags pi3;\
|
||||
else \
|
||||
echo "Compiling for Raspberry pi 0";\
|
||||
go build -tags pi0;\
|
||||
fi
|
|
@ -10,24 +10,12 @@
|
|||
$sudo nano main.go
|
||||
- chage file variable at top of function to be wav file that you have put onto the pi (hint: spc command to put a new file on the pi)
|
||||
- Build using $ go build -tags pi0 or $ go build -tags pi3
|
||||
- edit rc.local to run looper at boot
|
||||
$sudo nano /etc/rc.local
|
||||
- paste this in after comments but before 'exit 0': -----------------------------------------------------------
|
||||
|
||||
exec 2> /tmp/rc.local.log # send stderr from rc.local to a log file
|
||||
exec 1>&2 # send stdout to the same log file
|
||||
printf "rc.local started" # show start of execution
|
||||
set -x # tell sh to display commands before execution
|
||||
|
||||
PLAYERPATH=/home/pi/go/src/bitbucket.org/ausocean/av/cmd/audio-player/looper
|
||||
cd $PLAYERPATH
|
||||
|
||||
./looper &
|
||||
-----------------------------------------------------------------------------------------------------------------
|
||||
- run makefile
|
||||
$sudo make install_hard
|
||||
$systemctl enable rc-local
|
||||
$sudo systemctl start rc-local.service
|
||||
- after starting the service the looping should start straight away
|
||||
|
||||
cmd/audio-player/looper:
|
||||
# Useful commands:
|
||||
$cat /tmp/rc.local.log
|
||||
$sudo systemctl status rc-local.service
|
||||
|
|
Loading…
Reference in New Issue