Skip to content

Commit

Permalink
Fine-tuning the Makefile
Browse files Browse the repository at this point in the history
Create the usb network interface at install time or
enable the service to create the interface at first boot
Make the neccasary services start-up at boot
Also create the means to cleanly uninstall the complete package.
  • Loading branch information
PsychoGame committed Feb 26, 2021
1 parent 5bd500d commit e4c6876
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions Makefile
@@ -1,4 +1,4 @@
VERSION = 0.1
VERSION = 0.9
PN = pinephone-dev-tools

PREFIX ?= /usr
Expand Down Expand Up @@ -28,8 +28,24 @@ install-systemd:
$(INSTALL_DIR) "$(DESTDIR)$(INITDIR_SYSTEMD)"
$(INSTALL_DATA) init/pinephone-setup-usb-network.service "$(DESTDIR)$(INITDIR_SYSTEMD)/pinephone-setup-usb-network.service"
$(INSTALL_DATA) init/pinephone-usb-gadget.service "$(DESTDIR)$(INITDIR_SYSTEMD)/pinephone-usb-gadget.service"

install: install-bin install-systemd

enable-services:
$(Q)echo -e '\033[1;32mEnabling USB-Gadget & USB Network services...\033[0m'
# Try setting up USB networking directly; if it doesn't work (i.e. the NM
# connection file isn't created), then we're probably creating an image and
# need a systemd service running on first boot to setup USB networking
"$(DESTDIR)$(BINDIR)/pinephone-setup-usb-network"
if [ ! -e /etc/NetworkManager/system-connections/USB.nmconnection ]; then \
systemctl enable pinephone-setup-usb-network; \
fi
systemctl enable pinephone-usb-gadget

install: install-bin install-systemd enable-services

disable-services:
systemctl disable pinephone-usb-gadget
systemctl disable pinephone-setup-usb-network
$(RM) /etc/NetworkManager/system-connections/USB.nmconnection

uninstall-bin:
$(RM) "$(DESTDIR)$(BINDIR)/pinephone-setup-usb-network"
Expand All @@ -39,10 +55,9 @@ uninstall-systemd:
$(RM) "$(DESTDIR)$(INITDIR_SYSTEMD)/pinephone-setup-usb-network.service"
$(RM) "$(DESTDIR)$(INITDIR_SYSTEMD)/pinephone-usb-gadget.service"

uninstall: uninstall-bin uninstall-systemd
uninstall: disable-services uninstall-bin uninstall-systemd

clean:
$(RM) -f common/$(PN)

.PHONY: install-bin install-systemd install uninstall-bin uninstall-systemd uninstall clean

.PHONY: install-bin install-systemd enable-services install disable-services uninstall-bin uninstall-systemd uninstall clean

0 comments on commit e4c6876

Please sign in to comment.