[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH] Add support for mode templates


 As I mentioned in my e-mail regarding the patch to add a mode for Ubuntu, it would be nice if mode could have their own templates (makes sense, right?). I took a swing at it today and it seems like it would actually be trivial to do:

1. Move everything in templates/ right now into templates/debian/
2. Patch functions/defaults.sh to set the default templates directory using mode.

diff --git a/functions/defaults.sh b/functions/defaults.sh
index 8ad360f..737ebe8 100755
--- a/functions/defaults.sh
+++ b/functions/defaults.sh
@@ -227,7 +227,7 @@ Set_defaults ()
        # Setting templates
        if [ -z "${LH_TEMPLATES}" ]
-               LH_TEMPLATES="${LH_BASE:-/usr/share/live-helper}/templates"
+               LH_TEMPLATES="${LH_BASE:-/usr/share/live-helper}/templates/${LH_MODE}"
        # Setting live helper options

3. Since debian-release and embedian are probably fine using the same templates as Debian, I imagine it would be easier to maintain one copy in debian instead of two extra copies. So lets patch the Makefile to create symlinks on install:

diff --git a/Makefile b/Makefile
index 75d2bbb..286cfb5 100644
--- a/Makefile
+++ b/Makefile
@@ -31,6 +31,10 @@ install:
        mkdir -p $(DESTDIR)/usr/share/live-helper
        cp -r data examples functions.sh functions hooks includes lists templates $(DESTDIR)/usr/share/live-helper
+       # Creating symlinks
+       ln -s $(DESTDIR)/usr/share/live-helper/templates/debian $(DESTDIR)/usr/share/live-helper/templates/debian-release
+       ln -s $(DESTDIR)/usr/share/live-helper/templates/debian $(DESTDIR)/usr/share/live-helper/templates/embedebian
        # Installing documentation
        mkdir -p $(DESTDIR)/usr/share/doc/live-helper
        cp -r COPYING docs/* $(DESTDIR)/usr/share/doc/live-helper

4. Now we need templates for Ubuntu, so copy debian to ubuntu in templates/.

I can't seem to get git to bend to my will this morning so if the above sounds good and you commit the changes, I'll send in a patch with the changes for the default Ubuntu template files.


Cody A.W. Somerville
Software Systems Release Engineer
Foundations Team
Custom Engineering Solutions Group
Canonical OEM Services
Phone: +1-781-850-2087
Cell: +1-506-471-8402
Email: cody.somerville@canonical.com

Reply to: