52 lines
1.7 KiB
Makefile
52 lines
1.7 KiB
Makefile
NAME = $(shell basename $(PWD))
|
|
VERSION = $(shell git describe | sed 's/-/./g')
|
|
RELEASE = $(shell git rev-parse --short HEAD)
|
|
BRANCH = $(shell git branch --show-current)
|
|
BUILD_ARCH = noarch
|
|
RPM_BUILD_PATH = $(RPM_RPMDIR)/$(BUILD_ARCH)/$(NAME)-$(VERSION)-$(RELEASE).$(BUILD_ARCH).rpm
|
|
|
|
RPM_RPMDIR = $(shell rpm --eval '%{_rpmdir}')
|
|
RPM_SBINDIR = $(shell rpm --eval '%{_sbindir}')
|
|
RPM_SOURCEDIR = $(shell rpm --eval '%{_sourcedir}')
|
|
RPM_SYSCONFDIR = $(shell rpm --eval '%{_sysconfdir}')
|
|
RPM_UNITDIR = $(shell rpm --eval '%{_unitdir}')
|
|
RPM_TARBALL_PATH = $(RPM_SOURCEDIR)/$(NAME)-$(VERSION).tar.gz
|
|
|
|
.PHONY: name
|
|
name:
|
|
@echo "$(NAME)"
|
|
|
|
.PHONY: version
|
|
version:
|
|
@echo "$(VERSION)"
|
|
|
|
.PHONY: release
|
|
release:
|
|
@echo "$(RELEASE)"
|
|
|
|
.PHONY: build_arch
|
|
build_arch:
|
|
@echo "$(BUILD_ARCH)"
|
|
|
|
.PHONY: install
|
|
install:
|
|
install --directory $(DESTDIR)$(RPM_SYSCONFDIR)/nginx/conf.d $(DESTDIR)$(RPM_SYSCONFDIR)/certbot $(DESTDIR)$(RPM_UNITDIR) $(DESTDIR)$(RPM_SBINDIR)
|
|
install --target-directory=$(DESTDIR)$(RPM_SYSCONFDIR)/nginx/conf.d files/nginx/0_security.conf files/nginx/default.conf
|
|
install --mode=600 --target-directory=$(DESTDIR)$(RPM_SYSCONFDIR)/certbot files/certbot/ovh.ini
|
|
install --mode=644 --target-directory=$(DESTDIR)$(RPM_UNITDIR) files/systemd/certbot-renew.service files/systemd/certbot-renew.timer
|
|
install --mode=755 --target-directory=$(DESTDIR)$(RPM_SBINDIR) files/sbin/certbot_renew
|
|
|
|
$(RPM_TARBALL_PATH): *
|
|
git archive --format=tar.gz \
|
|
--output="$@" \
|
|
--prefix="$(NAME)-$(VERSION)/" \
|
|
--verbose \
|
|
"$(BRANCH)"
|
|
|
|
.PHONY: tarball
|
|
tarball: $(RPM_TARBALL_PATH)
|
|
|
|
.PHONY: upload
|
|
upload:
|
|
curl --upload-file "$(RPM_BUILD_PATH)" https://git.netoik.io/api/packages/samuel/rpm/upload
|