From 2154dfe45e240617e6975b22ecca1a631a928dfe Mon Sep 17 00:00:00 2001 From: MatMoul Date: Wed, 28 Dec 2016 01:45:34 +0100 Subject: [PATCH] Add make install and make uninstall --- makefile | 25 +++++++++++++++++++++++-- udev/g810-led.rules | 6 ++++++ 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 udev/g810-led.rules diff --git a/makefile b/makefile index 24826e8..2021fda 100644 --- a/makefile +++ b/makefile @@ -4,7 +4,7 @@ LIBUSB_INC?=-I/usr/include/libusb-1.0 LDFLAGS=-lusb-1.0 PROGN=g810-led -.PHONY: all debug clean +.PHONY: all debug clean install uninstall update all: bin/$(PROGN) @@ -16,5 +16,26 @@ debug: CFLAGS += -g -Wextra -pedantic debug: bin/$(PROGN) clean: - rm -rf bin + @rm -rf bin +install: + @sudo mkdir -p /etc/$(PROGN)/samples + @sudo cp sample_profiles/* /etc/$(PROGN)/samples + @sudo cp udev/$(PROGN).rules /etc/udev/rules.d + @sudo cp bin/$(PROGN) /usr/bin + @sudo test -s /etc/$(PROGN)/profile || sudo cp /etc/$(PROGN)/samples/group_keys /etc/$(PROGN)/profile + @sudo test -s /etc/$(PROGN)/reboot || sudo cp /etc/$(PROGN)/samples/all_off /etc/$(PROGN)/reboot + @sudo cp systemd/$(PROGN).service /usr/lib/systemd/system + @sudo cp systemd/$(PROGN)-reboot.service /usr/lib/systemd/system + @sudo systemctl start $(PROGN) + @sudo systemctl enable $(PROGN) + @sudo systemctl enable $(PROGN)-reboot + +uninstall: + @sudo systemctl disable $(PROGN) + @sudo systemctl disable $(PROGN)-reboot + @sudo rm /usr/lib/systemd/system/$(PROGN).service + @sudo rm /usr/lib/systemd/system/$(PROGN)-reboot.service + @sudo rm /etc/udev/rules.d/$(PROGN).rules + @sudo rm /usr/bin/$(PROGN) + @sudo rm -R /etc/$(PROGN) diff --git a/udev/g810-led.rules b/udev/g810-led.rules new file mode 100644 index 0000000..de8dd79 --- /dev/null +++ b/udev/g810-led.rules @@ -0,0 +1,6 @@ +ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c331", MODE="660", GROUP="users" +ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c337", MODE="660", GROUP="users" +ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c330", MODE="660", GROUP="users" +ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c333", MODE="660", GROUP="users" +ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c32b", MODE="660", GROUP="users" +ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c335", MODE="660", GROUP="users"