On Thu, Apr 05, 2018 at 02:22:13PM +0200, Andrea Bolognani wrote:
We want to take control of the user's environment. For now the
custom shell profile only sets the prompt, but it will later
be used to influence the build environment.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
guests/tasks/users.yml | 17 +++++++++++++++++
guests/templates/bash_profile | 1 +
guests/templates/bashrc | 1 +
3 files changed, 19 insertions(+)
create mode 100644 guests/templates/bash_profile
create mode 100644 guests/templates/bashrc
diff --git a/guests/tasks/users.yml b/guests/tasks/users.yml
index 1ecacee..8e59fa9 100644
--- a/guests/tasks/users.yml
+++ b/guests/tasks/users.yml
@@ -82,3 +82,20 @@
owner: '{{ flavor }}'
group: '{{ flavor }}'
create: yes
+
+- name: '{{ flavor }}: Create shell profile'
+ template:
+ src: templates/{{ item }}
+ dest: /home/{{ flavor }}/.{{ item }}
+ owner: '{{ flavor }}'
+ group: '{{ flavor }}'
+ with_items:
+ - bash_profile
+ - bashrc
+
+- name: '{{ flavor }}: Remove existing shell profile'
+ file:
+ path: /home/{{ flavor }}/.{{ item }}
+ state: absent
+ with_items:
+ - profile
diff --git a/guests/templates/bash_profile b/guests/templates/bash_profile
new file mode 100644
index 0000000..a82a60e
--- /dev/null
+++ b/guests/templates/bash_profile
@@ -0,0 +1 @@
+test -f ~/.bashrc && . ~/.bashrc
diff --git a/guests/templates/bashrc b/guests/templates/bashrc
new file mode 100644
index 0000000..6640da6
--- /dev/null
+++ b/guests/templates/bashrc
@@ -0,0 +1 @@
+export PS1="[\u@\h \w]\$ "
I think that we should also load the system profile /etc/profile .. in
case of 'jenkins' flavor we don't actually need it since that is used in
automated tests but in case of 'test' flavor when developer will
manually login into the guests might miss some features configured by
thy system profile.
Pavel