[28255] in Source-Commits

home help back first fref pref prev next nref lref last post

dconf-config commit: Initial check-in of dconf-config

daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Mon Jun 16 15:43:45 2014

Date: Mon, 16 Jun 2014 15:43:39 -0400
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201406161943.s5GJhdUR008344@drugstore.mit.edu>
To: source-commits@MIT.EDU

https://github.com/mit-athena/dconf-config/commit/bdde42c7ba8495a6acf96e2b834e2f560546b468
commit bdde42c7ba8495a6acf96e2b834e2f560546b468
Author: Jonathan Reed <jdreed@mit.edu>
Date:   Mon Jun 16 15:42:56 2014 -0400

    Initial check-in of dconf-config
    
    This is debathena-dconf-config, a package designed to enforce
    per-distro dconf user profiles, to avoid issues of
    backwards-incompatibility.

 debian/10debathena-copy-dconf          |   50 ++++++++++++++++++++++++++++++++
 debian/README                          |   21 +++++++++++++
 debian/changelog                       |    5 +++
 debian/compat                          |    1 +
 debian/control                         |   18 +++++++++++
 debian/copyright                       |   31 +++++++++++++++++++
 debian/debathena-dconf-config.dirs     |    2 +
 debian/debathena-dconf-config.docs     |    1 +
 debian/debathena-dconf-config.install  |    1 +
 debian/debathena-dconf-config.postinst |   40 +++++++++++++++++++++++++
 debian/generate_dconf_user.sh          |   13 ++++++++
 debian/rules                           |    9 ++++++
 12 files changed, 192 insertions(+), 0 deletions(-)

diff --git a/debian/10debathena-copy-dconf b/debian/10debathena-copy-dconf
new file mode 100644
index 0000000..adfd58c
--- /dev/null
+++ b/debian/10debathena-copy-dconf
@@ -0,0 +1,50 @@
+# Specify an alternate DConf profile for AFS homedirs, that incorporates
+# the release codename, to avoid backwards compatibility issues.
+#
+# See /usr/share/doc/debathena-dconf-config/README for more information.
+
+find_candidates() {
+    DISTROS=$(distro-info --all)
+    CANDIDATES=
+    for s in $DISTROS; do
+	# Do not consider anything that is newer than the current release
+	if [ "$(lsb_release -sc)" = "$s" ]; then
+	    break
+	fi
+	CANDIDATES="$CANDIDATES $s"
+    done
+}
+
+get_user_dconf_profile() {
+    profile=
+    if [ -f "/etc/dconf/profile/user" ]; then
+	profile=$(awk -F: '/^user-db/ { print $2}' /etc/dconf/profile/user)
+    fi
+    USER_PROFILE="${profile:-user}"
+}
+
+ATHENA_DCONF_PROFILE=/etc/dconf/profile/athena_user
+PROFILE_DIR=${XDG_CONFIG_HOME:-"$HOME/.config"}/dconf
+if [ -f "$ATHENA_DCONF_PROFILE" ] && \
+    [ "$DEBATHENA_HOME_TYPE" = afs ] && \
+    ! [ -e "$HOME/.config/debathena/skip_dconf_config" ]; then
+    dbname="user_$(lsb_release -sc)"
+    if ! [ -e "$PROFILE_DIR/$dbname" ]; then
+	find_candidates
+	copied=0
+	for c in $CANDIDATES; do
+	    if [ -f "$PROFILE_DIR/user_$c" ]; then
+		cp "$PROFILE_DIR/user_$c" "$PROFILE_DIR/$dbname"
+		copied=1
+		break
+	    fi
+	done
+	if [ $copied -eq 0 ]; then
+	    get_user_dconf_profile
+	    if [ -f "$PROFILE_DIR/$USER_PROFILE" ]; then
+		cp "$PROFILE_DIR/$USER_PROFILE" "$PROFILE_DIR/$dbname"
+	    fi
+	fi
+    fi
+    export DCONF_PROFILE=athena_user
+fi
diff --git a/debian/README b/debian/README
new file mode 100644
index 0000000..69e2be9
--- /dev/null
+++ b/debian/README
@@ -0,0 +1,21 @@
+DConf profiles on Debathena
+
+Debathena ships a DConf profile named "athena_user", which is intended
+largely to mirror the existing "user" profile, as well as include some
+Athena default settings.  It also specifies a new user-db entry named
+"user.$CODENAME" where $CODENAME is the output of "lsb_release -sc".
+Therefore, there will be separate dconf user profiles for precise,
+trusty, etc.  These are populated from a previous profile on first login
+to the new distribution, or from the default profile ("user") if no
+previous Athena ones are available.
+
+If you wish to manage your DConf profile manually, you should create the
+file ".config/debathena/skip_dconf_config".  You can then set
+DCONF_PROFILE as you please.  Note that unless you take special action,
+you may suffer from backwards compatibility problems if you log in to an
+older release using the DConf profile from a newer release.  (At the
+time of this writing, the Unity Launcher is known to misbehave.)
+
+For more information on DConf, see:
+- https://wiki.gnome.org/Projects/dconf
+- https://wiki.gnome.org/Projects/dconf/SystemAdministrators
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..1b33ade
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+debathena-dconf-config (1.0) unstable; urgency=low
+
+  * Initial release.
+
+ -- Jonathan Reed <jdreed@mit.edu>  Fri, 13 Jun 2014 16:28:37 -0400
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..7f8f011
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+7
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..dc6e414
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,18 @@
+Source: debathena-dconf-config
+Section: debathena-config/gnome
+Priority: extra
+Maintainer: Debathena Project <debathena@mit.edu>
+Build-Depends: debhelper (>= 7.0.50~), lsb-release
+Standards-Version: 3.9.3
+
+Package: debathena-dconf-config
+Architecture: all
+Depends: dconf-cli | dconf-tools,
+	 lsb-release,
+	 distro-info,
+	 ${misc:Depends}
+Description: Dconf configuration for Debathena
+ This package installs a dconf user profile that includes the distro
+ codename, to enforce per-distro configurations, and workaround
+ backwards-incompatibilities.  It also includes an Xsession.d snippet
+ to enable this profile for people with AFS home directories.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..e4ab34a
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,31 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+
+Files: *
+Copyright: (c) 2014 Massachusetts Institute of Technology
+License: BSD-3-clause
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above
+      copyright notice, this list of conditions and the following
+      disclaimer in the documentation and/or other materials provided
+      with the distribution.
+    * Neither the name of the Massachusetts Institute of Technology
+      nor the names of its contributors may be used to endorse or
+      promote products derived from this software without specific
+      prior written permission.
+ .
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MASSACHUSETTS
+ INSTITUTE OF TECHNOLOGY BE LIABLE FOR ANY DIRECT, INDIRECT,
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGE.
diff --git a/debian/debathena-dconf-config.dirs b/debian/debathena-dconf-config.dirs
new file mode 100644
index 0000000..9aa18a7
--- /dev/null
+++ b/debian/debathena-dconf-config.dirs
@@ -0,0 +1,2 @@
+etc/dconf/db/athena.d
+etc/dconf/db/athena.d/locks
diff --git a/debian/debathena-dconf-config.docs b/debian/debathena-dconf-config.docs
new file mode 100644
index 0000000..df6f1f3
--- /dev/null
+++ b/debian/debathena-dconf-config.docs
@@ -0,0 +1 @@
+debian/README
diff --git a/debian/debathena-dconf-config.install b/debian/debathena-dconf-config.install
new file mode 100644
index 0000000..8967b70
--- /dev/null
+++ b/debian/debathena-dconf-config.install
@@ -0,0 +1 @@
+debian/10debathena-copy-dconf etc/X11/Xsession.d
diff --git a/debian/debathena-dconf-config.postinst b/debian/debathena-dconf-config.postinst
new file mode 100644
index 0000000..51b4be1
--- /dev/null
+++ b/debian/debathena-dconf-config.postinst
@@ -0,0 +1,40 @@
+#!/bin/sh
+# postinst script for debathena-dconf-config
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <postinst> `abort-remove'
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    configure)
+	dconf update
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/generate_dconf_user.sh b/debian/generate_dconf_user.sh
new file mode 100755
index 0000000..736b8a5
--- /dev/null
+++ b/debian/generate_dconf_user.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+user_db="user"
+codename=$(lsb_release -sc 2>/dev/null)
+if [ -n "$codename" ]; then
+    # Profile names may only contain [[:alnum:]] and '_'
+    user_db="user_${codename}"
+fi
+
+cat <<EOF
+user-db:${user_db}
+system-db:athena
+EOF
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..ff5aae8
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,9 @@
+#!/usr/bin/make -f
+
+%:
+	dh $@
+
+override_dh_install:
+	dh_install
+	mkdir -p debian/debathena-dconf-config/etc/dconf/profile
+	debian/generate_dconf_user.sh > debian/debathena-dconf-config/etc/dconf/profile/athena_user

home help back first fref pref prev next nref lref last post