[libvirt] [jenkins-ci PATCH 02/10] guests: Enable ~/.bashrc on FreeBSD

Andrea Bolognani posted 10 patches 7 years, 1 month ago
[libvirt] [jenkins-ci PATCH 02/10] guests: Enable ~/.bashrc on FreeBSD
Posted by Andrea Bolognani 7 years, 1 month ago
Due to the way bash is compiled on FreeBSD, we need to flip an
extra switch in order to convince it to process the shell profile
even when we're running commands non-interactively through ssh.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 guests/tasks/kludges.yml | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/guests/tasks/kludges.yml b/guests/tasks/kludges.yml
index 001b5c6..0196559 100644
--- a/guests/tasks/kludges.yml
+++ b/guests/tasks/kludges.yml
@@ -29,3 +29,21 @@
   when:
     - os_name == 'FreeBSD'
     - os_version == '11'
+
+# FreeBSD compiles bash without defining SSH_SOURCE_BASHRC, which means
+# it won't try to detect when it's spawned by ssh and source ~/.bashrc
+# when that's the case. Our workaround is setting $BASH_ENV globally
+- name: Enable ~/.bashrc
+  replace:
+    path: /etc/login.conf
+    regexp: '^(.*):setenv=(BASH_ENV=[^,]*,)?(.*):\\$'
+    replace: '\1:setenv=BASH_ENV=~/.bashrc,\3:\\'
+    validate: 'cap_mkdb %s'
+  register: loginconf
+  when:
+    - os_name == 'FreeBSD'
+
+- name: Enable ~/.bashrc
+  command: cap_mkdb /etc/login.conf
+  when:
+    - loginconf.changed
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [jenkins-ci PATCH 02/10] guests: Enable ~/.bashrc on FreeBSD
Posted by Pavel Hrdina 7 years, 1 month ago
On Thu, Apr 05, 2018 at 02:22:12PM +0200, Andrea Bolognani wrote:
> Due to the way bash is compiled on FreeBSD, we need to flip an
> extra switch in order to convince it to process the shell profile
> even when we're running commands non-interactively through ssh.
> 
> Signed-off-by: Andrea Bolognani <abologna@redhat.com>
> ---
>  guests/tasks/kludges.yml | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/guests/tasks/kludges.yml b/guests/tasks/kludges.yml
> index 001b5c6..0196559 100644
> --- a/guests/tasks/kludges.yml
> +++ b/guests/tasks/kludges.yml
> @@ -29,3 +29,21 @@
>    when:
>      - os_name == 'FreeBSD'
>      - os_version == '11'
> +
> +# FreeBSD compiles bash without defining SSH_SOURCE_BASHRC, which means
> +# it won't try to detect when it's spawned by ssh and source ~/.bashrc
> +# when that's the case. Our workaround is setting $BASH_ENV globally

s/globally/globally./

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list