|
1 | 1 | PREFIX=/usr/local |
2 | | - |
| 2 | +CONFIG_DIR=/etc/default |
3 | 3 | SCRIPTS=update-vendor-firmware update-grub first-boot update-m1n1 |
4 | 4 | UNITS=first-boot.service |
5 | 5 | MULTI_USER_WANTS=first-boot.service |
| 6 | +DRACUT_CONF_DIR=$(PREFIX)/lib/dracut/dracut.conf.d |
| 7 | +BUILD_SCRIPTS=$(addprefix build/,$(SCRIPTS)) |
| 8 | + |
| 9 | +all: $(BUILD_SCRIPTS) |
| 10 | + |
| 11 | +build/%: % |
| 12 | + @[ ! -e build ] && mkdir -p build || true |
| 13 | + sed -e s,/etc/default,$(CONFIG_DIR),g "$<" > "$@" |
| 14 | + chmod +x "$@" |
6 | 15 |
|
7 | | -install: |
| 16 | +install: all |
8 | 17 | install -d $(DESTDIR)$(PREFIX)/bin/ |
9 | | - install -m0755 -t $(DESTDIR)$(PREFIX)/bin/ $(SCRIPTS) |
| 18 | + install -m0755 -t $(DESTDIR)$(PREFIX)/bin/ $(BUILD_SCRIPTS) |
10 | 19 | install -dD $(DESTDIR)$(PREFIX)/lib/systemd/system |
11 | 20 | install -dD $(DESTDIR)$(PREFIX)/lib/systemd/system/{multi-user,sysinit}.target.wants |
12 | 21 | install -m0644 -t $(DESTDIR)$(PREFIX)/lib/systemd/system $(addprefix systemd/,$(UNITS)) |
13 | 22 | ln -sf $(addprefix $(PREFIX)/lib/systemd/system/,$(MULTI_USER_WANTS)) \ |
14 | 23 | $(DESTDIR)$(PREFIX)/lib/systemd/system/multi-user.target.wants/ |
| 24 | + install -dD $(DESTDIR)/etc |
| 25 | + install -m0644 -t $(DESTDIR)/etc etc/m1n1.conf |
| 26 | + install -dD $(DESTDIR)$(PREFIX)/share/asahi-scripts |
| 27 | + install -m0644 -t $(DESTDIR)$(PREFIX)/share/asahi-scripts functions.sh |
| 28 | + |
| 29 | +install-arch: install |
15 | 30 | install -dD $(DESTDIR)$(PREFIX)/lib/initcpio/install |
16 | 31 | install -m0644 -t $(DESTDIR)$(PREFIX)/lib/initcpio/install initcpio/install/asahi |
17 | 32 | install -dD $(DESTDIR)$(PREFIX)/lib/initcpio/hooks |
18 | 33 | install -m0644 -t $(DESTDIR)$(PREFIX)/lib/initcpio/hooks initcpio/hooks/asahi |
19 | 34 | install -dD $(DESTDIR)$(PREFIX)/share/libalpm/hooks |
20 | 35 | install -m0644 -t $(DESTDIR)$(PREFIX)/share/libalpm/hooks libalpm/hooks/95-m1n1-install.hook |
21 | | - install -dD $(DESTDIR)/etc |
22 | | - install -m0644 -t $(DESTDIR)/etc etc/m1n1.conf |
23 | | - install -dD $(DESTDIR)$(PREFIX)/share/asahi-scripts |
24 | | - install -m0644 -t $(DESTDIR)$(PREFIX)/share/asahi-scripts functions.sh |
| 36 | + |
| 37 | +install-fedora: install |
| 38 | + install -dD $(DESTDIR)$(DRACUT_CONF_DIR) |
| 39 | + install -m0644 -t $(DESTDIR)$(DRACUT_CONF_DIR) dracut/10-asahi.conf |
25 | 40 |
|
26 | 41 | uninstall: |
27 | 42 | rm -f $(addprefix $(DESTDIR)$(PREFIX)/bin/,$(SCRIPTS)) |
28 | 43 | rm -f $(addprefix $(DESTDIR)$(PREFIX)/lib/systemd/system/,$(UNITS)) |
29 | 44 | rm -f $(addprefix $(DESTDIR)$(PREFIX)/lib/systemd/system/multi-user.target.wants/,$(MULTI_USER_WANTS)) |
| 45 | + rm -rf $(DESTDIR)$(PREFIX)/share/asahi-scripts |
| 46 | + |
| 47 | +uninstall-arch: |
30 | 48 | rm -f $(DESTDIR)$(PREFIX)/lib/initcpio/install/asahi |
31 | 49 | rm -f $(DESTDIR)$(PREFIX)/lib/initcpio/hooks/asahi |
32 | 50 | rm -f $(DESTDIR)$(PREFIX)/share/libalpm/hooks/95-m1n1-install.hook |
33 | | - rm -rf $(DESTDIR)$(PREFIX)/share/asahi-scripts |
34 | 51 |
|
35 | | -.PHONY: install uninstall |
| 52 | +uninstall-fedora: |
| 53 | + rm -f $(DESTDIR)$(DRACUT_CONF_DIR)/10-asahi.conf |
| 54 | + |
| 55 | +.PHONY: install install-arch install-fedora uninstall uninstall-arch uninstall-fedora |
0 commit comments