diff options
author | makefu <github@syntax-fehler.de> | 2019-06-14 18:41:27 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2019-06-14 18:41:27 +0200 |
commit | 276ad5f9d54a30c6817d00799af49199a5ef9e4c (patch) | |
tree | d441e34c262f08eddf9d84c01508e698468fbbfb /krebs/5pkgs/simple/github-hosts-sync/src/hosts-sync | |
parent | 592d157eba8f1b5ba35f1fca64c2905897468f83 (diff) | |
parent | 4e7af580d81f02f6d07d38917f124f4b99483603 (diff) |
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'krebs/5pkgs/simple/github-hosts-sync/src/hosts-sync')
-rwxr-xr-x | krebs/5pkgs/simple/github-hosts-sync/src/hosts-sync | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/krebs/5pkgs/simple/github-hosts-sync/src/hosts-sync b/krebs/5pkgs/simple/github-hosts-sync/src/hosts-sync new file mode 100755 index 000000000..a8973e72b --- /dev/null +++ b/krebs/5pkgs/simple/github-hosts-sync/src/hosts-sync @@ -0,0 +1,33 @@ +#! /bin/sh +set -efu +exec >&2 + +hosts_srcdir=$GITHUB_HOST_SYNC_SRCDIR +hosts_worktree=${GITHUB_HOST_SYNC_WORKTREE-/tmp/hosts} +hosts_url=${GITHUB_HOST_SYNC_URL-git@github.com:krebs/hosts.git} +user_mail=${GITHUB_HOST_SYNC_USER_MAIL-$LOGNAME@$(hostname)} +user_name=${GITHUB_HOST_SYNC_USER_NAME-$LOGNAME} + +test -d "$hosts_worktree" || git clone "$hosts_url" "$hosts_worktree" + +cd "$hosts_worktree" + +git pull + +rsync \ + --chmod D755,F644 \ + --delete-excluded \ + --filter 'protect .git' \ + --recursive \ + --verbose \ + "$hosts_srcdir/" \ + . + +git add . + +if test -n "$(git status --porcelain)"; then + git config user.email "$user_mail" + git config user.name "$user_name" + git commit -m bump + git push +fi |