summaryrefslogtreecommitdiff
path: root/personal-pkgs-repo/files/autopkg-head.mk
diff options
context:
space:
mode:
authorKarel Kočí <karel.koci@nic.cz>2018-08-30 12:37:18 +0200
committerKarel Kočí <karel.koci@nic.cz>2018-08-30 12:37:18 +0200
commitd83bde419809e1836983c8fead7185dfb7689b04 (patch)
treed0e0c8b746a7f24775d9d7f67ab73f2325cec7a6 /personal-pkgs-repo/files/autopkg-head.mk
parentd7b7793976ee2d1fac1763c224edcc7405168c57 (diff)
downloadopenwrt-personal-pkgs-d83bde419809e1836983c8fead7185dfb7689b04.tar.gz
openwrt-personal-pkgs-d83bde419809e1836983c8fead7185dfb7689b04.tar.bz2
openwrt-personal-pkgs-d83bde419809e1836983c8fead7185dfb7689b04.zip
autopkg: split common
Diffstat (limited to 'personal-pkgs-repo/files/autopkg-head.mk')
-rw-r--r--personal-pkgs-repo/files/autopkg-head.mk21
1 files changed, 21 insertions, 0 deletions
diff --git a/personal-pkgs-repo/files/autopkg-head.mk b/personal-pkgs-repo/files/autopkg-head.mk
new file mode 100644
index 0000000..115e1ae
--- /dev/null
+++ b/personal-pkgs-repo/files/autopkg-head.mk
@@ -0,0 +1,21 @@
+ifndef AUTOPKG_VARIANT
+ $(error "Don't include autopkg-head.mk directly!")
+endif
+
+ifndef PKG_NAME
+$(error You have to define PKG_NAME before pkgauto.mk include)
+endif
+ifndef PKG_SOURCE_URL
+$(error You have to define PKG_SOURCE_URL before pkgauto.mk include)
+endif
+
+TMP_REPO_PATH=$(DL_DIR)/autopkg/$(PKG_NAME)
+GIT_ARGS=--git-dir='$(TMP_REPO_PATH)' --bare
+
+# Clone/update git history to bare repository
+$(shell \
+ if [ ! -d "$(TMP_REPO_PATH)" ]; then \
+ git clone --mirror "$(PKG_SOURCE_URL)" "$(TMP_REPO_PATH)"; \
+ else \
+ git $(GIT_ARGS) remote update origin; \
+ fi)