makepac/Makefile

44 lines
1.3 KiB
Makefile

.PHONY: help
help: ## Show this help
@echo 'makepac'
@echo '--------'
@echo 'Simple configuration manager'
@echo ''
@echo 'See https://gitlab.com/balki/makepac for usage'
@echo ''
@#https://stackoverflow.com/a/47107132
@sed -ne '/@sed/!s/## //p' $(MAKEFILE_LIST) | column -tl 2
.PHONY: install
install: ## Installs files in root/ to real root
sudo ./makepac/install.sh
.PHONY: sd-reload
sd-reload: ## Run this after editing systemd service/timer files
sudo systemctl daemon-reload
.PHONY: sd-users
sd-users: ## Run this after adding new users
sudo systemctl restart systemd-sysusers.service
.PHONY: save-perms
save-perms: ## Saves the file permissions to ./acl. Run this after adding new files with correct permissions
getfacl --recursive root | ./makepac/sort_acl.sh > acl
.PHONY: set-perms
set-perms: ## Restores permissions of all files from ./acl
sudo setfacl --restore acl
# TODO: Remove glob
.PHONY: user-perms
user-perms: ## Grant running user all permissions. Need for git operations. Does not get copied to real filesystem
find root -type f | xargs sudo setfacl -m "u:${USER}:r"
find root -type d | xargs sudo setfacl -m "u:${USER}:rwx"
.PHONY: skel
skel: ## Creates common directories needed
mkdir -p root/etc/
mkdir -p root/usr/local/bin
mkdir -p root/usr/local/lib/systemd/system
mkdir -p root/usr/local/lib/sysusers.d