initial commit
This commit is contained in:
commit
30d2520a1b
39
Makefile
Normal file
39
Makefile
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
|
||||||
|
.PHONY: help
|
||||||
|
help: ## Show this help
|
||||||
|
@echo 'make-pac'
|
||||||
|
@echo '--------'
|
||||||
|
@echo 'Run the below command in the projects main directory for initial setup'
|
||||||
|
@echo ''
|
||||||
|
@echo ' git submodule add https://gitlab.com/balki/make-pac'
|
||||||
|
@echo ' echo "include make-pac/Makefile" > Makefile'
|
||||||
|
@echo ''
|
||||||
|
@#https://stackoverflow.com/a/47107132
|
||||||
|
@sed -ne '/@sed/!s/## //p' $(MAKEFILE_LIST) | column -tl 2
|
||||||
|
|
||||||
|
.PHONY: install
|
||||||
|
install: ## Symlinks files in pac-root
|
||||||
|
sudo ./make-pac/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 > acl
|
||||||
|
|
||||||
|
.PHONY: set-perms
|
||||||
|
set-perms: ## Restores permissions of all the files from ./acl
|
||||||
|
sudo setfacl --restore acl
|
||||||
|
|
||||||
|
.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
|
17
README.md
Normal file
17
README.md
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
makepac
|
||||||
|
--------
|
||||||
|
|
||||||
|
`makepacc` is a simple package manager to keep all file changes in a linux server in a git repository.
|
||||||
|
|
||||||
|
Initial setup
|
||||||
|
|
||||||
|
mkdir myfiles
|
||||||
|
cd myfiles
|
||||||
|
git init
|
||||||
|
git submodule add https://gitlab.com/balki/makepac'
|
||||||
|
echo "include make-pac/Makefile" > Makefile'
|
||||||
|
make skel
|
||||||
|
git add .
|
||||||
|
git commit -m 'initial commit'
|
||||||
|
|
||||||
|
Now, create all the files inside the `root` directory and run `make install` to have it symlinked to the same path in the real root. Permissions and ownership of the files are recorded with `make save-perms` in `./acl`. After making changes to the system, just make a git commit to record the state
|
16
install.sh
Executable file
16
install.sh
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/bash
|
||||||
|
|
||||||
|
root="root"
|
||||||
|
|
||||||
|
all_files() {
|
||||||
|
find $root -type f,l
|
||||||
|
}
|
||||||
|
|
||||||
|
for f in $(all_files)
|
||||||
|
do
|
||||||
|
install_path="${f#"$root"}"
|
||||||
|
mkdir -p "$(dirname "$install_path")"
|
||||||
|
ln -snf "$PWD/$f" "$install_path"
|
||||||
|
done
|
||||||
|
|
||||||
|
# vim: set filetype=bash:
|
Loading…
Reference in New Issue
Block a user