-
Notifications
You must be signed in to change notification settings - Fork 9
/
generate-acct-user.bash
executable file
·84 lines (66 loc) · 2.05 KB
/
generate-acct-user.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/env bash
# This tool generates boilerplat acct-user/ entries for nix-daemon
# and guix-daemon.
# reomve existing users
rm -rf -- acct-user/nixbld*
rm -rf -- acct-user/guixbuilder*
for i in {1..64}; do
# nix users:
d=acct-user/nixbld${i}
mkdir "${d}"
cat > ${d}/nixbld${i}-1.ebuild <<EOF
# Copyright $(date +%Y) Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# #===------------------------------------------------===#
# |This file is auto-generated by generate-acct-user.bash|
# #===------------------------------------------------===#
EAPI=8
inherit acct-user
DESCRIPTION="Builder user for nix-daemon from sys-apps/nix"
ACCT_USER_ID=$((30000 + $i))
# We list 'nixbld' twice to both assign:
# - primary group for user
# - add user to /etc/group
ACCT_USER_GROUPS=( nixbld nixbld )
acct-user_add_deps
EOF
cat > ${d}/metadata.xml <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>[email protected]</email>
<name>Sergei Trofimovich</name>
</maintainer>
</pkgmetadata>
EOF
# guix users:
d=acct-user/guixbuilder${i}
mkdir "${d}"
cat > ${d}/guixbuilder${i}-1.ebuild <<EOF
# Copyright $(date +%Y) Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# #===------------------------------------------------===#
# |This file is auto-generated by generate-acct-user.bash|
# #===------------------------------------------------===#
EAPI=8
inherit acct-user
DESCRIPTION="Builder user for guix-daemon from sys-apps/guix"
ACCT_USER_ID=$((31000 + $i))
# We list 'nixbld' twice to both assign:
# - primary group for user
# - add user to /etc/group
ACCT_USER_GROUPS=( guixbuild guixbuild kvm )
acct-user_add_deps
EOF
cat > ${d}/metadata.xml <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>[email protected]</email>
<name>Sergei Trofimovich</name>
</maintainer>
</pkgmetadata>
EOF
done