Makefile: add an if statement for RHEL distribs based

This commit is contained in:
Kevin Chevreuil - Kaisen
2023-01-01 20:27:55 +01:00
committed by Pascal J
parent 1d53472569
commit 2032502e09

View File

@@ -12,7 +12,8 @@ MAN_DIR = $(SHARE_DIR)/man
TEMP_DIR = ./temp
BOOT_DIR = /boot/grub
BOOT_DIR_DEBIAN = /boot/grub
BOOT_DIR_FEDORA = /boot/grub2
.PHONY: install uninstall clean help
@@ -65,10 +66,14 @@ install:
@install -Dm644 -t "$(SHARE_DIR)/doc/$(PKGNAME)/" README.md
@install -Dm644 "initramfs/readme.md" "$(SHARE_DIR)/doc/$(PKGNAME)/initramfs-overlayfs.md"
@rm -rf "${TEMP_DIR}"
@if command -v grub-mkconfig > /dev/null; then \
@if command -v grub-mkconfig > /dev/null && [ -e "$(BOOT_DIR_DEBIAN)/grub.cfg" ]; then \
echo "Updating the GRUB menu..."; \
grub-mkconfig -o "$(BOOT_DIR)/grub.cfg"; \
grub-mkconfig -o "$(BOOT_DIR_DEBIAN)/grub.cfg"; \
fi
@if command -v grub2-mkconfig > /dev/null && [ -e "$(BOOT_DIR_FEDORA)/grub.cfg" ]; then \
echo "Updating the GRUB menu..."; \
grub2-mkconfig -o "$(BOOT_DIR_FEDORA)/grub.cfg"; \
fi
uninstall:
@echo "Uninstalling grub-btrfs"
@@ -100,10 +105,14 @@ uninstall:
@rmdir --ignore-fail-on-non-empty "$(SHARE_DIR)/doc/$(PKGNAME)/" || :
@rmdir --ignore-fail-on-non-empty "$(SHARE_DIR)/licenses/$(PKGNAME)/" || :
@rmdir --ignore-fail-on-non-empty "$(DESTDIR)/etc/default/grub-btrfs" || :
@if command -v grub-mkconfig > /dev/null; then \
@if command -v grub-mkconfig > /dev/null && [ -e "$(BOOT_DIR_DEBIAN)/grub.cfg" ]; then \
echo "Updating the GRUB menu..."; \
grub-mkconfig -o "$(BOOT_DIR)/grub.cfg"; \
grub-mkconfig -o "$(BOOT_DIR_DEBIAN)/grub.cfg"; \
fi
@if command -v grub2-mkconfig > /dev/null && [ -e "$(BOOT_DIR_FEDORA)/grub.cfg" ]; then \
echo "Updating the GRUB menu..."; \
grub2-mkconfig -o "$(BOOT_DIR_FEDORA)/grub.cfg"; \
fi
clean:
@echo "Deleting ./temp"
@@ -120,13 +129,14 @@ help:
@echo
@echo " parameter | type | description | defaults"
@echo " ----------+------+--------------------------------+----------------------------"
@echo " DESTDIR | path | install destination | <unset>"
@echo " PREFIX | path | system tree prefix | '/usr'"
@echo " BOOT_DIR | path | boot data location | '/boot/grub'"
@echo " SHARE_DIR | path | shared data location | '\$$(DESTDIR)\$$(PREFIX)/share'"
@echo " LIB_DIR | path | system libraries location | '\$$(DESTDIR)\$$(PREFIX)/lib'"
@echo " PKGNAME | name | name of the ditributed package | 'grub-btrfs'"
@echo " INITCPIO | bool | include mkinitcpio hook | false"
@echo " SYSTEMD | bool | include unit files | true"
@echo " OPENRC | bool | include OpenRc daemon | false"
@echo " DESTDIR | path | install destination | <unset>"
@echo " PREFIX | path | system tree prefix | '/usr'"
@echo " BOOT_DIR_DEBIAN | path | boot data location (Debian, Ubuntu, Gentoo, Arch...) | '/boot/grub'"
@echo " BOOT_DIR_FEDORA | path | boot data location (Fedora, RHEL, CentOS, Rocky...) | '/boot/grub2'"
@echo " SHARE_DIR | path | shared data location | '\$$(DESTDIR)\$$(PREFIX)/share'"
@echo " LIB_DIR | path | system libraries location | '\$$(DESTDIR)\$$(PREFIX)/lib'"
@echo " PKGNAME | name | name of the ditributed package | 'grub-btrfs'"
@echo " INITCPIO | bool | include mkinitcpio hook | false"
@echo " SYSTEMD | bool | include unit files | true"
@echo " OPENRC | bool | include OpenRc daemon | false"
@echo