aboutsummaryrefslogtreecommitdiff
blob: 6da0f5db15f8163fc3e5e1587e8615c57dc9af57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash

echo -n 'Updating LDAP user information...'

DESTFILE=_data/userinfo.json
if [[ $(hostname -f) == *'gentoo.org'* ]] || [[ "$FORCE" == '1' ]]; then
  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
	  echo '
		{
			"current": {},
			"retired": {},
			"system": {}
		}
	  ' | tr '\t' ' ' >"${DESTFILE}"
  fi
fi