Commit 7822dd66 authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

Generate tools/users-setup from descriptions



Now that we have a machine readable description of the users
to be added to the system, use it to generate the tools/users-setup
script, so that we again have only one authoritative source of
the user and group requirements. This also has the advantage of
of avoiding duplicate additions and attemps add a user root.
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarMichele Tartara <mtartara@google.com>
parent d2f465dc
......@@ -971,7 +971,6 @@ EXTRA_DIST = \
devel/upload \
devel/webserver \
tools/kvm-ifup.in \
tools/users-setup.in \
tools/vcluster-setup.in \
$(docinput) \
doc/html \
......@@ -1382,8 +1381,13 @@ tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
sed -f $(REPLACE_VARS_SED) < $< > $@
chmod +x $@
tools/users-setup: tools/users-setup.in $(REPLACE_VARS_SED)
sed -f $(REPLACE_VARS_SED) < $< > $@
tools/users-setup: Makefile $(userspecs)
set -e; \
{ echo '#!/bin/sh'; \
$(AWK) -- '{print "addgroup --system",$$1}' doc/users/groups; \
$(AWK) -- '{if (NF > 1) {print "adduser --system --ingroup",$$2,$$1} else {print "adduser --system",$$1}}' doc/users/users; \
$(AWK) -- '{print "adduser",$$1,$$2}' doc/users/groupmemberships; \
} > $@
chmod +x $@
tools/vcluster-setup: tools/vcluster-setup.in $(REPLACE_VARS_SED)
......
#!/bin/sh
#Create common groups
addgroup --system @GNTDAEMONSGROUP@
addgroup --system @GNTADMINGROUP@
#Create user-specific groups
addgroup --system @GNTMASTERUSER@
addgroup --system @GNTRAPIUSER@
addgroup --system @GNTCONFDUSER@
addgroup --system @GNTLUXIDUSER@
addgroup --system @GNTMONDUSER@
#Create users
adduser --system --ingroup @GNTMASTERDGROUP@ @GNTMASTERUSER@
adduser --system --ingroup @GNTRAPIGROUP@ @GNTRAPIUSER@
adduser --system --ingroup @GNTCONFDGROUP@ @GNTCONFDUSER@
adduser --system --ingroup @GNTLUXIDGROUP@ @GNTLUXIDUSER@
adduser --system --ingroup @GNTMONDGROUP@ @GNTMONDUSER@
adduser --system @GNTNODEDUSER@
#Add users to extra groups
for u in @GNTMASTERUSER@ @GNTCONFDUSER@ @GNTLUXIDUSER@ @GNTRAPIUSER@ @GNTMONDUSER@
do
adduser $u @GNTDAEMONSGROUP@
done
for u in @GNTMASTERUSER@ @GNTRAPIUSER@
do
adduser $u @GNTADMINGROUP@
done
adduser @GNTMASTERUSER@ @GNTCONFDGROUP@
adduser @GNTMONDUSER@ @GNTMASTERDGROUP@
adduser @GNTLUXIDUSER@ @GNTMASTERDGROUP@
adduser @GNTLUXIDUSER@ @GNTCONFDGROUP@
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment