From: Ben Hutchings Date: Mon, 9 Jul 2007 01:27:18 +0000 (+0000) Subject: Added modular configuration mechanism. X-Git-Tag: 20070708-1~2 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=a33db24c701fe232639d904f934f68818393f95e;p=ion3.git Added modular configuration mechanism. --- diff --git a/debian/README b/debian/README index 8d97835..7476773 100644 --- a/debian/README +++ b/debian/README @@ -56,3 +56,12 @@ in your X session and this in your Ion3 configuration: ... template="... %systray_dock" } + +Adding configuration files to the defaults + +Ion3 extension packages may add and remove configuration files to +those included by cfg_defaults.lua. The configuration files must be +installed under /etc/X11/ion3. Run "install-ion3-cfg cfg_foo" in the +postinst script to add the configuration file +/etc/X11/ion3/cfg_foo.lua. Run "install-ion3-cfg --remove cfg_foo" in +the prerm script to remove it. diff --git a/debian/install-ion3-cfg b/debian/install-ion3-cfg new file mode 100755 index 0000000..9fab5bc --- /dev/null +++ b/debian/install-ion3-cfg @@ -0,0 +1,56 @@ +#!/bin/bash + +set -e + +usage() { + echo >&2 "Usage: install-ion3-cfg [--remove] config-basename" +} + +config_dir=/etc/X11/ion3 +config_list=$config_dir/cfg_debian_ext.lua + +action=add + +while true; do + case "$1" in + -h|--help) + usage + exit 0 + ;; + --remove) + action=remove + ;; + -*) + usage + exit 2 + ;; + *) + break + ;; + esac + shift +done + +if [ $# -ne 1 ]; then + usage + exit 2 +fi + +name="$1" + +case $action in + add) + if ! [ -f "$config_dir/$name.lua" ]; then + echo >&2 "$config_dir/$name.lua does not exist!" + exit 2 + fi + if ! egrep -q "^ *dopath *\\( *\"$name\" *\\) *\$" \ + "$config_list"; then + echo "dopath(\"$name\")" >> "$config_list" + fi + ;; + remove) + sed -i -r -e "/^ *dopath *\\( *\"$name\" *\\) *\$/d" \ + "$config_list" + ;; +esac diff --git a/debian/ion3.install b/debian/ion3.install index 3aafa3c..ba93f6d 100644 --- a/debian/ion3.install +++ b/debian/ion3.install @@ -2,3 +2,4 @@ debian/ion3.desktop debian/pwm3.desktop usr/share/xsessions debian/default etc debian/overrides/ion3 usr/share/lintian/overrides debian/watch usr/share/ion3/debian +debian/install-ion3-cfg usr/sbin diff --git a/debian/ion3.postinst b/debian/ion3.postinst index f8e8fd9..bfa5718 100644 --- a/debian/ion3.postinst +++ b/debian/ion3.postinst @@ -67,6 +67,9 @@ if [ -f $inst ]; then chmod a+x $inst fi +# Initialise extra configuration file list if missing +[ -f /etc/X11/ion3/cfg_debian_ext.lua ] || >/etc/X11/ion3/cfg_debian_ext.lua + #DEBHELPER# # Remove the old now-renamed generated Debian menu diff --git a/debian/patches/00list b/debian/patches/00list index 24d4144..2b86911 100644 --- a/debian/patches/00list +++ b/debian/patches/00list @@ -4,3 +4,4 @@ 205_ion-lock.diff 206_use-xterm.diff 209_use-etc-default.diff +210_use-cfg_debian_ext.diff diff --git a/debian/patches/210_use-cfg_debian_ext.diff b/debian/patches/210_use-cfg_debian_ext.diff new file mode 100644 index 0000000..693586d --- /dev/null +++ b/debian/patches/210_use-cfg_debian_ext.diff @@ -0,0 +1,25 @@ +#! /bin/sh -e +if [ $# -ne 1 ]; then + echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" + exit 1 +fi +case "$1" in + -patch) patch -f --no-backup-if-mismatch -p1 < $0;; + -unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;; + *) + echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" + exit 1;; +esac + +exit 0 + +@DPATCH@ +--- ion3-20070708.orig/etc/cfg_defaults.lua ++++ ion3-20070708/etc/cfg_defaults.lua +@@ -15,3 +15,6 @@ + + -- Deprecated. + dopath("cfg_user", true) ++ ++-- Debian extra configuration files ++dopath("cfg_debian_ext")