Compare commits
3 Commits
e3b3484905
...
1444b29fae
| Author | SHA1 | Date | |
|---|---|---|---|
| 1444b29fae | |||
| 7c4c5a6f50 | |||
| 9867d4f232 |
@@ -34,31 +34,6 @@ RESTART_NGINX := sudo rc-service nginx restart
|
|||||||
container_image_name = $(REGISTRY_DOMAIN)/$(REGISTRY_USER)/joeac.net-$(module)
|
container_image_name = $(REGISTRY_DOMAIN)/$(REGISTRY_USER)/joeac.net-$(module)
|
||||||
nginx_module_target = $(if $(SUBDOMAIN_$(module)),/etc/nginx/http.d/$(SUBDOMAIN_$(module)).joeac.net.conf)
|
nginx_module_target = $(if $(SUBDOMAIN_$(module)),/etc/nginx/http.d/$(SUBDOMAIN_$(module)).joeac.net.conf)
|
||||||
dyndns_module_target = $(if $(SUBDOMAIN_$(module)),/etc/periodic/daily/dyndns-$(SUBDOMAIN_$(module)).joeac.net)
|
dyndns_module_target = $(if $(SUBDOMAIN_$(module)),/etc/periodic/daily/dyndns-$(SUBDOMAIN_$(module)).joeac.net)
|
||||||
openrc_module_target = $(if $(filter $(COMPOSE_SERVICES),$(module)),~/.config/rc/init.d/joeac.net.$(module))
|
|
||||||
install_submake_file = $(shell [ -f "$(module)/install.mk" ] && echo "$(module)/install.mk")
|
|
||||||
|
|
||||||
define build_module_rule =
|
|
||||||
.PHONY: build_$(module)
|
|
||||||
build_$(module): make_$(module) $(module).Dockerfile
|
|
||||||
podman-compose build $(module)
|
|
||||||
endef
|
|
||||||
|
|
||||||
define push_module_rule =
|
|
||||||
.PHONY: push_$(module)
|
|
||||||
push_$(module): login_registry build_$(module)
|
|
||||||
podman push $(container_image_name)
|
|
||||||
endef
|
|
||||||
|
|
||||||
define make_module_rule =
|
|
||||||
.PHONY: make_$(module)
|
|
||||||
make_$(module): $(module)/.env
|
|
||||||
$(MAKE) --directory=$(module)
|
|
||||||
endef
|
|
||||||
|
|
||||||
define module_env_rule =
|
|
||||||
$(module)/.env: .env
|
|
||||||
cp .env $(module)/.env
|
|
||||||
endef
|
|
||||||
|
|
||||||
define install_module_rule =
|
define install_module_rule =
|
||||||
.PHONY: install_$(module)
|
.PHONY: install_$(module)
|
||||||
@@ -66,25 +41,12 @@ install_$(module): install_openrc_$(module) $(nginx_module_target) $(dyndns_modu
|
|||||||
$(if $(install_submake_file),$(MAKE) --makefile=$(notdir $(install_submake_file)) --directory=$(dir $(install_submake_file)) install)
|
$(if $(install_submake_file),$(MAKE) --makefile=$(notdir $(install_submake_file)) --directory=$(dir $(install_submake_file)) install)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define install_openrc_module_rule =
|
|
||||||
.PHONY: install_openrc_$(module)
|
|
||||||
install_openrc_$(module): $(openrc_module_target) openrc_add_$(module) openrc_start_$(module)
|
|
||||||
|
|
||||||
~/.config/rc/init.d/joeac.net.$(module): ~/.config/rc/init.d/joeac.net ~/.config/rc/runlevels/default
|
|
||||||
ln -s $(shell realpath ~)/.config/rc/init.d/joeac.net ~/.config/rc/init.d/joeac.net.$(module)
|
|
||||||
endef
|
|
||||||
|
|
||||||
define reinstall_module_rule =
|
define reinstall_module_rule =
|
||||||
.PHONY: reinstall_$(module)
|
.PHONY: reinstall_$(module)
|
||||||
reinstall_$(module): reinstall_openrc_$(module) $(nginx_module_target) $(dyndns_module_target) $(install_submake_file)
|
reinstall_$(module): reinstall_openrc_$(module) $(nginx_module_target) $(dyndns_module_target) $(install_submake_file)
|
||||||
$(if $(install_submake_file),$(MAKE) --makefile=$(notdir $(install_submake_file)) --directory=$(dir $(install_submake_file)) reinstall)
|
$(if $(install_submake_file),$(MAKE) --makefile=$(notdir $(install_submake_file)) --directory=$(dir $(install_submake_file)) reinstall)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define reinstall_openrc_module_rule =
|
|
||||||
.PHONY: reinstall_openrc_$(module)
|
|
||||||
reinstall_openrc_$(module): $(if $(openrc_module_target),$(openrc_module_target) openrc_restart_$(module))
|
|
||||||
endef
|
|
||||||
|
|
||||||
define uninstall_module_rule =
|
define uninstall_module_rule =
|
||||||
.PHONY: uninstall_$(module)
|
.PHONY: uninstall_$(module)
|
||||||
uninstall_$(module):
|
uninstall_$(module):
|
||||||
@@ -102,23 +64,12 @@ uninstall_$(module):
|
|||||||
$(MAKE) --makefile=$(notdir (install_submake_file)) --directory $(dir $(install_submake_file)) uninstall
|
$(MAKE) --makefile=$(notdir (install_submake_file)) --directory $(dir $(install_submake_file)) uninstall
|
||||||
)
|
)
|
||||||
endef
|
endef
|
||||||
|
= $(if $(filter $(COMPOSE_SERVICES),$(module)),~/.config/rc/init.d/joeac.net.$(module))
|
||||||
|
install_submake_file = $(shell [ -f "$(module)/install.mk" ] && echo "$(module)/install.mk")
|
||||||
|
|
||||||
define openrc_add_rule =
|
define module_env_rule =
|
||||||
.PHONY: openrc_add_$(module)
|
$(module)/.env: .env
|
||||||
openrc_add_$(module):
|
cp .env $(module)/.env
|
||||||
rc-update -U add joeac.net.$(module) default
|
|
||||||
endef
|
|
||||||
|
|
||||||
define openrc_start_rule =
|
|
||||||
.PHONY: openrc_start_$(module)
|
|
||||||
openrc_start_$(module):
|
|
||||||
rc-service -U joeac.net.$(module) start
|
|
||||||
endef
|
|
||||||
|
|
||||||
define openrc_restart_rule =
|
|
||||||
.PHONY: openrc_restart_$(module)
|
|
||||||
openrc_restart_$(module):
|
|
||||||
rc-service -U joeac.net.$(module) restart
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|
||||||
@@ -137,15 +88,8 @@ usage:
|
|||||||
echo " make uninstall"
|
echo " make uninstall"
|
||||||
$(foreach module,$(MODULES),echo " make uninstall_$(module)")
|
$(foreach module,$(MODULES),echo " make uninstall_$(module)")
|
||||||
|
|
||||||
$(foreach module,$(COMPOSE_SERVICES),$(eval $(call build_module_rule)))
|
|
||||||
$(foreach module,$(COMPOSE_SERVICES),$(eval $(call push_module_rule)))
|
|
||||||
$(foreach module,$(MAKE_MODULES),$(eval $(call make_module_rule)))
|
|
||||||
$(foreach module,$(MODULES),$(eval $(call module_env_rule)))
|
$(foreach module,$(MODULES),$(eval $(call module_env_rule)))
|
||||||
|
|
||||||
.PHONY: login_registry
|
|
||||||
login_registry:
|
|
||||||
podman login $(REGISTRY_DOMAIN)
|
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install: $(foreach module,$(MODULES),install_$(module)) install_crontab
|
install: $(foreach module,$(MODULES),install_$(module)) install_crontab
|
||||||
|
|
||||||
@@ -158,30 +102,9 @@ uninstall: uninstall_nginx uninstall_dyndns uninstall_joeac.net_service $(foreac
|
|||||||
$(foreach module,$(MODULES),$(eval $(install_module_rule)))
|
$(foreach module,$(MODULES),$(eval $(install_module_rule)))
|
||||||
$(foreach module,$(MODULES),$(eval $(reinstall_module_rule)))
|
$(foreach module,$(MODULES),$(eval $(reinstall_module_rule)))
|
||||||
$(foreach module,$(MODULES),$(eval $(uninstall_module_rule)))
|
$(foreach module,$(MODULES),$(eval $(uninstall_module_rule)))
|
||||||
$(foreach module,$(MODULES),$(eval $(install_openrc_module_rule)))
|
|
||||||
$(foreach module,$(MODULES),$(eval $(reinstall_openrc_module_rule)))
|
|
||||||
$(foreach module,$(MODULES),$(eval $(openrc_add_rule)))
|
|
||||||
$(foreach module,$(MODULES),$(eval $(openrc_start_rule)))
|
|
||||||
$(foreach module,$(MODULES),$(eval $(openrc_restart_rule)))
|
|
||||||
|
|
||||||
~/.config/rc/init.d/joeac.net: openrc/init.d/joeac.net ~/.config/rc/init.d ~/.config/rc/runlevels/default /etc/init.d/user.$(shell whoami) /etc/conf.d/user.$(shell whoami)
|
|
||||||
rm -f ~/.config/rc/init.d/joeac.net; \
|
|
||||||
mkdir -p ~/.config/rc/init.d; \
|
|
||||||
cp openrc/init.d/joeac.net ~/.config/rc/init.d/joeac.net
|
|
||||||
|
|
||||||
~/.config/rc/init.d:
|
|
||||||
mkdir -p ~/.config/rc/init.d
|
|
||||||
|
|
||||||
~/.config/rc/runlevels/default:
|
|
||||||
mkdir -p ~/.config/rc/runlevels/default
|
|
||||||
|
|
||||||
/etc/init.d/user.$(shell whoami):
|
|
||||||
sudo ln -s /etc/init.d/user /etc/init.d/user.$(shell whoami)
|
|
||||||
|
|
||||||
/etc/conf.d/user.$(shell whoami): openrc/conf.d/user.$(shell whoami)
|
|
||||||
sudo cp openrc/conf.d/user.$(shell whoami) /etc/conf.d/user.$(shell whoami)
|
|
||||||
sudo rc-update add user.$(shell whoami) default
|
|
||||||
|
|
||||||
|
include container.mk
|
||||||
|
include openrc.mk
|
||||||
include nginx.mk
|
include nginx.mk
|
||||||
include crontab.mk
|
include crontab.mk
|
||||||
include dyndns.mk
|
include dyndns.mk
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
define build_module_rule =
|
||||||
|
.PHONY: build_$(module)
|
||||||
|
build_$(module): make_$(module) $(module).Dockerfile
|
||||||
|
podman-compose build $(module)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define push_module_rule =
|
||||||
|
.PHONY: push_$(module)
|
||||||
|
push_$(module): login_registry build_$(module)
|
||||||
|
podman push $(container_image_name)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define make_module_rule =
|
||||||
|
.PHONY: make_$(module)
|
||||||
|
make_$(module): $(module)/.env
|
||||||
|
$(MAKE) --directory=$(module)
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(foreach module,$(COMPOSE_SERVICES),$(eval $(call build_module_rule)))
|
||||||
|
$(foreach module,$(COMPOSE_SERVICES),$(eval $(call push_module_rule)))
|
||||||
|
$(foreach module,$(MAKE_MODULES),$(eval $(call make_module_rule)))
|
||||||
|
|
||||||
|
.PHONY: login_registry
|
||||||
|
login_registry:
|
||||||
|
podman login $(REGISTRY_DOMAIN)
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
define install_openrc_module_rule =
|
||||||
|
.PHONY: install_openrc_$(module)
|
||||||
|
install_openrc_$(module): $(openrc_module_target) openrc_add_$(module) openrc_start_$(module)
|
||||||
|
|
||||||
|
~/.config/rc/init.d/joeac.net.$(module): ~/.config/rc/init.d/joeac.net ~/.config/rc/runlevels/default
|
||||||
|
ln -s $(shell realpath ~)/.config/rc/init.d/joeac.net ~/.config/rc/init.d/joeac.net.$(module)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define reinstall_openrc_module_rule =
|
||||||
|
.PHONY: reinstall_openrc_$(module)
|
||||||
|
reinstall_openrc_$(module): $(if $(openrc_module_target),$(openrc_module_target) openrc_restart_$(module))
|
||||||
|
endef
|
||||||
|
|
||||||
|
define openrc_add_rule =
|
||||||
|
.PHONY: openrc_add_$(module)
|
||||||
|
openrc_add_$(module):
|
||||||
|
rc-update -U add joeac.net.$(module) default
|
||||||
|
endef
|
||||||
|
|
||||||
|
define openrc_start_rule =
|
||||||
|
.PHONY: openrc_start_$(module)
|
||||||
|
openrc_start_$(module):
|
||||||
|
rc-service -U joeac.net.$(module) start
|
||||||
|
endef
|
||||||
|
|
||||||
|
define openrc_restart_rule =
|
||||||
|
.PHONY: openrc_restart_$(module)
|
||||||
|
openrc_restart_$(module):
|
||||||
|
rc-service -U joeac.net.$(module) restart
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(foreach module,$(MODULES),$(eval $(install_openrc_module_rule)))
|
||||||
|
$(foreach module,$(MODULES),$(eval $(reinstall_openrc_module_rule)))
|
||||||
|
$(foreach module,$(MODULES),$(eval $(openrc_add_rule)))
|
||||||
|
$(foreach module,$(MODULES),$(eval $(openrc_start_rule)))
|
||||||
|
$(foreach module,$(MODULES),$(eval $(openrc_restart_rule)))
|
||||||
|
|
||||||
|
~/.config/rc/init.d/joeac.net: openrc/init.d/joeac.net ~/.config/rc/init.d ~/.config/rc/runlevels/default /etc/init.d/user.$(shell whoami) /etc/conf.d/user.$(shell whoami)
|
||||||
|
rm -f ~/.config/rc/init.d/joeac.net; \
|
||||||
|
mkdir -p ~/.config/rc/init.d; \
|
||||||
|
cp openrc/init.d/joeac.net ~/.config/rc/init.d/joeac.net
|
||||||
|
|
||||||
|
~/.config/rc/init.d:
|
||||||
|
mkdir -p ~/.config/rc/init.d
|
||||||
|
|
||||||
|
~/.config/rc/runlevels/default:
|
||||||
|
mkdir -p ~/.config/rc/runlevels/default
|
||||||
|
|
||||||
|
/etc/init.d/user.$(shell whoami):
|
||||||
|
sudo ln -s /etc/init.d/user /etc/init.d/user.$(shell whoami)
|
||||||
|
|
||||||
|
/etc/conf.d/user.$(shell whoami): openrc/conf.d/user.$(shell whoami)
|
||||||
|
sudo cp openrc/conf.d/user.$(shell whoami) /etc/conf.d/user.$(shell whoami)
|
||||||
|
sudo rc-update add user.$(shell whoami) default
|
||||||
Reference in New Issue
Block a user