mirror of https://bitbucket.org/ausocean/av.git
68 lines
1.6 KiB
Makefile
68 lines
1.6 KiB
Makefile
# install files and directories required by NetSender clients (such as gpio-netsender, revid-cli, etc.)
|
|
# NB: the default (soft) install does not override conf files
|
|
USER := $(shell whoami)
|
|
PATH := /usr/local/go/bin:$(PATH)
|
|
|
|
.SILENT:make_dirs
|
|
.SILENT:soft_copy_files
|
|
.SILENT:hard_copy_files
|
|
.SILENT:syncreboot
|
|
.SILENT:clean
|
|
|
|
install: as_root make_dirs soft_copy_files syncreboot
|
|
@echo "Install complete"
|
|
|
|
install_hard: as_root make_dirs hard_copy_files syncreboot
|
|
@echo "Hard install complete"
|
|
|
|
as_root:
|
|
ifneq ($(USER),root)
|
|
$(error Must run as superuser!)
|
|
endif
|
|
|
|
make_dirs:
|
|
if [ ! -d /var/netsender ] ; then \
|
|
mkdir /var/netsender; \
|
|
chmod guo+rwx /var/netsender; \
|
|
fi
|
|
if [ ! -d /var/log/netsender ] ; then \
|
|
mkdir /var/log/netsender; \
|
|
chmod guo+rwx /var/log/netsender; \
|
|
fi
|
|
|
|
soft_copy_files:
|
|
if [ -f /etc/rc.local ] ; then \
|
|
echo "/etc/rc.local left unmodified" ; \
|
|
else \
|
|
cp rc.local /etc; \
|
|
fi
|
|
if [ -f /etc/netsender.conf ] ; then \
|
|
echo "/etc/netsender.conf left unmodified" ; \
|
|
else \
|
|
cp netsender.conf /etc; \
|
|
chown pi /etc/netsender.conf; \
|
|
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
|
|
if [ -f /etc/netsender.conf ] ; then \
|
|
echo "Backed up netsender.conf to /etc/netsender.conf.bak"; \
|
|
cp /etc/netsender.conf /etc/netsender.conf.bak ; \
|
|
fi
|
|
cp -f netsender.conf /etc
|
|
chown pi /etc/netsender.conf
|
|
|
|
syncreboot:
|
|
cd ../../utils/cmd/syncreboot; make; make install
|
|
|
|
clean: as_root
|
|
rm -rf /var/netsender
|
|
rm -rf /var/log/netsender
|
|
rm -rf /etc/rc.local
|
|
rm -rf /etc/netsender.conf
|
|
@echo "Clean complete"
|