mirror of https://bitbucket.org/ausocean/av.git
init/Makefile: make user customizable
This commit is contained in:
parent
47028b70c2
commit
7a397ff96f
|
@ -3,6 +3,9 @@
|
|||
# MA and DK can be optionally passed to Make, e.g, for a hard (first-time) installation:
|
||||
# sudo MA=mac DK=dk install_hard
|
||||
# NB: The default (soft) install does not override conf files.
|
||||
# USR can also be passsed to customise user under which the code is housed.
|
||||
# For example, if you're trying to make rv on your laptop instead of a pi,
|
||||
# set USR=<your user name>.
|
||||
USER := $(shell whoami)
|
||||
PATH := /usr/local/go/bin:$(PATH)
|
||||
ifeq ($(MA),)
|
||||
|
@ -11,6 +14,9 @@ endif
|
|||
ifeq ($(DK),)
|
||||
DK := 0
|
||||
endif
|
||||
ifeq ($(USR),)
|
||||
USR := "pi"
|
||||
endif
|
||||
|
||||
.SILENT:make_dirs
|
||||
.SILENT:soft_copy_files
|
||||
|
@ -32,6 +38,8 @@ as_root:
|
|||
ifneq ($(USER),root)
|
||||
$(error Must run as superuser!)
|
||||
endif
|
||||
sed -i 's/pi/$(USR)/' rv.service
|
||||
sed -i 's/pi/$(USR)/' run.sh
|
||||
|
||||
make_dirs:
|
||||
if [ ! -d /var/netsender ] ; then \
|
||||
|
@ -50,12 +58,12 @@ soft_copy_files:
|
|||
cp rv.service /etc/systemd/system; \
|
||||
fi
|
||||
systemctl enable rv.service
|
||||
chmod +x pi_run.sh
|
||||
chmod +x run.sh
|
||||
if [ -f /etc/netsender.conf ] ; then \
|
||||
echo "/etc/netsender.conf left unmodified" ; \
|
||||
else \
|
||||
printf "ma $(MA)\ndk $(DK)\n" > /etc/netsender.conf; \
|
||||
chown pi /etc/netsender.conf; \
|
||||
chown $(USR) /etc/netsender.conf; \
|
||||
fi
|
||||
|
||||
hard_copy_files:
|
||||
|
@ -64,13 +72,13 @@ hard_copy_files:
|
|||
fi
|
||||
cp -f rv.service /etc/systemd/system
|
||||
systemctl enable rv.service
|
||||
chmod +x pi_run.sh
|
||||
chmod +x run.sh
|
||||
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
|
||||
printf "ma $(MA)\ndk $(DK)\n" > /etc/netsender.conf
|
||||
chown pi /etc/netsender.conf
|
||||
chown $(USR) /etc/netsender.conf
|
||||
|
||||
hard_copy_files_treat:
|
||||
if [ -f /etc/systemd/system/treatment.service ] ; then \
|
||||
|
@ -84,7 +92,7 @@ hard_copy_files_treat:
|
|||
cp /etc/netsender.conf /etc/netsender.conf.bak ; \
|
||||
fi
|
||||
printf "ma $(MA)\ndk $(DK)\n" > /etc/netsender.conf
|
||||
chown pi /etc/netsender.conf
|
||||
chown $(USR) /etc/netsender.conf
|
||||
|
||||
set_mac:
|
||||
printf "ip link set eth0 address $(MA)\n" > /etc/dhcpcd.enter-hook
|
||||
|
|
|
@ -3,8 +3,8 @@ Description=Netsender Client for Media Collection and Forwarding
|
|||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/home/pi/go/src/bitbucket.org/ausocean/av/init/pi_run.sh
|
||||
ExecStart=/home/pi/go/src/bitbucket.org/ausocean/av/init/run.sh
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
WantedBy=multi-user.target
|
||||
|
|
Loading…
Reference in New Issue