slightly comical way of getting the created user added to the right groups
This commit is contained in:
parent
fd11d0c46e
commit
6bdeab6a08
|
@ -50,6 +50,14 @@ parts:
|
|||
'bin/started': usr/bin/started
|
||||
prime:
|
||||
- usr/bin
|
||||
users-and-groups:
|
||||
plugin: dump
|
||||
build-packages:
|
||||
- user-setup
|
||||
prepare: |
|
||||
echo "get passwd/user-default-groups" | \
|
||||
debconf-communicate user-setup |
|
||||
cut -d ' ' -f 2- > users-and-groups
|
||||
probert:
|
||||
plugin: python
|
||||
build-packages: [python-setuptools, libnl-3-dev, libnl-genl-3-dev, libnl-route-3-dev]
|
||||
|
|
|
@ -76,12 +76,17 @@ POST_INSTALL_CONFIG = {
|
|||
|
||||
|
||||
def curtin_userinfo_to_config(userinfo):
|
||||
users_and_groups_path = os.path.join(os.environ.get("SNAP", "/does-not-exist"), "users-and-groups")
|
||||
if os.path.exists(users_and_groups_path):
|
||||
groups = open(users_and_groups_path).read().split()
|
||||
else:
|
||||
groups = ['admin']
|
||||
user = {
|
||||
'name': userinfo['username'],
|
||||
'gecos': userinfo['realname'],
|
||||
'passwd': userinfo['password'],
|
||||
'shell': '/bin/bash',
|
||||
'groups': 'admin',
|
||||
'groups': groups,
|
||||
'lock-passwd': False,
|
||||
}
|
||||
if 'ssh_import_id' in userinfo:
|
||||
|
|
Loading…
Reference in New Issue