arch-pkgs/Makefile

66 lines
2.4 KiB
Makefile
Raw Permalink Normal View History

2021-07-22 09:16:41 +00:00
# Terminal Colours
RED?=$(shell tput setaf 1)
GREEN?=$(shell tput setaf 2)
YELLOW?=$(shell tput setaf 3)
BLUE?=$(shell tput setaf 4)
BOLD?=$(shell tput bold)
RST?=$(shell tput sgr0)
# Local Repository
REPO_NAME=grawlinson
REPO_PATH=/var/lib/repo/${REPO_NAME}
# Remote Repository
REMOTE_USER=$(shell pass rsyncd/mirror-${REPO_NAME}-user)
REMOTE_HOST=$(shell pass rsyncd/mirror-${REPO_NAME}-host)
REMOTE_PATH=${REPO_NAME}
RSYNC_OPTS=-lrhvPt --delete --old-args
RSYNC_OPTS_DRY=${RSYNC_OPTS} --dry-run
2021-07-22 09:16:41 +00:00
RSYNC_PASSWORD=$(shell pass rsyncd/mirror-${REPO_NAME})
##@ Package
.PHONY: check
check: ## Check for package updates
@echo "$(BOLD)$(GREEN)[*] $(RST)$(BOLD)Checking for package updates…$(RST)"
@nvchecker -c .repo/nvchecker.toml
@nvtake -c .repo/nvchecker.toml --all
##@ Repository
.PHONY: sync
sync: push ## An alias for push
.PHONY: pull
pull: ## Sync remote repository with local repository
@echo "$(BOLD)$(GREEN)[*] $(RST)$(BOLD)Syncing remote with local repository…$(RST)"
@RSYNC_PASSWORD=$(RSYNC_PASSWORD) rsync $(RSYNC_OPTS) rsync://$(REMOTE_USER)@$(REMOTE_HOST)/$(REMOTE_PATH) $(REPO_PATH)/
.PHONY: push
push: ## Sync local repository with remote repository
@echo "$(BOLD)$(GREEN)[*] $(RST)$(BOLD)Syncing local with remote repository…$(RST)"
@RSYNC_PASSWORD=$(RSYNC_PASSWORD) rsync $(RSYNC_OPTS) $(REPO_PATH)/ rsync://$(REMOTE_USER)@$(REMOTE_HOST)/$(REMOTE_PATH)
.PHONY: dry-pull
dry-pull: ## Sync remote repository with local repository (dry run)
@echo "$(BOLD)$(GREEN)[*] $(RST)$(BOLD)Syncing remote with local repository…$(RST)"
@RSYNC_PASSWORD=$(RSYNC_PASSWORD) rsync $(RSYNC_OPTS_DRY) rsync://$(REMOTE_USER)@$(REMOTE_HOST)/$(REMOTE_PATH) $(REPO_PATH)/
.PHONY: dry-push
dry-push: ## Sync local repository with remote repository (dry run)
@echo "$(BOLD)$(GREEN)[*] $(RST)$(BOLD)Syncing local with remote repository…$(RST)"
@RSYNC_PASSWORD=$(RSYNC_PASSWORD) rsync $(RSYNC_OPTS_DRY) $(REPO_PATH)/ rsync://$(REMOTE_USER)@$(REMOTE_HOST)/$(REMOTE_PATH)
2021-07-22 09:16:41 +00:00
##@ Utility
.DEFAULT_GOAL = help
.PHONY: help
help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n $(YELLOW)make$(RST) $(BLUE)command$(RST)\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " $(BLUE)%-15s$(RST) %s\n", $$1, $$2 } /^##@/ { printf "\n$(BOLD)%s$(RST)\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
rewrite: ## Rewrite .gitmodules
@.repo/rewrite-gitmodules
.PHONY: list-private-packages
list-private: ## List private packages in repository
@.repo/list-private