summaryrefslogtreecommitdiff
path: root/etc/mklogin.conf
blob: 87c4c749b0b77976143b3540560a0264a24395f3 (plain)
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
#!/usr/bin/awk -f
#
# Generates a login.conf file from login.conf.in and an optional
# file containing overrides.
#
# Usage: mklogin.conf [overrides_file] < login.conf.in > login.conf.out
#
# $OpenBSD: mklogin.conf,v 1.6 2010/12/17 05:33:06 tedu Exp $

BEGIN {
	# Default substitutions
	values["DEF_DATASIZE_MAX"]="512M"
	values["DEF_DATASIZE_CUR"]="512M"
	values["DEF_MAXPROC_MAX"]="256"
	values["DEF_MAXPROC_CUR"]="128"
	values["DEF_OPENFILES_CUR"]="128"
	values["STAFF_DATASIZE_MAX"]="infinity"
	values["STAFF_DATASIZE_CUR"]="512M"
	values["STAFF_MAXPROC_MAX"]="512"
	values["STAFF_MAXPROC_CUR"]="128"
	values["STAFF_OPENFILES_CUR"]="128"
	values["DEF_BLOWFISH_RNDS"]="6"
	values["ROOT_BLOWFISH_RNDS"]="8"

	# Optional overrides
	if (ARGC > 1) {
		while (getline override < ARGV[1]) {
			split(override, ov)
			values[ov[1] ""]=ov[2] ""
		}
		ARGC--
	}
}

# Read in login.conf template, do substitutions and output the result
{
	for (key in values)
		gsub("@" key "@", values[key], $0)
	print $0
}