-
-
Notifications
You must be signed in to change notification settings - Fork 924
/
Makefile
31 lines (26 loc) · 1.23 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
GH_CLI := $(shell command -v gh 2> /dev/null)
PRIVATE_REPO := $(shell echo $${PRIV_REPO-reconftw-data})
.PHONY: sync upload bootstrap rm
# bootstrap a private repo to store data
bootstrap:
@if [ -z $(GH_CLI) ]; then echo "github cli is missing. please install"; exit 2; fi
gh repo create $(PRIVATE_REPO) --private
gh repo clone $(PRIVATE_REPO) ~/$(PRIVATE_REPO)
cd ~/$(PRIVATE_REPO) && git commit --allow-empty -m "Empty commit" && \
git remote add upstream https://github.com/six2dez/reconftw && \
git fetch upstream && \
git rebase upstream/main $(shell git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@') && \
mkdir Recon && \
git push origin $(shell git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')
@echo "Done!"
@echo "Initialized private repo: $(PRIVATE_REPO)"
rm:
gh repo delete $(PRIVATE_REPO) --yes
rm -rf ~/$(PRIVATE_REPO)
sync:
cd ~/$(PRIVATE_REPO) && git fetch upstream && git rebase upstream/main $(shell git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')
upload:
cd ~/$(PRIVATE_REPO) && \
git add . && \
git commit -m "Data upload" && \
git push origin $(shell git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')