config_file_name =  '/etc/adduser.conf'
config_file_type =  'shell'
title='adduser Configuration'
entries=['dshell', 'dhome', 'grouphomes', 'letterhomes', 'skel', 'first_system_uid', 'last_system_uid', 'first_uid', 'last_uid', 'usergroups', 'users_group', 'quotauser']

dshell={
'name'          : 'login shell',
'value_type'    : 'list',
'list_values'   : map(lambda x:x[:-1], open("/etc/shells", "r").readlines())[1:],
'description'   : 'specifies the default login shell on your system',
'config_name'   : 'DSHELL'
}

dhome={
'name'          : 'home',
'value_type'    : 'filename',
'size'          : 118,
'description'   : "specifies the directory containing users'home  directories",
'config_name'   : 'DHOME'
}

grouphomes={
'name'          : 'group homes',
'value_type'    : 'list',
'list_values'   : ['no', 'yes'],
'max_length'    : 3,
'size'          : 30,
'description'   : 'if group homes is "yes", then the home directories will be created as /home/groupname/user',
'config_name'   : 'GROUPHOMES'
}

letterhomes={
'name'          : 'letter homes',
'value_type'    : 'list',
'list_values'   : ['no', 'yes'],
'max_length'    : 3,
'size'          : 30,
'description'   : 'If LETTERHOMES is "yes", then the created home directories will have an extra directory - the first letter of the user name. For example: /home/u/user.',
'config_name'   : 'LETTERHOMES'
}

skel={
'name'          : 'skel directory',
'value_type'    : 'filename',
'size'          : 118,
'description'   : 'The SKEL variable specifies the directory containing "skeletal" user files; in other words, files such as a sample .profile that will be copied to the new user\'s home directory when it is created.',
'config_name'   : 'SKEL'
}

first_system_uid={
'name'          : 'first system uid',
'value_type'    : 'integer',
'integer_limits': (1, 65535),
'size'          : 60,
'description'   : 'first system uid to last system uid inclusive is the range for UIDs for dynamically allocated administrative and system accounts.',
'config_name'   : 'FIRST_SYSTEM_UID'
}

last_system_uid={
'name'          : 'last system uid',
'value_type'    : 'integer',
'integer_limits': (1, 65535),
'size'          : 60,
'description'   : 'first system uid to last system uid inclusive is the range for UIDs for dynamically allocated administrative and system accounts.',
'config_name'   : 'LAST_SYSTEM_UID'
}

first_uid={
'name'          : 'first uid',
'value_type'    : 'integer',
'integer_limits': (1, 65535),
'size'          : 60,
'description'   : 'first uid to last uid inclusive is the range of UIDs of dynamically  allocated user accounts.',
'config_name'   : 'FIRST_UID'
}

last_uid={
'name'          : 'last uid',
'value_type'    : 'integer',
'integer_limits': (1, 65535),
'size'          : 60,
'description'   : 'first uid to last uid inclusive is the range of UIDs of dynamically  allocated user accounts.',
'config_name'   : 'LAST_UID'
}

usergroups={
'name'          : 'user groups',
'value_type'    : 'list',
'list_values'   : ['no', 'yes'],
'max_length'    : 3,
'size'          : 30,
'description'   : 'The user groups entry can be either "yes" or "no".  If "yes" each created user will be given their own group to use as a default, and their home directories will be g+s.  If "no", each created user will be placed in the group whose gid is "users group name" (see below).',
'config_name'   : 'USERGROUPS'
}

import grp

users_group={
'name'          : 'users group name',
'value_type'    : 'list',
'list_values'   : map(lambda x:(x[0],`x[2]`), grp.getgrall()),
'description'   : 'If "user groups" is "no", then "users group name" should be the group "users" (or the equivalent group) on your system.',
'size'         : 80,
'max_length'   : 8,
'config_name'  : 'USERS_GID'
}

quotauser={
'name'          : 'quota user',
'description'   : "If quota user is set, a default quota will be set from that user with `edquota -p QUOTAUSER newuser'",
'config_name'   : 'QUOTAUSER'
}