-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
59 lines (48 loc) · 1.52 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
VERSION_TXT = version.txt
FILE_VERSION = $(shell cat $(VERSION_TXT))
VERSION = $(FILE_VERSION)
SHELL = /bin/bash
FILES_SH = autokubeconfig.sh autokubectl.sh showkubectl.sh
FILES_PY = autokubectl.py
PROFILE_D_DIR = /etc/profile.d
BIN_DIR = $(shell pwd)
.ONESHELL:
all: autokubectl.sh
.PHONY: autokubectl.sh
autokubectl.sh: autokubectl.sh.in
sed -e 's|^BIN_PATH=.*|BIN_PATH=$(BIN_DIR)/autokubectl.py|' $< > $@
install: autokubectl.sh
install -m 644 $(FILES_SH) $(PROFILE_D_DIR)/
install-user: autokubectl.sh
@for rc in ~/.bashrc ~/.zshrc; do
if ! [ -e ~/.bashrc ] && ! [ -e ~/.zshrc ]; then
rc=~/.profile
fi
if [ -e $$rc ] && ! grep -q autokubeconfig.sh $$rc; then
echo Installing in $$rc
{
echo
echo '## Installed by Autokubectl: https://github.com/caruccio/autokube'
echo '[ -e "$(BIN_DIR)/autokubeconfig.sh" ] && source "$(BIN_DIR)/autokubeconfig.sh"'
echo '[ -e "$(BIN_DIR)/autokubectl.sh" ] && source "$(BIN_DIR)/autokubectl.sh"'
echo '[ -e "$(BIN_DIR)/showkubectl.sh" ] && source "$(BIN_DIR)/showkubectl.sh"'
} >> $$rc
fi
done
#help:
# source autokubectl.sh
# autokubectl_help HELP
#test:
# source autokubectl.sh
# autokubectl.py test
release: is-git-clean
git pull --tags
git commit -m "Built release $(VERSION)" $(VERSION_TXT)
git tag $(VERSION)
git push origin main --tags
is-git-clean:
@if git status --porcelain | grep '^[^?]' | grep -vq $(VERSION_TXT); then
git status
echo -e "\n>>> Tree is not clean. Please commit and try again <<<\n"
exit 1
fi