[gcr/wip/dueno/ssh-agent] gcr-ssh-agent: Install profile.d file to set SSH_AUTH_SOCK



commit 281aeb61ff4c74f829cb64638369d940cdbd5359
Author: Daiki Ueno <dueno src gnome org>
Date:   Sun Feb 14 08:06:00 2021 +0100

    gcr-ssh-agent: Install profile.d file to set SSH_AUTH_SOCK

 gcr/gcr-ssh-agent.sh | 5 +++++
 gcr/meson.build      | 3 +++
 meson.build          | 5 +++++
 meson_options.txt    | 5 +++++
 4 files changed, 18 insertions(+)
---
diff --git a/gcr/gcr-ssh-agent.sh b/gcr/gcr-ssh-agent.sh
new file mode 100644
index 0000000..b7c82fa
--- /dev/null
+++ b/gcr/gcr-ssh-agent.sh
@@ -0,0 +1,5 @@
+if test -z "${SSH_AUTH_SOCK+set}" && test -e "$XDG_RUNTIME_DIR/gcr/ssh"; then
+       SSH_AUTH_SOCK=$XDG_RUNTIME_DIR/gcr/ssh
+       export SSH_AUTH_SOCK
+fi
+
diff --git a/gcr/meson.build b/gcr/meson.build
index 7a3b69a..f450daa 100644
--- a/gcr/meson.build
+++ b/gcr/meson.build
@@ -273,6 +273,9 @@ if get_option('ssh_agent')
                 install_dir: systemduserunitdir)
   endif
 
+  install_data('gcr-ssh-agent.sh',
+              install_dir: profile_dir)
+
   gcr_ssh_agent_test_cflags = [
     '-DSRCDIR="@0@"'.format(source_root),
     '-D_GCR_TEST_SSH_ASKPASS_PATH="@0@"'.format(gcr_ssh_askpass.full_path()),
diff --git a/meson.build b/meson.build
index fa0e3a0..8b0f7e9 100644
--- a/meson.build
+++ b/meson.build
@@ -65,6 +65,11 @@ if libsystemd.found() and systemd.found()
   with_systemd = true
 endif
 
+profile_dir = get_option('profile_dir')
+if profile_dir == ''
+  profile_dir = gcr_prefix / get_option('sysconfdir') / 'profile.d'
+endif
+
 if get_option('gtk')
   gtk_min_version = '3.22'
   gtk_dep = dependency('gtk+-3.0', version: '>=' + gtk_min_version)
diff --git a/meson_options.txt b/meson_options.txt
index f96a47c..df1fdd0 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -28,3 +28,8 @@ option('systemd',
   value: 'auto',
   description: 'Use systemd socket activation for server programs'
 )
+option('profile_dir',
+  type: 'string',
+  value: '',
+  description: 'Path to profile.d files, default is SYSCONFDIR/profile.d'
+)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]