[Debian-live-changes] r2258 - in dists/trunk/live-helper: docs functions helpers
otavio at alioth.debian.org
otavio at alioth.debian.org
Wed Jun 27 19:24:37 UTC 2007
Author: otavio
Date: 2007-06-27 19:24:36 +0000 (Wed, 27 Jun 2007)
New Revision: 2258
Added:
dists/trunk/live-helper/functions/templates.sh
Modified:
dists/trunk/live-helper/docs/ChangeLog
dists/trunk/live-helper/helpers/lh_binary_grub
dists/trunk/live-helper/helpers/lh_binary_syslinux
dists/trunk/live-helper/helpers/lh_binary_yaboot
Log:
Add Check_templates funtion and refactory the code to use
Modified: dists/trunk/live-helper/docs/ChangeLog
===================================================================
--- dists/trunk/live-helper/docs/ChangeLog 2007-06-27 19:17:00 UTC (rev 2257)
+++ dists/trunk/live-helper/docs/ChangeLog 2007-06-27 19:24:36 UTC (rev 2258)
@@ -1,3 +1,11 @@
+2007-06-27 Otavio Salvador <otavio at debian.org>
+
+ * functions/templates.sh:
+ - Added.
+ * helpers/lh_binary_grub, helpers/lh_binary_syslinux,
+ helpers/lh_binary_yaboot:
+ - Use the new Check_templates method to avoid duplicated code.
+
2007-06-25 Daniel Baumann <daniel at debian.org>
* helpers/lh_binary_local-hooks:
Added: dists/trunk/live-helper/functions/templates.sh
===================================================================
--- dists/trunk/live-helper/functions/templates.sh (rev 0)
+++ dists/trunk/live-helper/functions/templates.sh 2007-06-27 19:24:36 UTC (rev 2258)
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+# templates.sh - handle templates files
+# Copyright (C) 2007 Otavio Salvador <otavio at debian.org>
+#
+# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
+# This is free software, and you are welcome to redistribute it
+# under certain conditions; see COPYING for details.
+
+set -e
+
+Check_templates ()
+{
+ DIR="${1}"
+ LOCAL="{2}"
+
+ # Check local templates
+ if [ -d config/templates/"${LOCAL}" ]
+ then
+ LIVE_TEMPLATES="config/templates"
+ fi
+
+ # Checking user templates
+ if [ ! -d "${LIVE_TEMPLATES}" ]
+ then
+ Echo_error "user specified templates not accessible in ${LIVE_TEMPLATES}"
+ exit 1
+ elif [ ! -d "${LIVE_TEMPLATES}/${LOCAL}" ]
+ then
+ Echo_error "${LOCAL} templates not accessible in ${LIVE_TEMPLATES}"
+ exit 1
+ fi
+}
Modified: dists/trunk/live-helper/helpers/lh_binary_grub
===================================================================
--- dists/trunk/live-helper/helpers/lh_binary_grub 2007-06-27 19:17:00 UTC (rev 2257)
+++ dists/trunk/live-helper/helpers/lh_binary_grub 2007-06-27 19:24:36 UTC (rev 2258)
@@ -45,6 +45,9 @@
# Checking stage file
Check_stagefile .stage/binary_grub
+# Checking grub templates
+Check_templates grub
+
# Checking lock file
Check_lockfile .lock
@@ -57,24 +60,6 @@
exit 0
fi
-# Check user templates
-if [ ! -d "${LIVE_TEMPLATES}" ]
-then
- if [ -d ../"${LIVE_TEMPLATES}" ]
- then
- LIVE_TEMPLATES="../${LIVE_TEMPLATES}"
- else
- Echo_error "user specified templates not accessible in ${LIVE_TEMPLATES}"
- exit 1
- fi
-fi
-
-# Check local templates
-if [ -d config/templates/grub ]
-then
- LIVE_TEMPLATES="config/templates"
-fi
-
# Checking depends
Check_package chroot/usr/sbin/grub grub
Modified: dists/trunk/live-helper/helpers/lh_binary_syslinux
===================================================================
--- dists/trunk/live-helper/helpers/lh_binary_syslinux 2007-06-27 19:17:00 UTC (rev 2257)
+++ dists/trunk/live-helper/helpers/lh_binary_syslinux 2007-06-27 19:24:36 UTC (rev 2258)
@@ -45,6 +45,9 @@
# Checking stage file
Check_stagefile .stage/binary_syslinux
+# Checking syslinux templates
+Check_templates syslinux
+
# Checking lock file
Check_lockfile .lock
@@ -57,24 +60,6 @@
exit 0
fi
-# Checking user templates
-if [ ! -d "${LIVE_TEMPLATES}" ]
-then
- if [ -d ../"${LIVE_TEMPLATES}" ]
- then
- LIVE_TEMPLATES="../${LIVE_TEMPLATES}"
- else
- Echo_error "user specified templates not accessible in ${LIVE_TEMPLATES}"
- exit 1
- fi
-fi
-
-# Check local templates
-if [ -d config/templates/syslinux ]
-then
- LIVE_TEMPLATES="config/templates"
-fi
-
# Checking depends
Check_package chroot/usr/bin/syslinux syslinux
Modified: dists/trunk/live-helper/helpers/lh_binary_yaboot
===================================================================
--- dists/trunk/live-helper/helpers/lh_binary_yaboot 2007-06-27 19:17:00 UTC (rev 2257)
+++ dists/trunk/live-helper/helpers/lh_binary_yaboot 2007-06-27 19:24:36 UTC (rev 2258)
@@ -45,6 +45,9 @@
# Checking stage file
Check_stagefile .stage/binary_yaboot
+# Checking yaboot templates
+Check_templates yaboot
+
# Checking lock file
Check_lockfile .lock
@@ -57,24 +60,6 @@
#exit 0 # REMOVE_ME
fi
-# Check user templates
-if [ ! -d "${LIVE_TEMPLATES}" ]
-then
- if [ -d ../"${LIVE_TEMPLATES}" ]
- then
- LIVE_TEMPLATES="../${LIVE_TEMPLATES}"
- else
- Echo_error "user specified templates not accessible in ${LIVE_TEMPLATES}"
- exit 1
- fi
-fi
-
-# Checking local templates
-if [ -d config/templates/yaboot ]
-then
- LIVE_TEMPLATES="config/templates"
-fi
-
# Checking depends
Check_package chroot/usr/lib/yaboot/yaboot yaboot
More information about the Debian-live-changes
mailing list