Timo Aaltonen pushed to branch debian-unstable at X Strike Force / xorg


Commits:
6e2b340c by Josh Triplett at 2019-11-29T12:33:09-08:00
x11-common: Move has_option from 20x11-common_process-args to Xsession

Other scripts later in the Xsession.d series rely on has_option, so move
it to Xsession along with the other common functions.

- - - - -
d90b74e7 by Josh Triplett at 2019-11-29T12:36:56-08:00
x11-common: Support an Xsession.options.d directory

- - - - -


6 changed files:

- debian/changelog
- debian/local/Xsession
- debian/local/Xsession.d/20x11-common_process-args
- debian/local/Xsession.options.5
- + debian/local/Xsession.options.d.5
- debian/x11-common.manpages


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,12 @@
+xorg (1:7.7+21) unstable; urgency=medium
+
+  [ Josh Triplett ]
+  * Support /etc/X11/Xsession.options.d/*.conf in addition to
+    Xsession.options, allowing sysadmins to drop configuration snippets there
+    rather than editing /etc/X11/Xsession.options.
+
+ -- Josh Triplett <[email protected]>  Fri, 29 Nov 2019 12:34:43 -0800
+
 xorg (1:7.7+20) unstable; urgency=medium
 
   [ Julien Cristau ]


=====================================
debian/local/Xsession
=====================================
@@ -60,6 +60,24 @@ USERXSESSIONRC=$HOME/.xsessionrc
 ALTUSERXSESSION=$HOME/.Xsession
 ERRFILE=$HOME/.xsession-errors
 
+OPTIONS="$(
+  if [ -r "$OPTIONFILE" ]; then
+    cat "$OPTIONFILE"
+  fi
+  if [ -d /etc/X11/Xsession.options.d ]; then
+    run-parts --list --regex '\.conf$' /etc/X11/Xsession.options.d
+  fi
+)"
+
+has_option() {
+  # Ensure that a later no-foo overrides an earlier foo
+  if [ "$(echo "$OPTIONS" | grep -Eo "^(no-)?$1\>" | tail -n 1)" = "$1" ]; then
+    return 0
+  else
+    return 1
+  fi
+}
+
 # attempt to create an error file; abort if we cannot
 if (umask 077 && touch "$ERRFILE") 2> /dev/null && [ -w "$ERRFILE" ] &&
   [ ! -L "$ERRFILE" ]; then


=====================================
debian/local/Xsession.d/20x11-common_process-args
=====================================
@@ -2,18 +2,6 @@
 
 # This file is sourced by Xsession(5), not executed.
 
-# read OPTIONFILE
-OPTIONS=$(cat "$OPTIONFILE") || true
-
-has_option() {
-  if [ "${OPTIONS#*
-$1}" != "$OPTIONS" ]; then
-    return 0
-  else
-    return 1
-  fi
-}
-
 # Determine how many arguments were provided.
 case $# in
   0)


=====================================
debian/local/Xsession.options.5
=====================================
@@ -18,11 +18,11 @@
 .\" Suite 330, Boston, MA 02111-1307 USA
 .TH Xsession.options 5 "2004\-10\-31" "Debian Project"
 .SH NAME
-Xsession.options \- configuration options for
+Xsession.options, Xsession.options.d \- configuration options for
 .BR Xsession (5)
 .SH DESCRIPTION
-.I /etc/X11/Xsession.options
-contains a set of flags that determine some of the behavior of the
+\fI/etc/X11/Xsession.options\fR and \fI/etc/X11/Xsession.options.d/*.conf\fR
+contain options that determine some of the behavior of the
 .BR Xsession (5)
 Bourne shell
 .RB ( sh (1))
@@ -31,7 +31,7 @@ See the
 .BR Xsession (5)
 manpage for further information.
 .PP
-.I Xsession.options
+These configuration files
 may contain comments, which begin with a hash mark (\(oq#\(cq) and end at
 the next newline, just like comments in shell scripts.
 The rest of the file consists of options which are expressed as words
@@ -39,6 +39,11 @@ separated by hyphens, with only one option per line.
 Options are enabled by simply placing them in the file; they are disabled
 by prefixing the option name with \(oqno\-\(cq.
 .PP
+Options are read from \fI/etc/X11/Xsession.options\fR, followed by
+\fI/etc/X11/Xsession.options.d/*.conf\fR in sorted order; later occurrences of
+an option (with or without the \(oqno\-\(cq prefix) take precedence over 
earlier
+occurrences.
+.PP
 Available options are:
 .TP
 .B allow\-failsafe


=====================================
debian/local/Xsession.options.d.5
=====================================
@@ -0,0 +1 @@
+Xsession.options.5
\ No newline at end of file


=====================================
debian/x11-common.manpages
=====================================
@@ -1,2 +1,3 @@
 debian/local/Xsession.5
 debian/local/Xsession.options.5
+debian/local/Xsession.options.d.5



View it on GitLab: 
https://salsa.debian.org/xorg-team/xorg/-/compare/7f16c2cfae135be18089cc5cac1eae64b549a0fa...d90b74e78a5643890880fdc41e6a137a5dfbd8c7

-- 
View it on GitLab: 
https://salsa.debian.org/xorg-team/xorg/-/compare/7f16c2cfae135be18089cc5cac1eae64b549a0fa...d90b74e78a5643890880fdc41e6a137a5dfbd8c7
You're receiving this email because of your account on salsa.debian.org.


Reply via email to