[libvirt] [jenkins-ci PATCH 03/10] guests: Add custom shell profile

Andrea Bolognani abologna at redhat.com
Thu Apr 5 12:22:13 UTC 2018


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 at 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]\$ "
-- 
2.14.3




More information about the libvir-list mailing list