bundles/users: add option to enable lingering
All checks were successful
kunsi/bundlewrap/pipeline/head This commit looks good
All checks were successful
kunsi/bundlewrap/pipeline/head This commit looks good
This commit is contained in:
parent
9fc86a4d9f
commit
6a144cf991
4 changed files with 62 additions and 5 deletions
|
@ -1,9 +1,5 @@
|
|||
from os.path import join, exists
|
||||
|
||||
directories = {}
|
||||
users = {}
|
||||
groups = {}
|
||||
|
||||
files = {
|
||||
'/etc/bash.bashrc': {
|
||||
'source': 'bashrc',
|
||||
|
@ -76,3 +72,18 @@ for username, attrs in node.metadata['users'].items():
|
|||
files[home + '/.bashrc'] = {
|
||||
'delete': True,
|
||||
}
|
||||
|
||||
if attrs.get('enable_linger', False):
|
||||
linger_test = ''
|
||||
linger_command = 'enable'
|
||||
else:
|
||||
linger_test = '!'
|
||||
linger_command = 'disable'
|
||||
|
||||
actions[f'ensure_linger_state_for_user_{username}'] = {
|
||||
'command': f'loginctl {linger_command}-linger {username}',
|
||||
'unless': f'{linger_test} test -f /var/lib/systemd/linger/{username}',
|
||||
'needs': {
|
||||
f'user:{username}',
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue