Use addon files from chroot if present
authorChristian Hofstaedtler <ch@grml.org>
Mon, 21 Nov 2011 13:28:34 +0000 (14:28 +0100)
committerChristian Hofstaedtler <ch@grml.org>
Mon, 21 Nov 2011 13:28:34 +0000 (14:28 +0100)
This way - if a flavour installs all required packages -, we always
get the addon file from the packages the flavour installs. Makes
source compliance a ton easier and we don't accidentally miss
addons on GRML_FULL.

grml-live

index 910ce2e..351854d 100755 (executable)
--- a/grml-live
+++ b/grml-live
@@ -215,26 +215,39 @@ extend_string_end() {
   echo -ne "\n"
 }
 
   echo -ne "\n"
 }
 
-# Copy addonfile $1 from the TEMPLATE_DIRECTORY/compat (if exists),
-# or from $2 (the system path), or warn about the missing file.
+# Copy addonfile $1 from either
+#   * the chroot (via $2, the system path),
+#   * or from TEMPLATE_DIRECTORY/compat (if exists),
+#   * or from the host system (again, using $2),
+# or warn about the missing file.
+#
 # This is because:
 # This is because:
+#   * We assume that the chroot always has a "good" version of
+#     the file. Also it makes sources handling easier.
 #   * On unstable, we Recommend the Debian packages containing
 #     these files. The user can override them by putting his
 #   * On unstable, we Recommend the Debian packages containing
 #     these files. The user can override them by putting his
-#     "better" version into TEMPLATE_DIRECTORY/compat.
+#     "better" version into the chroot.
 #   * On stable, the Debian packages are probably not available,
 #     or outdated, so we look in TEMPLATE_DIRECTORY/compat first, where
 #     our grml-live-compat package installs current file versions.
 copy_addon_file() {
 #   * On stable, the Debian packages are probably not available,
 #     or outdated, so we look in TEMPLATE_DIRECTORY/compat first, where
 #     our grml-live-compat package installs current file versions.
 copy_addon_file() {
-  if [ ! -d "${BUILD_OUTPUT}/boot/$3/" ]; then
-    mkdir -p "${BUILD_OUTPUT}/boot/$3"
+  DEST="${BUILD_OUTPUT}/boot/$3"
+  if [ ! -d "${DEST}/" ]; then
+    mkdir -p "${DEST}"
+  fi
+  if [ -e "$CHROOT_OUTPUT/$2/$1" ]; then
+    log   "Copying $1 from chroot"
+    cp "$CHROOT_OUTPUT/$2/$1" "${DEST}/"
+    return $?
   fi
   if [ -e "${TEMPLATE_DIRECTORY}/compat/$3/$1" ]; then
   fi
   if [ -e "${TEMPLATE_DIRECTORY}/compat/$3/$1" ]; then
-    cp "${TEMPLATE_DIRECTORY}/compat/$3/$1" "${BUILD_OUTPUT}/boot/$3/"
+    log   "Copying $1 from grml-live-compat"
+    cp "${TEMPLATE_DIRECTORY}/compat/$3/$1" "${DEST}/"
     return $?
   fi
   if [ -e "$2/$1" ]; then
     log   "Copying $1 from system"
     return $?
   fi
   if [ -e "$2/$1" ]; then
     log   "Copying $1 from system"
-    cp "$2/$1" "${BUILD_OUTPUT}/boot/$3/"
+    cp "$2/$1" "${DEST}/"
     return $?
   fi
 
     return $?
   fi