50 lines
1.7 KiB
Makefile
50 lines
1.7 KiB
Makefile
# 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
|
|
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)
|
|
|
|
##@ 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
|
|
|