xorg: Changes to 'debian-unstable'
debian/changelog | 16 +++++++--
debian/local/Xsession.d/20x11-common_process-args | 14 +++++++
debian/local/Xsession.d/30x11-common_xresources | 30 +++++++----------
debian/local/Xsession.d/50x11-common_determine-startup | 4 +-
debian/local/Xsession.d/90x11-common_ssh-agent | 2 -
5 files changed, 43 insertions(+), 23 deletions(-)
New commits:
commit c3a8249d58deeba4b9d163a768e792a1d044ce8b
Author: Brice Goglin <bgoglin@debian.org>
Date: Sun Mar 14 11:15:20 2010 +0100
Prepare changelog for upload
diff --git a/debian/changelog b/debian/changelog
index 442a8d6..7a58436 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-xorg (1:7.5+4) UNRELEASED; urgency=low
+xorg (1:7.5+4) unstable; urgency=low
* Add Xreset and Xreset.d support, closes: #230422.
* Improve startup speed of Xsession.d scripts by eliminating all unnecessary
@@ -12,7 +12,7 @@ xorg (1:7.5+4) UNRELEASED; urgency=low
unlikely (like "~/.Xresources exists") outside, to avoid running the
other tests (like "xrdb exists") on systems which don't use Xresources.
- -- Brice Goglin <bgoglin@debian.org> Sat, 06 Mar 2010 16:15:01 +0100
+ -- Brice Goglin <bgoglin@debian.org> Sun, 14 Mar 2010 11:15:07 +0100
xorg (1:7.5+3) unstable; urgency=low
commit f4928802701d1a2301ce3e92da015d9bf7ed5d65
Author: Brice Goglin <bgoglin@debian.org>
Date: Sun Mar 14 11:14:59 2010 +0100
Improve startup speed of Xsession.d scripts by eliminating all unnecessary external program calls
diff --git a/debian/changelog b/debian/changelog
index 0359056..442a8d6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,16 @@
xorg (1:7.5+4) UNRELEASED; urgency=low
* Add Xreset and Xreset.d support, closes: #230422.
+ * Improve startup speed of Xsession.d scripts by eliminating all unnecessary
+ external program calls, thanks Martin Pitt, closes: #570447.
+ - In 20x11-common_process-args, cat $OPTIONFILE once into a variable and
+ use POSIX variable substitution in all scripts instead of calling grep
+ for every single test.
+ - Use shell built in "type" instead of external "which" to test for
+ programs.
+ - 30x11-common_xresources: Swap the order of tests to keep the most
+ unlikely (like "~/.Xresources exists") outside, to avoid running the
+ other tests (like "xrdb exists") on systems which don't use Xresources.
-- Brice Goglin <bgoglin@debian.org> Sat, 06 Mar 2010 16:15:01 +0100
diff --git a/debian/local/Xsession.d/20x11-common_process-args b/debian/local/Xsession.d/20x11-common_process-args
index 53e7a7b..93e4653 100644
--- a/debian/local/Xsession.d/20x11-common_process-args
+++ b/debian/local/Xsession.d/20x11-common_process-args
@@ -2,6 +2,18 @@
# 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)
@@ -12,7 +24,7 @@ case $# in
case "$1" in
failsafe)
# Failsafe session was requested.
- if grep -qs ^allow-failsafe "$OPTIONFILE"; then
+ if has_option allow-failsafe; then
if [ -e /usr/bin/x-terminal-emulator ]; then
if [ -x /usr/bin/x-terminal-emulator ]; then
exec x-terminal-emulator -geometry +1+1
diff --git a/debian/local/Xsession.d/30x11-common_xresources b/debian/local/Xsession.d/30x11-common_xresources
index f9f6e13..c3f53a8 100644
--- a/debian/local/Xsession.d/30x11-common_xresources
+++ b/debian/local/Xsession.d/30x11-common_xresources
@@ -4,25 +4,23 @@
# If xrdb (from xbase-clients) is installed, merge system-wide X resources.
# Then merge the user's X resources, if the options file is so configured.
-if /usr/bin/which xrdb >/dev/null 2>&1; then
- if [ -d "$SYSRESOURCES" ]; then
- RESOURCEFILES=$(run-parts --list $SYSRESOURCES)
- if [ -n "$RESOURCEFILES" ]; then
- for RESOURCEFILE in $RESOURCEFILES; do
- xrdb -merge $RESOURCEFILE
- done
- fi
+if [ -d "$SYSRESOURCES" ] && type xrdb >/dev/null 2>&1; then
+ RESOURCEFILES=$(run-parts --list $SYSRESOURCES)
+ if [ -n "$RESOURCEFILES" ]; then
+ for RESOURCEFILE in $RESOURCEFILES; do
+ xrdb -merge $RESOURCEFILE
+ done
fi
+fi
- if grep -qs ^allow-user-resources "$OPTIONFILE"; then
- if [ -f "$USRRESOURCES" ]; then
- xrdb -merge $USRRESOURCES
- fi
+if has_option allow-user-resources && [ -f "$USRRESOURCES" ]; then
+ if type xrdb >/dev/null 2>&1; then
+ xrdb -merge $USRRESOURCES
+ else
+ # Comment out this command if you desire a legacy-free X environment, and find
+ # the warning spurious.
+ message "warning: xrdb command not found; X resources not merged."
fi
-else
- # Comment out this command if you desire a legacy-free X environment, and find
- # the warning spurious.
- message "warning: xrdb command not found; X resources not merged."
fi
# vim:set ai et sts=2 sw=2 tw=80:
diff --git a/debian/local/Xsession.d/50x11-common_determine-startup b/debian/local/Xsession.d/50x11-common_determine-startup
index 2a669a0..4ed7a32 100644
--- a/debian/local/Xsession.d/50x11-common_determine-startup
+++ b/debian/local/Xsession.d/50x11-common_determine-startup
@@ -7,7 +7,7 @@
# executable, fall back to looking for a user's custom X session script, if
# allowed by the options file.
if [ -z "$STARTUP" ]; then
- if grep -qs ^allow-user-xsession "$OPTIONFILE"; then
+ if has_option allow-user-session; then
for STARTUPFILE in "$USERXSESSION" "$ALTUSERXSESSION"; do
if [ -e "$STARTUPFILE" ]; then
if [ -x "$STARTUPFILE" ]; then
@@ -36,7 +36,7 @@ fi
# If we still have not found a startup program, give up.
if [ -z "$STARTUP" ]; then
ERRMSG="unable to start X session ---"
- if grep -qs ^allow-user-xsession "$OPTIONFILE"; then
+ if has_option allow-user-session; then
ERRMSG="$ERRMSG no \"$USERXSESSION\" file, no \"$ALTUSERXSESSION\" file,"
fi
errormsg "$ERRMSG no session managers, no window managers, and no terminal" \
diff --git a/debian/local/Xsession.d/90x11-common_ssh-agent b/debian/local/Xsession.d/90x11-common_ssh-agent
index 05a16c5..5397434 100644
--- a/debian/local/Xsession.d/90x11-common_ssh-agent
+++ b/debian/local/Xsession.d/90x11-common_ssh-agent
@@ -6,7 +6,7 @@ STARTSSH=
SSHAGENT=/usr/bin/ssh-agent
SSHAGENTARGS=
-if grep -qs ^use-ssh-agent "$OPTIONFILE"; then
+if has_option use-ssh-agent; then
if [ -x "$SSHAGENT" ] && [ -z "$SSH_AUTH_SOCK" ] \
&& [ -z "$SSH2_AUTH_SOCK" ]; then
STARTSSH=yes
Reply to: