github-hosts-sync: make user name/mail overridable
This commit is contained in:
parent
2950b893b0
commit
a666abeaab
|
@ -38,6 +38,8 @@ let
|
|||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
environment = {
|
||||
GITHUB_HOST_SYNC_USER_MAIL = user.mail;
|
||||
GITHUB_HOST_SYNC_USER_NAME = user.name;
|
||||
GITHUB_HOST_SYNC_SRCDIR = cfg.srcDir;
|
||||
GITHUB_HOST_SYNC_WORKTREE = cfg.workTree;
|
||||
GITHUB_HOST_SYNC_URL = cfg.url;
|
||||
|
@ -67,6 +69,7 @@ let
|
|||
};
|
||||
|
||||
user = rec {
|
||||
mail = "${name}@${config.krebs.build.host.name}";
|
||||
name = "github-hosts-sync";
|
||||
uid = genid_uint31 name;
|
||||
};
|
||||
|
|
|
@ -5,6 +5,8 @@ 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"
|
||||
|
||||
|
@ -24,8 +26,8 @@ rsync \
|
|||
git add .
|
||||
|
||||
if test -n "$(git status --porcelain)"; then
|
||||
git config user.email "$LOGNAME@$(hostname)"
|
||||
git config user.name "$LOGNAME"
|
||||
git config user.email "$user_mail"
|
||||
git config user.name "$user_name"
|
||||
git commit -m bump
|
||||
git push
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue