From dcb9db363913516f5fc8816a1abadee80c94334a Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Sat, 3 Feb 2024 20:51:45 +0100 Subject: [PATCH] bundles/users: source users bashrc after loading global bashrc instead of overwriting it --- bundles/users/files/bashrc | 5 +++++ bundles/users/items.py | 13 ++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/bundles/users/files/bashrc b/bundles/users/files/bashrc index 6bcdcd2..02a9c02 100644 --- a/bundles/users/files/bashrc +++ b/bundles/users/files/bashrc @@ -64,3 +64,8 @@ ${k}() { ${v} } % endfor + +if [[ -f "/etc/bashrc_bundlewrap/$(logname)" ]] +then + source "/etc/bashrc_bundlewrap/$(logname)" +fi diff --git a/bundles/users/items.py b/bundles/users/items.py index d6df3cd..79590dc 100644 --- a/bundles/users/items.py +++ b/bundles/users/items.py @@ -1,5 +1,9 @@ from os.path import exists, join +directories['/etc/bashrc_bundlewrap'] = { + 'purge': True, +} + files = { '/etc/bash.bashrc': { 'source': 'bashrc', @@ -64,14 +68,13 @@ for username, attrs in node.metadata['users'].items(): } if exists(join(repo.path, 'data', 'users', 'files', 'bash', '{}.bashrc'.format(username))): - files[home + '/.bashrc'] = { + files[f'/etc/bashrc_bundlewrap/{username}'] = { 'content_type': 'mako', 'source': 'bash/{}.bashrc'.format(username), } - else: - files[home + '/.bashrc'] = { - 'delete': True, - } + files[f"{home}/.bashrc"] = { + 'delete': True, + } if attrs.get('enable_linger', False): linger_test = ''