[debian-edu-commits] debian-edu/ 72/437: * Move activation and deactivation code from postinst/prerm into /usr/share/debian-edu-artwork/update-artwork, and call this script from the maintainer scripts. Drop dependency on debian-edu-config as it isn't needed any more.

Mike Gabriel sunweaver at debian.org
Sun Mar 2 23:49:25 UTC 2014


This is an automated email from the git hooks/post-receive script.

sunweaver pushed a commit to branch master
in repository debian-edu-artwork.

commit 0d1ac89e4a740f6f8a0b37ec2e2333f93ba5869a
Author: Petter Reinholdtsen <pere at hungry.com>
Date:   Thu Sep 14 20:37:41 2006 +0000

      * Move activation and deactivation code from postinst/prerm into
        /usr/share/debian-edu-artwork/update-artwork, and call this script
        from the maintainer scripts.  Drop dependency on debian-edu-config
        as it isn't needed any more.
---
 debian/changelog                   |  4 +++
 debian/control                     |  1 -
 debian/debian-edu-artwork.postinst | 44 +-----------------------
 debian/debian-edu-artwork.postrm   |  8 +++--
 debian/debian-edu-artwork.prerm    | 11 +-----
 debian/edit-ini                    | 68 ++++++++++++++++++++++++++++++++++++++
 debian/rules                       |  6 ++++
 7 files changed, 85 insertions(+), 57 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 40f77bb..3161295 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,10 @@ debian-edu-artwork (0.0.10~1) unstable; urgency=low
 
   * Change usplash text area color to white on black.  Change progress
     bar color to blue on brighter blue.  Increase the text area.
+  * Move activation and deactivation code from postinst/prerm into
+    /usr/share/debian-edu-artwork/update-artwork, and call this script
+    from the maintainer scripts.  Drop dependency on debian-edu-config
+    as it isn't needed any more.
 
  -- Petter Reinholdtsen <pere at debian.org>  Mon,  4 Sep 2006 22:29:16 +0200
 
diff --git a/debian/control b/debian/control
index b4ea254..a687c26 100644
--- a/debian/control
+++ b/debian/control
@@ -8,7 +8,6 @@ Standards-Version: 3.7.2
 
 Package: debian-edu-artwork
 Architecture: all
-Depends: debian-edu-config
 Recommends: kdm, debian-edu-artwork-usplash
 Suggests: grub (>= 0.95+cvs20040624-10)
 Description: Debian-Edu themes and artwork
diff --git a/debian/debian-edu-artwork.postinst b/debian/debian-edu-artwork.postinst
index 4f7a443..c170ffc 100644
--- a/debian/debian-edu-artwork.postinst
+++ b/debian/debian-edu-artwork.postinst
@@ -4,50 +4,8 @@ set -e
 
 #DEBHELPER#
 
-change_ldm_background() {
-    update-alternatives --install /usr/share/ldm/themes/default \
-        ldm-theme /usr/share/ldm/themes/debian-edu 80
-}
-
-# switch kdm theme to debian-edu
-change_kdm_theme() {
-    kdmrc=/etc/kde3/kdm/kdmrc
-    if grep -q '^UseTheme=true' $kdmrc; then
-	if grep -q '^Theme=/usr/share/apps/kdm/themes/debian-edu' $kdmrc; then
-	    echo "KDM theme for Debian Edu already enabled, not touching kdmrc."
-	else
-	    echo "KDM theme already customized, not touching kdmrc."
-	fi
-    else
-	if [ -f $kdmrc ] ; then
-	    echo "Installing and enabling Debian Edu KDM theme ..."
-            # This is not policy compilant, as $kdmrc is a conffile in
-            # the kdm package, and we are editing it in a package
-            # maintainer script.  Need to come up with a better way to
-            # do it.  See also
-            # http://release.debian.org/etch_rc_policy.txt
-
-            # First update the KDM theme
-	    /usr/bin/update-ini-file $kdmrc 'X-*-Greeter' UseTheme true
-	    /usr/bin/update-ini-file $kdmrc 'X-*-Greeter' Theme \
-		/usr/share/apps/kdm/themes/debian-edu
-
-            # Next, update the background used after the KDM theme is
-            # removed and before kdesktop insert the selected background.
-	    bgrc=/etc/kde3/kdm/backgroundrc
-	    if [ -f $bgrc ] ; then
-		/usr/bin/update-ini-file $bgrc 'Desktop0' Wallpaper \
-		    debian-edu-wallpaper.png
-	    fi
-	else
-	    echo "KDM not installed, not enabling KDM theme."
-	fi
-    fi
-}
-
 case "$1" in
   configure)
-    change_ldm_background
-    change_kdm_theme
+    /usr/share/debian-edu-artwork/update-artwork configure
     ;;
 esac
diff --git a/debian/debian-edu-artwork.postrm b/debian/debian-edu-artwork.postrm
index 95d98b3..4f4734e 100644
--- a/debian/debian-edu-artwork.postrm
+++ b/debian/debian-edu-artwork.postrm
@@ -3,6 +3,8 @@ set -e
 
 #DEBHELPER#
 
+editini=/usr/share/debian-edu-artwork/edit-ini
+
 # switch kdm theme away from debian-edu
 restore_kdm_theme() {
     kdmrc=/etc/kde3/kdm/kdmrc
@@ -11,12 +13,12 @@ restore_kdm_theme() {
 	grep -q '^UseTheme=true' $kdmrc; then
 
         echo "Removing and disabling Debian Edu KDM theme ..."
-	/usr/bin/update-ini-file $kdmrc 'X-*-Greeter' UseTheme false
-	/usr/bin/update-ini-file $kdmrc 'X-*-Greeter' Theme $defaulttheme
+	$editini $kdmrc 'X-*-Greeter' UseTheme false
+	$editini $kdmrc 'X-*-Greeter' Theme $defaulttheme
 
 	bgrc=/etc/kde3/kdm/backgroundrc
 	if grep -q '^Wallpaper=debian-edu-wallpaper.png' $bgrc ; then
-	    /usr/bin/update-ini-file $bgrc 'Desktop0' Wallpaper debian-kde_default.png
+	    $editini $bgrc 'Desktop0' Wallpaper debian-kde_default.png
 	fi
     else
         echo "KDM theme customised or not enabled, not touching kdmrc ..."
diff --git a/debian/debian-edu-artwork.prerm b/debian/debian-edu-artwork.prerm
index 9cc28d4..8b6a58f 100644
--- a/debian/debian-edu-artwork.prerm
+++ b/debian/debian-edu-artwork.prerm
@@ -4,17 +4,8 @@ set -e
 
 #DEBHELPER#
 
-# Remove diversion for KDE background image
-restore_kde_background() {
-    defaultbgimg=/usr/share/wallpapers/debian-kde_default.png
-    if [ -h $defaultbgimg ] ; then
-	rm $defaultbgimg
-	/usr/sbin/dpkg-divert --remove $defaultbgimg
-    fi
-}
-
 case "$1" in
   remove)
-    #restore_kde_background
+    /usr/share/debian-edu-artwork/update-artwork remove
     ;;
 esac
diff --git a/debian/edit-ini b/debian/edit-ini
new file mode 100755
index 0000000..7d176da
--- /dev/null
+++ b/debian/edit-ini
@@ -0,0 +1,68 @@
+#!/usr/bin/perl
+#
+# Author: Petter Reinholdtsen <pere at hungry.com>
+# Date:   2002-08-11
+#
+# Command line tool to modify .ini style files.
+#
+# Copy of /usr/bin/update-ini-file from debian-edu-config, copied here
+# to avoid the dependency.
+
+use strict;
+use warnings;
+use Config::IniFiles;
+
+usage() if (4 > @ARGV);
+
+my $filename = shift;
+my $section  = shift;
+my $key      = shift;
+my $value    = shift;
+
+# Make sure the file exist, as Config::IniFiles do not create empty
+# config files.
+if ( ! -f $filename ) {
+    open(FILE, "> $filename") || die "Unable to create $filename";
+    print FILE "[$section]\n";
+    close(FILE);
+} else {
+    # Make sure the file contain more then just comment lines, because
+    # the module fail to create an object if it does.  This problem
+    # was discovered with /etc/opera6rc.fixed
+    open(FILE, "< $filename");
+    my $count = 0;
+    while (<FILE>) {
+	chomp;
+	s/[;\#].+$//;
+	next if m/^\s*$/;
+	$count++;
+    }
+    close(FILE);
+    if (0 == $count) {
+	open(FILE, ">> $filename") || die "Unable to append to $filename";
+	print FILE "[$section]\n";
+	close(FILE);
+    }
+}
+
+my $ini = new Config::IniFiles( -file => $filename );
+
+if ($ini) {
+    $ini->AddSection($section);
+    my $oldpath = $ini->newval($section, $key, $value);
+    if ( ! $ini->RewriteConfig ) {
+        print STDERR "error: Unable to set value for ".
+            "section [$section], key='$key' in $filename!\n";
+        exit 1;
+    }
+} else {
+    print STDERR "error: Unable to load $filename!\n";
+    exit 1;
+}
+
+exit 0;
+
+sub usage {
+    print "update-ini-file <file> <section> <variable> <value>\n";
+    exit 0;
+}
diff --git a/debian/rules b/debian/rules
index 28d4487..1db3ae2 100755
--- a/debian/rules
+++ b/debian/rules
@@ -4,3 +4,9 @@ DEB_DH_MAKESHLIBS_ARGS_ALL = -n
 
 include /usr/share/cdbs/1/rules/debhelper.mk
 include /usr/share/cdbs/1/class/autotools.mk
+
+pkgdir      := /usr/share/debian-edu-artwork
+install/debian-edu-artwork::
+	install -d debian/$(cdbs_curpkg)$(pkgdir)
+	install debian/edit-ini debian/$(cdbs_curpkg)$(pkgdir)
+	install debian/update-artwork debian/$(cdbs_curpkg)$(pkgdir)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-edu/debian-edu-artwork.git



More information about the debian-edu-commits mailing list