The bug repport above about package desktop-base can be followed at
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=502187

The link /etc/splashy/themes will cause problems sometimes. That was the case 
with desktop-base. I don't think splashy should rely on that symbolic link, 
especially for default theme!

Attached to this mail is a possible patch for default theme location only.

Note the patch in initramfs-tools/hooks/libsplashy and src/xml_config.c to 
handle the case where the selected theme is unavailable. They have not been 
tested throughtfully.

To complete the migration, it might be usefull to remove all references to 
/etc/splashy/theme, including in debian/splashy-theme.install
diff -Naur a/doc/config.xml.in b/doc/config.xml.in
--- a/doc/config.xml.in	2008-05-29 08:50:11.000000000 +0200
+++ b/doc/config.xml.in	2008-10-16 22:16:00.000000000 +0200
@@ -6,6 +6,6 @@
     <!-- current theme could be relative the themes defined above or full path -->
     <current_theme>default</current_theme>
     <!-- full path to theme to fall back in case of problems. DO NOT CHANGE -->
-    <default_theme>@EXPANDED_SYSCONFDIR@/splashy/themes/default</default_theme>
+    <default_theme>/usr/share/splashy/themes/default</default_theme>
     <pid>/etc/splashy/splashy.pid</pid>
 </splashy>
diff -Naur a/doc/splashy_config.pod b/doc/splashy_config.pod
--- a/doc/splashy_config.pod	2008-05-29 08:50:11.000000000 +0200
+++ b/doc/splashy_config.pod	2008-10-16 22:20:55.000000000 +0200
@@ -321,7 +321,7 @@
 
 Main configuration. defines how splashy should be setup.
 
-=item I</etc/splashy/themes/default/theme.xml>
+=item I</usr/share/splashy/themes/default/theme.xml>
 
 Default theme. defines how the images displayed by splashy should be setup, their location
 and other theme-related variables.
diff -Naur a/doc/splashy-config.xml.pod b/doc/splashy-config.xml.pod
--- a/doc/splashy-config.xml.pod	2008-05-29 08:50:11.000000000 +0200
+++ b/doc/splashy-config.xml.pod	2008-10-16 22:21:51.000000000 +0200
@@ -49,7 +49,7 @@
 
 =item I<< <default_theme> >>
 
-Full path to a theme to fall back to if the theme specified in <current_theme>'s value can't be found. Default: /etc/splashy/themes/default
+Full path to a theme to fall back to if the theme specified in <current_theme>'s value can't be found. Default: /usr/share/splashy/themes/default
 
 =item I<< <pid> >>
 
@@ -69,7 +69,7 @@
     <!-- current theme could be relative the themes defined above or full path -->
     <current_theme>default</current_theme>
     <!-- full path to theme to fall back in case of problems. DO NOT CHANGE -->
-    <default_theme>/etc/splashy/themes/default</default_theme>
+    <default_theme>/usr/share/splashy/themes/default</default_theme>
     <!-- this defaults should be ok -->
     <pid>/var/run/splashy.pid</pid>
  </splashy>
diff -Naur a/doc/splashy.pod b/doc/splashy.pod
--- a/doc/splashy.pod	2008-05-29 08:50:11.000000000 +0200
+++ b/doc/splashy.pod	2008-10-16 22:19:59.000000000 +0200
@@ -69,7 +69,7 @@
 
 Main configuration. defines how splashy should be setup.
 
-=item I</etc/splashy/themes/default/config.xml>
+=item I</usr/share/splashy/themes/default/config.xml>
 
 Default theme. defines how the images displayed by splashy should be setup, their location
 and other theme-related variables.
diff -Naur a/src/xml_format.h.in b/src/xml_format.h.in
--- a/src/xml_format.h.in	2008-05-29 08:50:11.000000000 +0200
+++ b/src/xml_format.h.in	2008-10-16 22:25:42.000000000 +0200
@@ -28,7 +28,7 @@
     <!-- current theme could be relative the themes defined above or full path -->\n\
     <current_theme>%s</current_theme>\n\
     <!-- full path to theme to fall back in case of problems. DO NOT CHANGE -->\n\
-    <default_theme>@EXPANDED_SYSCONFDIR@/splashy/themes/default</default_theme>\n\
+    <default_theme>/usr/share/splashy/themes/default</default_theme>\n\
     <pid>%s</pid>\n\
 </splashy>\n"
 
diff -Naur a/scripts/initramfs-tools/hooks/libsplashy.in b/scripts/initramfs-tools/hooks/libsplashy.in
--- a/scripts/initramfs-tools/hooks/libsplashy.in	2008-05-29 09:00:44.000000000 +0200
+++ b/scripts/initramfs-tools/hooks/libsplashy.in	2008-10-16 23:39:44.000000000 +0200
@@ -31,6 +31,12 @@
 CURRENT_THEME="$(splashy_config --get-key /splashy/current_theme)"
 CURRENT_THEME_DIR="${THEMES_DIR}/${CURRENT_THEME}"
 
+if [ ! -d "${CURRENT_THEME_DIR}" ]; then
+    BACKUP_THEME_DIR="$(splashy_config --get-key /splashy/default_theme)"
+    echo "${THEMES_DIR}/${CURRENT_THEME} doesn't exists. Using ${BACKUP_THEME_DIR}.">&2
+    CURRENT_THEME_DIR=$BACKUP_THEME_DIR
+fi
+
 mkdir -p "${DESTDIR}/${CURRENT_THEME_DIR}"
 mkdir -p "${DESTDIR}/etc/splashy/"

--- splashy-0.3.10.old/src/xml_config.c	2008-05-29 08:50:11.000000000 +0200
+++ splashy-0.3.10/src/xml_config.c	2008-10-17 01:27:22.000000000 +0200
@@ -33,6 +33,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <glib.h>
+#include <sys/stat.h>
 
 #include "common_macros.h"
 #include "xml_parser.h"
@@ -66,6 +67,7 @@
 {
         GString *theme_path = g_string_new ("");
         const gchar *ret = NULL;
+        struct stat path_stat;
         /*
          * the current theme could be given to us in a full path or a 
          * simple string name. We determine how to get the theme
@@ -94,8 +96,22 @@
                  * use full path 
                  */
                 g_string_append (theme_path, _current_theme);
-	}
-	g_string_append (theme_path, G_DIR_SEPARATOR_S);
+        }
+        g_string_append (theme_path, G_DIR_SEPARATOR_S);
+        
+        /*
+         * Check the directory exists
+         */
+        stat(theme_path->str, &path_stat);
+        if (!S_ISDIR(path_stat.st_mode)) {
+                DEBUG_PRINT ("Theme is unavailable at %s. Using default.",
+                             theme_path->str);
+                g_string_free (theme_path, TRUE);
+                theme_path = g_string_new ("");
+                g_string_append (theme_path,
+                                 xml_parser_get_text (SPL_DEFAULT_THEME));
+                g_string_append (theme_path, G_DIR_SEPARATOR_S);
+        }
 
         ret = theme_path->str;
         /*

Reply via email to