]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
config: Add profile script for fish shell
authorFrederik “Freso” S. Olesen <freso.dk@gmail.com>
Fri, 22 Mar 2024 17:21:04 +0000 (18:21 +0100)
committerMark Wielaard <mark@klomp.org>
Sun, 24 Mar 2024 16:50:44 +0000 (17:50 +0100)
Add support for setting $DEBUGINFOD_URLS automatically in the fish shell
similar to the profile scripts for POSIX and csh shells.

Makefile is set to install this into fish’s $XDG_DATA_DIRS vendor
directory instead of under /etc:
https://fishshell.com/docs/current/language.html#configuration-files

* config/profile.fish.in: Set $DEBUGINFOD_URLS in fish shells.
* configure.ac, config/Makefile.am: Include profile.fish in
  install and uninstall targets.

Signed-off-by: Frederik “Freso” S. Olesen <freso.dk@gmail.com>
config/Makefile.am
config/profile.fish.in [new file with mode: 0644]
configure.ac

index 0d3ba164ee3aefd377dcfe72a533c05c740db33f..ae14e625b726a3b16f0dfda0e3b1d19b043b54b5 100644 (file)
@@ -30,7 +30,8 @@
 ##
 EXTRA_DIST = elfutils.spec.in known-dwarf.awk 10-default-yama-scope.conf \
             libelf.pc.in libdw.pc.in libdebuginfod.pc.in \
-            debuginfod.service debuginfod.sysconfig profile.sh.in profile.csh.in
+            debuginfod.service debuginfod.sysconfig \
+            profile.sh.in profile.csh.in profile.fish.in
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libelf.pc libdw.pc
@@ -40,6 +41,7 @@ pkgconfig_DATA += libdebuginfod.pc
 install-data-local:
        $(INSTALL_DATA) profile.sh -D $(DESTDIR)$(sysconfdir)/profile.d/debuginfod.sh
        $(INSTALL_DATA) profile.csh -D $(DESTDIR)$(sysconfdir)/profile.d/debuginfod.csh
+       $(INSTALL_DATA) profile.fish -D $(DESTDIR)$(datadir)/fish/vendor_conf.d/debuginfod.fish
        mkdir -p $(DESTDIR)$(sysconfdir)/debuginfod
        if [ -n "@DEBUGINFOD_URLS@" ]; then \
                echo "@DEBUGINFOD_URLS@" > $(DESTDIR)$(sysconfdir)/debuginfod/elfutils.urls; \
@@ -48,6 +50,7 @@ install-data-local:
 uninstall-local:
        rm -f $(DESTDIR)$(sysconfdir)/profile.d/debuginfod.sh
        rm -f $(DESTDIR)$(sysconfdir)/profile.d/debuginfod.csh
+       rm -f $(DESTDIR)$(datadir)/fish/vendor_conf.d/debuginfod.fish
        rm -f $(DESTDIR)$(sysconfdir)/debuginfod/elfutils.urls
        -rmdir $(DESTDIR)$(sysconfdir)/debuginfod
 endif
diff --git a/config/profile.fish.in b/config/profile.fish.in
new file mode 100644 (file)
index 0000000..00e9ca5
--- /dev/null
@@ -0,0 +1,14 @@
+# $HOME/.profile* or similar files may first set $DEBUGINFOD_URLS.
+# If $DEBUGINFOD_URLS is not set there, we set it from system *.url files.
+# $HOME/.*rc or similar files may then amend $DEBUGINFOD_URLS.
+# See also [man debuginfod-client-config] for other environment variables
+# such as $DEBUGINFOD_MAXSIZE, $DEBUGINFOD_MAXTIME, $DEBUGINFOD_PROGRESS.
+
+if not set --query DEBUGINFOD_URLS
+    # Use local variables so we don't need to manually unset them
+    set --local prefix "@prefix@"
+    set --local DEBUGINFOD_URLS (cat /dev/null "@sysconfdir@/debuginfod"/*.urls 2>/dev/null | string replace '\n' ' ')
+    if test -n "$DEBUGINFOD_URLS"
+        set --global --export DEBUGINFOD_URLS "$DEBUGINFOD_URLS"
+    end
+end
index 098d13067ee6265b3893e2953efc6cc10fed297c..a279bb5282c900a6c0667a20f83e7222fbd2ad57 100644 (file)
@@ -881,7 +881,7 @@ AC_ARG_ENABLE(debuginfod-urls,
              fi],
             [default_debuginfod_urls=""])
 AC_SUBST(DEBUGINFOD_URLS, $default_debuginfod_urls)                
-AC_CONFIG_FILES([config/profile.sh config/profile.csh])
+AC_CONFIG_FILES([config/profile.sh config/profile.csh config/profile.fish])
 
 AC_OUTPUT