+
+# Copy addonfile $1 from the TEMPLATE_DIRECTORY/compat (if exists),
+# or from $2 (the system path), or warn about the missing file.
+# This is because:
+# * On unstable, we Recommend the Debian packages containing
+# these files. The user can override them by putting his
+# "better" version into TEMPLATE_DIRECTORY/compat.
+# * 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"
+ fi
+ if [ -e "${TEMPLATE_DIRECTORY}/compat/$3/$1" ]; then
+ cp "${TEMPLATE_DIRECTORY}/compat/$3/$1" "${BUILD_OUTPUT}/boot/$3/"
+ return $?
+ fi
+ if [ -e "$2/$1" ]; then
+ log "Copying $1 from system"
+ cp "$2/$1" "${BUILD_OUTPUT}/boot/$3/"
+ return $?
+ fi
+
+ msg="Missing addon file: \"$1\""
+ ewarn "$msg" ; eend 1
+ log "copy_addon_file: $msg"
+}