diff options
Diffstat (limited to 'bin/update-userinfo.sh')
-rwxr-xr-x | bin/update-userinfo.sh | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/bin/update-userinfo.sh b/bin/update-userinfo.sh index 613db4b..1acf8c2 100755 --- a/bin/update-userinfo.sh +++ b/bin/update-userinfo.sh @@ -2,9 +2,19 @@ echo -n 'Updating LDAP user information...' +DESTFILE=_data/userinfo.json if [[ $(hostname -f) == *'gentoo.org'* ]] || [[ "$FORCE" == '1' ]]; then - timeout 180 bin/userinfo-export.rb > _data/userinfo.json + timeout 180 bin/userinfo-export.rb > "${DESTFILE}".tmp && mv -f "${DESTFILE}".tmp "${DESTFILE}" echo 'done.' else echo 'skipped (not a gentoo.org box, assuming no LDAP available, set FORCE=1 to override).' + if [[ ! -e "${DESTFILE}" ]]; then + cat >"${DESTFILE}" <<-EOF + { + "current": {}, + "retired": {}, + "system": {} + } + EOF + fi fi |