summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorParabola git <git@parabola.nu>2020-03-14 03:00:02 +0000
committerParabola git <git@parabola.nu>2020-03-14 03:00:02 +0000
commit977aded7fe47aeb3cb83b1e15d123fa0fbe2c701 (patch)
treefa8bcde2ca25a2e9a60a42e75213ca2cc5f05857
parentb82b102c084e132906f828100312b93856543d0f (diff)
Update from cron
l---------abslibre/blacklist.git/hooks/.#pre-receive1
-rwxr-xr-xabslibre/blacklist.git/hooks/pre-receive22
2 files changed, 13 insertions, 10 deletions
diff --git a/abslibre/blacklist.git/hooks/.#pre-receive b/abslibre/blacklist.git/hooks/.#pre-receive
new file mode 120000
index 0000000..de68fb9
--- /dev/null
+++ b/abslibre/blacklist.git/hooks/.#pre-receive
@@ -0,0 +1 @@
+root@winston.parabola.nu.2349507 \ No newline at end of file
diff --git a/abslibre/blacklist.git/hooks/pre-receive b/abslibre/blacklist.git/hooks/pre-receive
index 3a0376d..356f24e 100755
--- a/abslibre/blacklist.git/hooks/pre-receive
+++ b/abslibre/blacklist.git/hooks/pre-receive
@@ -12,6 +12,10 @@ readonly LOG_BLACKLIST_GIT_HOOK=1
readonly CLONE_DIR=/home/autobuilder/packages/blacklist-validate-git-hook
readonly LOG_DIR=/var/log/blacklist-validate-git-hook
readonly SHA_REGEX='^([0-9a-f]{40})$'
+readonly VALIDATION_SCRIPT=check.sh
+readonly PERMS_ERR_MSG="could not create checkout directory: ${CLONE_DIR}"
+readonly CHECKOUT_ERR_MSG="working tree does not appear to be the blacklist.git repo"
+readonly FAIL_MSG="validation failed for ref: %s - did you run ${VALIDATION_SCRIPT}?"
## logging ##
@@ -62,9 +66,8 @@ LogParseRefData "${ref_data}" ${prev_sha} ${curr_sha} ${ref_file} ${repo} ${ref}
(( ! ${is_deletion} )) || return 0
- [[ -f ${CLONE_DIR}/blacklist.txt ]] && \
- [[ -f ${CLONE_DIR}/check.sh ]] || return 1
-
+ ! mkdir -p "${CLONE_DIR}" && echo "${PERMS_ERR_MSG}" && return 1
+
cd ${CLONE_DIR}
# local tmp_dir=$(mktemp --directory --tmpdir=/tmp blacklist-validate-git-hook-XXXXXXXXXX)
#pwd
@@ -73,22 +76,21 @@ LogParseRefData "${ref_data}" ${prev_sha} ${curr_sha} ${ref_file} ${repo} ${ref}
(
GIT_WORK_TREE=${CLONE_DIR}/ GIT_DIR=${CLONE_DIR}/.git
-git log -1 --oneline
-git log -1 --oneline $prev_sha
-git log -1 --oneline $curr_sha
-#GIT_WORK_TREE=${CLONE_DIR}/ GIT_DIR=${CLONE_DIR}/.git git fetch local-git-home
-
git fetch local-git-home
git checkout ${curr_sha} .
)
+ ! [[ -f ${CLONE_DIR}/blacklist.txt ]] && \
+ ! [[ -x ${CLONE_DIR}/${VALIDATION_SCRIPT} ]] && echo "${CHECKOUT_ERR_MSG}" && return 1
+
+ ! ./check.sh && echo "${FAIL_MSG}${ref}" && return 1
-echo "prev_sha=$prev_sha curr_sha=$curr_sha"
+#echo "prev_sha=$prev_sha curr_sha=$curr_sha"
#ls
#git branch
#pwd ; ls -al
# rm -rf ${tmp_dir}
-echo "ok tmp_dir=$tmp_dir"
+echo "ok?=$? tmp_dir=$tmp_dir"
}