Author: tille
Date: Tue Dec  8 23:13:21 2009
New Revision: 2027
URL: http://svn.debian.org/viewsvn/blends?rev=2027&view=rev

Log:
Several changes to ensure old CDD configuration will not mix up new Blends 
configuration


Modified:
   blends/trunk/blends/debian/blends-common.preinst
   blends/trunk/blends/debian/changelog
   blends/trunk/blends/devtools/Makefile
   blends/trunk/blends/devtools/blend-install-helper
   blends/trunk/blends/templates/config.config
   blends/trunk/blends/templates/config.postinst

Modified: blends/trunk/blends/debian/blends-common.preinst
URL: 
http://svn.debian.org/viewsvn/blends/blends/trunk/blends/debian/blends-common.preinst?rev=2027&view=diff&r1=2027&r2=2026&p1=blends/trunk/blends/debian/blends-common.preinst&p2=blends/trunk/blends/debian/blends-common.preinst
==============================================================================
--- blends/trunk/blends/debian/blends-common.preinst    (original)
+++ blends/trunk/blends/debian/blends-common.preinst    Tue Dec  8 23:13:21 2009
@@ -4,34 +4,43 @@
 # In the process of renaming former Custom Debian Distributions to
 # Debian Pure Blends we try to care for configuration files
 
+# if a CDD configuration exists try to take it over
 if [ -d /etc/cdd ] ; then
-    mkdir -p /etc/blends
-    cd /etc/cdd
-    tar -cf - --exclude menu --exclude sources.* . | \
-            (cd /etc/blends; tar --keep-old-files -xBpf - 2> /dev/null || true)
-    # cp -u -a /etc/cdd/* /etc/blends
-    for blend in `find /etc/blends -maxdepth 1 -mindepth 1 -type d` ; do
-       cd "$blend"
-       for cfgfile in `find . -type f -name "*[a-z]"` ; do
-           if echo $cfgfile | grep -q "\.cdd$" ; then
-               continue
-           fi
-           sed -e 's/CDD/BLEND/g' \
-               -e 's/cdd/blend/g' \
-               -e 's/Custom Debian Distribution/Debian Pure Blend/g' \
-               $cfgfile > "$cfgfile"~
-           mv $cfgfile "$cfgfile".cdd
-       done
-    done
-    if [ -e /etc/blends/cdd.conf ] ; then
-       if [ /etc/blends/blends.conf ] ; then
-           mv /etc/blends/cdd.conf /etc/blends/cdd.conf~
-       else
-           mv /etc/blends/cdd.conf /etc/blends/blends.conf
-            sed -i~ -e 's/CDD/BLEND/g' \
-                   -e 's/cdd/blends/g' \
+    # make sure we did not yet the migration
+    if [ ! -d /etc/blends ] ; then
+        mkdir -p /etc/blends
+        cd /etc/cdd
+       tar -cf - --exclude menu --exclude sources.* . | \
+           (cd /etc/blends; tar --keep-old-files -xBpf - 2> /dev/null || true)
+        # cp -u -a /etc/cdd/* /etc/blends
+       for blend in `find /etc/blends -maxdepth 1 -mindepth 1 -type d` ; do
+           cd "$blend"
+           for cfgfile in `find . -type f -name "*[a-z]"` ; do
+               if echo $cfgfile | grep -q "\.cdd$" ; then
+                   continue
+               fi
+               sed -e 's/CDD/BLEND/g' \
+                   -e 's/cdd/blend/g' \
                    -e 's/Custom Debian Distribution/Debian Pure Blend/g' \
-                   /etc/blends/blends.conf
+                   $cfgfile > "$cfgfile"~
+               mv $cfgfile "$cfgfile".cdd
+               # It is very important that we have a real config file.  If not
+               # unpacking <blend>-config package results in a missing config
+               # file even if it is contained in the package (see #550140 and
+               # #553632)
+               cp -a "$cfgfile"~ "$cfgfile"
+           done
+       done
+        if [ -e /etc/blends/cdd.conf ] ; then
+           if [ /etc/blends/blends.conf ] ; then
+               mv /etc/blends/cdd.conf /etc/blends/cdd.conf~
+           else
+               mv /etc/blends/cdd.conf /etc/blends/blends.conf
+               sed -i~ -e 's/CDD/BLEND/g' \
+                       -e 's/cdd/blends/g' \
+                       -e 's/Custom Debian Distribution/Debian Pure Blend/g' \
+                       /etc/blends/blends.conf
+           fi
        fi
     fi
 fi

Modified: blends/trunk/blends/debian/changelog
URL: 
http://svn.debian.org/viewsvn/blends/blends/trunk/blends/debian/changelog?rev=2027&view=diff&r1=2027&r2=2026&p1=blends/trunk/blends/debian/changelog&p2=blends/trunk/blends/debian/changelog
==============================================================================
--- blends/trunk/blends/debian/changelog        (original)
+++ blends/trunk/blends/debian/changelog        Tue Dec  8 23:13:21 2009
@@ -1,8 +1,11 @@
-blends (0.6.8) UNRELEASED; urgency=low
+blends (0.6.8) unstable; urgency=low
 
-  * debian/control: blends-dev Depends debhelper (>=7)
+  * templates/config.postinst: Really fix the problem of missing
+    config files which has leaded to #550140 and #553632
+  * debian/blends-common.preinst: Do config file moving only
+    if it was not yet done
 
- -- Andreas Tille <[email protected]>  Mon, 09 Nov 2009 10:28:08 +0100
+ -- Andreas Tille <[email protected]>  Mon, 09 Nov 2009 11:59:52 +0100
 
 blends (0.6.7) unstable; urgency=low
 

Modified: blends/trunk/blends/devtools/Makefile
URL: 
http://svn.debian.org/viewsvn/blends/blends/trunk/blends/devtools/Makefile?rev=2027&view=diff&r1=2027&r2=2026&p1=blends/trunk/blends/devtools/Makefile&p2=blends/trunk/blends/devtools/Makefile
==============================================================================
--- blends/trunk/blends/devtools/Makefile       (original)
+++ blends/trunk/blends/devtools/Makefile       Tue Dec  8 23:13:21 2009
@@ -49,6 +49,7 @@
        rm -f tasks/*~
        rm -rf tasksel
        rm -f packages.txt by_vote packages-sorted.txt
+       rm -f debian/*-config.postinst debian/*-config.preinst
 
 distclean: clean
 

Modified: blends/trunk/blends/devtools/blend-install-helper
URL: 
http://svn.debian.org/viewsvn/blends/blends/trunk/blends/devtools/blend-install-helper?rev=2027&view=diff&r1=2027&r2=2026&p1=blends/trunk/blends/devtools/blend-install-helper&p2=blends/trunk/blends/devtools/blend-install-helper
==============================================================================
--- blends/trunk/blends/devtools/blend-install-helper   (original)
+++ blends/trunk/blends/devtools/blend-install-helper   Tue Dec  8 23:13:21 2009
@@ -113,8 +113,9 @@
     BLENDNAME=Debian-`echo ${blend} | perl -ne 'print "\u\L$_";'`
   fi
   # Move templates for user configuration script
-  # In case there is a config postinst template, preserve this
-  [ -s debian/"$blend"-config.postinst.stub ] && cp 
debian/"$blend"-config.postinst.stub debian/"$blend"-config.postinst
+  # In case there is a config {preinst/postinst} template, preserve this
+  [ -s config/preinst  ] && cp config/preinst  debian/"$blend"-config.preinst
+  [ -s config/postinst ] && cp config/postinst debian/"$blend"-config.postinst
   for comm in `ls /usr/share/blends/templates/config.* 
/usr/share/blends/templates/apt.conf` ; do
     commname=`basename $comm`
     SubstBlendName ${commname} ${blend}-${commname}

Modified: blends/trunk/blends/templates/config.config
URL: 
http://svn.debian.org/viewsvn/blends/blends/trunk/blends/templates/config.config?rev=2027&view=diff&r1=2027&r2=2026&p1=blends/trunk/blends/templates/config.config&p2=blends/trunk/blends/templates/config.config
==============================================================================
--- blends/trunk/blends/templates/config.config (original)
+++ blends/trunk/blends/templates/config.config Tue Dec  8 23:13:21 2009
@@ -41,4 +41,14 @@
 db_go
 
 db_stop
+
+if [ -d /etc/blends/#BLEND#/ ] ; then 
+    if [ ! -f /etc/blends/#BLEND#/#BLEND#.conf ] ; then 
+        # Due to a bug in blends-common the real Blend config file was moved 
to #BLEND#.conf~.  This is fixed here
+        if [ -f /etc/blends/#BLEND#/#BLEND#.conf~ ] ; then
+            cp -a /etc/blends/#BLEND#/#BLEND#.conf~ 
/etc/blends/#BLEND#/#BLEND#.conf
+        fi
+    fi
+fi
+                
 exit 0

Modified: blends/trunk/blends/templates/config.postinst
URL: 
http://svn.debian.org/viewsvn/blends/blends/trunk/blends/templates/config.postinst?rev=2027&view=diff&r1=2027&r2=2026&p1=blends/trunk/blends/templates/config.postinst&p2=blends/trunk/blends/templates/config.postinst
==============================================================================
--- blends/trunk/blends/templates/config.postinst       (original)
+++ blends/trunk/blends/templates/config.postinst       Tue Dec  8 23:13:21 2009
@@ -7,12 +7,24 @@
 fi
 . /etc/blends/blends.conf
 
-if [ ! -f /etc/blends/#BLEND#/#BLEND#.conf ] ; then
-    # This might happen in some strange cases but should not prevent the 
packages
-    # from beeing successfully installed so exit with zero here
-    echo "#BLENDNAME# configuration file /etc/blends/#BLEND#/#BLEND#.conf is 
missing."
-    echo "Reinstalling package #BLEND#-config might fix this problem."
-    exit 0
+if [ -d /etc/blends/#BLEND#/ ] ; then
+    if [ ! -f /etc/blends/#BLEND#/#BLEND#.conf ] ; then
+       # strangely enough the config file from the package is NOT installed to
+        # /etc/blends/#BLEND#/#BLEND#.conf if the directory exists but no file 
with
+        # this name inside this directory.  This has caused #550140 and 
#553632.
+        # The try to rename the config files in blends-common left only a file
+        # /etc/blends/#BLEND#/#BLEND#.conf~ behind.  So we try if we can 
continue
+        # with this file.
+       if [ -f /etc/blends/#BLEND#/#BLEND#.conf.dpkg-new ] ; then
+           cp -a /etc/blends/#BLEND#/#BLEND#.conf.dpkg-new 
/etc/blends/#BLEND#/#BLEND#.conf
+        else
+           # if this might fail as well see 
http://www.dpkg.org/dpkg/ConffileHandling
+           # We simply invent a default config file to make sure the install 
process
+           # will not fail
+           echo "BLENDNAME=Debian #BLEND#" > /etc/blends/#BLEND#/#BLEND#.conf
+           exit 0
+       fi
+    fi
 fi
 . /etc/blends/#BLEND#/#BLEND#.conf
 

_______________________________________________
Blends-commit mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/blends-commit

Reply via email to