Commit 25004e4d authored by Ray Strode's avatar Ray Strode

data: change the way we do dconf

We currently generate a complete, binary dconf database
as part of the install process.

In general, system administrators can change dconf
settings system-wide using a mechanism described here:

https://live.gnome.org/dconf/SystemAdministrators

Unfortunately, because of the way we generate our database,
any administrator overrides will get discarded during
package upgrade, and likewise, our carefully vetted database
will get destroyed on any site administrator updates.

Rather than step on each others toes, this commit changes
GDM to use the same mechanism described above.  This should
make upstream defaults and system defaults coexist much
better.

Note, the mechanism used isn't quite as featureful as we
would really like.  It doesn't support wildcards or changing
whole subtrees at a time.  That means, in theory, if a new
plugin gets added to settings daemon it could be marked active
at the login screen without being vetted first.

To circumvent this, we add a layer of indirection in and some
gross shell scripting to give us the features we need.

Distributions should probably run

/usr/libexec/gdm-update-dconf-db \
	gdm \
	/usr/share/gdm/upstream-settings \
	00-upstream-settings

In there post transaction hooks, but at a minimum need to run
dconf update.
parent e6dad812
......@@ -17,11 +17,6 @@ PKG_NAME="GDM"
exit 1
}
(cd $srcdir/data/ ; ./make-dconf-override-db.sh) || {
echo "**Error**: Script "\`$srcdir/data/make-dconf-override-db.sh\'" failed"
exit 1
}
which gnome-autogen.sh || {
echo "You need to install gnome-common from the GNOME SVN"
exit 1
......
......@@ -88,6 +88,12 @@ localealias_DATA = locale.alias
sessiondir = $(datadir)/gnome-session/sessions
session_DATA = gdm-fallback.session gdm-shell.session
settingsdir = $(datadir)/gdm
settings_DATA = $(srcdir)/upstream-settings
dconfthingdir = $(libexecdir)
dconfthing_SCRIPTS = $(srcdir)/gdm-update-dconf-db
EXTRA_DIST = \
$(schemas_in_files) \
$(schemas_DATA) \
......@@ -107,8 +113,9 @@ EXTRA_DIST = \
gconf.path \
session-setup.entries \
gdm-shell.session.in \
make-dconf-override-db.sh \
gdm-update-dconf-db \
dconf-profile \
upstream-settings \
org.gnome.login-screen.gschema.xml.in \
$(NULL)
......@@ -118,7 +125,6 @@ CLEANFILES = \
Init \
PreSession \
PostSession \
dconf-override-db \
$(gsettings_SCHEMAS) \
$(NULL)
......@@ -126,19 +132,18 @@ DISTCLEANFILES = \
$(dbusconf_DATA) \
gdm-shell.session \
gdm.schemas \
dconf-override-db \
$(NULL)
MAINTAINERCLEANFILES = \
*~ \
dconf-override-db \
Makefile.in
dconf-override-db: $(srcdir)/make-dconf-override-db.sh
$(srcdir)/make-dconf-override-db.sh
00-upstream-settings 00-upstream-settings-locks: $(srcdir)/gdm-update-dconf-db
$(srcdir)/gdm-update-dconf-db $(srcdir)/upstream-settings 00-upstream-settings
dist-hook: $(srcdir)/dconf-override-db
cp $(srcdir)/dconf-override-db $(distdir)
dist-hook:
cp $(srcdir)/00-upstream-settings $(distdir)
cp $(srcdir)/00-upstream-settings-locks $(distdir)
uninstall-hook:
rm -f \
......@@ -155,6 +160,7 @@ uninstall-hook:
$(DESTDIR)$(sysconfdir)/dconf/db/gdm \
$(DESTDIR)$(sysconfdir)/dconf/profile/gdm \
-rf \
$(DESTDIR)$(sysconfdir)/dconf/db/gdm.d \
$(DESTDIR)$(workingdir)/.gconf.mandatory \
$(DESTDIR)$(workingdir)/.config/dconf \
$(DESTDIR)$(screenshotdir) \
......@@ -166,7 +172,7 @@ uninstall-hook:
$(DESTDIR)$(sysconfdir)/dconf/db \
$(DESTDIR)$(sysconfdir)/dconf
install-data-hook: gdm.conf-custom Xsession Init PostSession PreSession gconf.path dconf-override-db
install-data-hook: gdm.conf-custom Xsession Init PostSession PreSession gconf.path 00-upstream-settings 00-upstream-settings-locks
if test '!' -d $(DESTDIR)$(gdmconfdir); then \
$(mkinstalldirs) $(DESTDIR)$(gdmconfdir); \
chmod 755 $(DESTDIR)$(gdmconfdir); \
......@@ -310,5 +316,7 @@ install-data-hook: gdm.conf-custom Xsession Init PostSession PreSession gconf.pa
chmod 1750 $(DESTDIR)$(workingdir)/.gconf.mandatory
chmod 1640 $(DESTDIR)$(workingdir)/.gconf.mandatory/*.xml
$(INSTALL_DATA) $(srcdir)/dconf-override-db $(DESTDIR)$(sysconfdir)/dconf/db/gdm
$(INSTALL_DATA) $(srcdir)/dconf-profile $(DESTDIR)$(sysconfdir)/dconf/profile/gdm
$(INSTALL_DATA) $(srcdir)/00-upstream-settings $(DESTDIR)$(sysconfdir)/dconf/db/gdm.d
$(INSTALL_DATA) $(srcdir)/00-upstream-settings-locks $(DESTDIR)$(sysconfdir)/dconf/db/gdm.d/locks
dconf update || :
#!/bin/bash
DCONFDIR="/etc/dconf"
set -e
if [ $# -ne 2 ] && [ $# -ne 3 ]; then
echo "$0 [profile] input-filename output-name" > /dev/stderr
exit 1
fi
if [ $# -eq 3 ]; then
PROFILE="$1"
shift
fi
INPUT_FILENAME="$1"
OUTPUT_NAME="$2"
if [ -n $PROFILE ] && [ ! -e ${DCONFDIR}/profile/$PROFILE ]; then
echo "'$PROFILE' is not valid dconf profile" > /dev/stderr
exit 1
fi
eval `dbus-launch --sh-syntax`
trap 'kill $DBUS_SESSION_BUS_PID' ERR
declare -A ENTRIES
declare -a UNMATCHED_LINES
OLD_IFS="$IFS"
IFS="
"
FILE=( $(cat "$INPUT_FILENAME") )
IFS=$OLD_IFS
for line in "${FILE[@]}"
do
echo "$line" | egrep -q '^#' && continue
SCHEMA_PATTERN=$(echo "$line" | awk '{ print $1 }')
KEY_PATTERN=$(echo "$line" | awk '{ print $2 }' | awk -F= '{print $1}')
VALUE=$(echo "$line" | awk '{ print $2 }' | awk -F= '{print $2}')
SCHEMAS=( $(gsettings list-schemas | egrep -x "$SCHEMA_PATTERN"; true ) )
[ "${#SCHEMAS}" -eq 0 ] && continue;
NUM_ENTRIES=0
IS_STRING=0
IS_BOOL=0
IS_NUMBER=0
case "${VALUE:0:1}" in
'"'|"'")
IS_STRING=1
;;
t|T|f|F)
IS_BOOL=1
;;
*)
IS_NUMBER=1
;;
esac
for schema in "${SCHEMAS[@]}"
do
KEYS=( $(gsettings list-keys "$schema" | egrep -x "$KEY_PATTERN"; true) )
for key in "${KEYS[@]}"
do
OLD_IFS="$IFS"
IFS="
"
KEY_TYPE=( $(gsettings range $schema $key) )
IFS="$OLD_IFS"
if [ "${KEY_TYPE[0]}" = 'enum' ]; then
continue;
fi
TYPE="${KEY_TYPE[0]#type }"
case "$TYPE" in
b)
if [ $IS_BOOL -eq 1 ]; then
ENTRIES["$schema $key"]="$VALUE"
NUM_ENTRIES=$(($NUM_ENTRIES + 1))
fi
;;
s|ay)
if [ $IS_STRING -eq 1 ]; then
ENTRIES["$schema $key"]="$VALUE"
NUM_ENTRIES=$(($NUM_ENTRIES + 1))
fi
;;
i|u|q|d|t)
if [ $IS_NUMBER -eq 1 ]; then
ENTRIES["$schema $key"]="$VALUE"
NUM_ENTRIES=$(($NUM_ENTRIES + 1))
fi
;;
*)
;;
esac
done
done
if [ $NUM_ENTRIES -lt 1 ]; then
UNMATCHED_LINES[${#UNMATCHED_LINES[@]}]="$line"
fi
done
OLD_IFS="$IFS"
IFS="
"
ENTRY_KEYS=( $(for entry in "${!ENTRIES[@]}"; do echo "$entry" ; done | sort ) )
IFS="$OLD_IFS"
TMPFILE="$(mktemp)"
TMPLOCKFILE="$(mktemp)"
cat << EOF > $TMPFILE
# This file is auto-generated from a file called '$(basename $INPUT_FILENAME)'.
#
# Please don't modify this file directly. Instead create your own file next
# to it with a higher numbered prefix.
$(if [ "${#UNMATCHED_LINES[@]}" -gt 0 ]; then
echo "#"
echo "# Note, the following lines could not be matched to any known"
echo "# settings:"
echo "#"
for line in "${UNMATCHED_LINES[@]}"
do
echo "# $line"
done
echo "#"
fi)
$(OLD_SCHEMA=""
for entry in "${ENTRY_KEYS[@]}"
do
SCHEMA="$(echo $entry | awk '{print $1}')"
KEY="$(echo $entry | awk '{print $2}')"
VALUE="${ENTRIES[$entry]}"
if [ "$OLD_SCHEMA" != "$SCHEMA" ]; then
echo
echo "[$(echo $SCHEMA | sed 's@\.@/@g')]"
OLD_SCHEMA="$SCHEMA"
fi
echo "$KEY=$VALUE"
done)
EOF
for entry in "${ENTRY_KEYS[@]}"
do
SCHEMA="$(echo $entry | awk '{print $1}')"
KEY="$(echo $entry | awk '{print $2}')"
echo "/$(echo $SCHEMA | sed 's@\.@/@g')/$KEY" >> $TMPLOCKFILE
done
if [ -n "${PROFILE}" ]; then
mkdir -p ${DCONFDIR}/db/${PROFILE}.d/locks
install -m 644 $TMPLOCKFILE ${DCONFDIR}/db/${PROFILE}.d/locks/${OUTPUT_NAME}-locks
install -m 644 $TMPFILE ${DCONFDIR}/db/${PROFILE}.d/${OUTPUT_NAME}
rm -f $TMPLOCKFILE $TMPFILE
dconf update
else
chmod 644 $TMPLOCKFILE $TMPFILE
mv $TMPLOCKFILE ${OUTPUT_NAME}-locks
mv $TMPFILE ${OUTPUT_NAME}
fi
kill $DBUS_SESSION_BUS_PID
#!/bin/bash
set -e
export TMPDIR=$(mktemp -d --tmpdir="$PWD")
export XDG_CONFIG_HOME="$TMPDIR/config"
export XDG_CACHE_HOME="$TMPDIR/cache"
mkdir -p $XDG_CONFIG_HOME $XDG_CACHE_HOME
eval `dbus-launch --sh-syntax`
trap 'rm -rf $TMPDIR; kill $DBUS_SESSION_BUS_PID' ERR
gsettings set org.gnome.power-manager show-actions false || :
gsettings set org.gnome.desktop.a11y.keyboard enable true
gsettings set org.gnome.desktop.background show-desktop-icons false
gsettings set org.gnome.desktop.default-applications.terminal exec '"/bin/true"'
gsettings set org.gnome.desktop.interface toolkit-accessibility true
gsettings set org.gnome.desktop.lockdown disable-application-handlers true
gsettings set org.gnome.desktop.lockdown disable-command-line true
gsettings set org.gnome.desktop.lockdown disable-lock-screen true
gsettings set org.gnome.desktop.lockdown disable-print-setup true
gsettings set org.gnome.desktop.lockdown disable-printing true
gsettings set org.gnome.desktop.lockdown disable-save-to-disk true
gsettings set org.gnome.desktop.session session-name '"gdm-shell"'
gsettings set org.gnome.desktop.sound event-sounds true
gsettings set org.gnome.settings-daemon.plugins.media-keys eject '""'
gsettings set org.gnome.settings-daemon.plugins.media-keys calculator '""'
gsettings set org.gnome.settings-daemon.plugins.media-keys email '""'
gsettings set org.gnome.settings-daemon.plugins.media-keys help '""'
gsettings set org.gnome.settings-daemon.plugins.media-keys home '""'
gsettings set org.gnome.settings-daemon.plugins.media-keys media '""'
gsettings set org.gnome.settings-daemon.plugins.media-keys next '""'
gsettings set org.gnome.settings-daemon.plugins.media-keys pause '""'
gsettings set org.gnome.settings-daemon.plugins.media-keys play '""'
gsettings set org.gnome.settings-daemon.plugins.media-keys previous '""'
gsettings set org.gnome.settings-daemon.plugins.media-keys screensaver '""'
gsettings set org.gnome.settings-daemon.plugins.media-keys search '""'
gsettings set org.gnome.settings-daemon.plugins.media-keys stop '""'
gsettings set org.gnome.settings-daemon.plugins.media-keys www '""'
gsettings list-schemas | egrep '^org\.gnome\.settings-daemon\.plugins\.' | while read schema; do
gsettings set $schema active false
done
gsettings set org.gnome.settings-daemon.plugins.a11y-keyboard active true
gsettings set org.gnome.settings-daemon.plugins.background active true
gsettings set org.gnome.settings-daemon.plugins.cursor active true
gsettings set org.gnome.settings-daemon.plugins.media-keys active true
gsettings set org.gnome.settings-daemon.plugins.orientation active true
gsettings set org.gnome.settings-daemon.plugins.power active true
gsettings set org.gnome.settings-daemon.plugins.sound active true
gsettings set org.gnome.settings-daemon.plugins.xrandr active true
gsettings set org.gnome.settings-daemon.plugins.xsettings active true
mv $XDG_CONFIG_HOME/dconf/user dconf-override-db
rm -rf $TMPDIR
kill $DBUS_SESSION_BUS_PID
# Accessibility
org.gnome.desktop.a11y.keyboard enable=true
org.gnome.desktop.interface toolkit-accessibility=true
org.gnome.desktop.sound event-sounds=true
# Session (needs to be gdm-shell or gdm-fallback)
org.gnome.desktop.session session-name='gdm-shell'
# Lockdown
org.gnome.desktop.default-applications.terminal exec='/bin/true'
org.gnome.desktop.lockdown .*=true
org.gnome.desktop.lockdown disable-log-out=false
org.gnome.settings-daemon.plugins.media-keys eject=''
org.gnome.settings-daemon.plugins.media-keys calculator=''
org.gnome.settings-daemon.plugins.media-keys email=''
org.gnome.settings-daemon.plugins.media-keys help=''
org.gnome.settings-daemon.plugins.media-keys home=''
org.gnome.settings-daemon.plugins.media-keys media=''
org.gnome.settings-daemon.plugins.media-keys next=''
org.gnome.settings-daemon.plugins.media-keys pause=''
org.gnome.settings-daemon.plugins.media-keys play=''
org.gnome.settings-daemon.plugins.media-keys previous=''
org.gnome.settings-daemon.plugins.media-keys screensaver=''
org.gnome.settings-daemon.plugins.media-keys search=''
org.gnome.settings-daemon.plugins.media-keys stop=''
org.gnome.settings-daemon.plugins.media-keys www=''
org.gnome.settings-daemon.plugins..* active=false
org.gnome.settings-daemon.plugins.a11y-keyboard active=true
org.gnome.settings-daemon.plugins.background active=true
org.gnome.settings-daemon.plugins.cursor active=true
org.gnome.settings-daemon.plugins.media-keys active=true
org.gnome.settings-daemon.plugins.orientation active=true
org.gnome.settings-daemon.plugins.power active=true
org.gnome.settings-daemon.plugins.sound active=true
org.gnome.settings-daemon.plugins.xrandr active=true
org.gnome.settings-daemon.plugins.xsettings active=true
# Legacy
org.gnome.desktop.background show-desktop-icons=false
org.gnome.power-manager show-actions=false
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment