]> git.decadent.org.uk Git - ion3.git/commitdiff
Added modular configuration mechanism.
authorBen Hutchings <ben@decadent.org.uk>
Mon, 9 Jul 2007 01:27:18 +0000 (01:27 +0000)
committerBen Hutchings <ben@decadent.org.uk>
Sun, 2 Nov 2008 12:39:53 +0000 (12:39 +0000)
debian/README
debian/install-ion3-cfg [new file with mode: 0755]
debian/ion3.install
debian/ion3.postinst
debian/patches/00list
debian/patches/210_use-cfg_debian_ext.diff [new file with mode: 0644]

index 8d978350899ecf6e7447f3e460d34a0158d1a8f3..74767738f6b2e9ab428d0b13d3cf62db162ccb45 100644 (file)
@@ -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 (executable)
index 0000000..9fab5bc
--- /dev/null
@@ -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
index 3aafa3c4f8bf8e63c5c9059da4032e6a4d2abe48..ba93f6d6b30b2d2a7b17ae81756e45813f8d21d4 100644 (file)
@@ -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
index f8e8fd92d20d02d1d7bdbf2c6819b51d2fa61391..bfa57184775cb7d74d6259625a2df124b06d8a18 100644 (file)
@@ -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
index 24d414451043d3ef11a6a2c8b1e0bbf51c0fc87f..2b869111df1a41c348780302fe5e46c91c9f7429 100644 (file)
@@ -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 (file)
index 0000000..693586d
--- /dev/null
@@ -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")