#!/bin/sh
#
# /etc/X11/Xstartup the same as /etc/X11/Xreset
#
# global Xstartup file -- for use by display managers


set -e

PROGNAME=Xstartup
SYSSESSIONDIR=/etc/X11/Xstartup.d

if [ ! -d "$SYSSESSIONDIR" ]; then
  # Nothing to do, exiting
  exit 0
fi

# use run-parts to source every file in the session directory; we source
# instead of executing so that the variables and functions defined above
# are available to the scripts, and so that they can pass variables to each
# other
SESSIONFILES=$(run-parts --list $SYSSESSIONDIR)
if [ -n "$SESSIONFILES" ]; then
  set +e
  for SESSIONFILE in $SESSIONFILES; do
    . $SESSIONFILE
  done
  set -e
fi

exit 0
