From: Ulrich Dangel Date: Fri, 27 Jan 2012 01:49:23 +0000 (+0100) Subject: Support template parameters in overlay directory. For now only X-Git-Url: https://git.grml.org/?p=grml2usb.git;a=commitdiff_plain;h=ae3d73f2caee267480ebfe283dd4a08e92f1c5b5 Support template parameters in overlay directory. For now only GRML_NAME, VERSION RELEASENAME DATE SHORT_NAME and BOOTID are supported. As in grml-live grml2iso supports template filename as well which you will need for modifying file entries. --- diff --git a/grml2iso b/grml2iso index d9236ee..b27cb34 100755 --- a/grml2iso +++ b/grml2iso @@ -203,9 +203,39 @@ Options: # copy specified directory to cd {{{ if [ -n "$DIR" ] ; then echo >&2 "Copying ${DIR} to generated ISO" - rsync -a ${DIR}/ . + for param in SHORT_NAME VERSION BOOTID ; do + EXCLUDE_PARAM="$EXCLUDE_PARAM --exclude **%${param}%**" + done + rsync -a ${DIR}/ $EXCLUDE_PARAM . fi + # adjust files from overlay directory + for GRML_VERSION_FILE in $(find . -name grml-version) ; do + GRML_NAME=$(awk '{print $1}' "$GRML_VERSION_FILE") + VERSION=$(awk '{print $2}' "$GRML_VERSION_FILE") + RELEASENAME=$(sed 's/.*- \(.*\).*\[.*/\1/' "$GRML_VERSION_FILE") + DATE=$(sed 's/.*\[\(.*\)].*/\1/' "$GRML_VERSION_FILE") + SHORT_NAME="$(echo $GRML_NAME | tr -d ',./;\- ')" + BOOTID=$(cat conf/bootid.txt) + + for param in SHORT_NAME VERSION BOOTID ; do + value="$(eval echo '$'"$param")" + + # copy parameterized files from the overlay directory + for file in $(find ${DIR} -name "*%$param%*") ; do + file=${file##$DIR/} + target_dir="$(dirname ${file})" + mkdir -p "$target_dir" || true + cp -r ${DIR}/${file} ./${target_dir}/"$(basename ${file/\%${param}\%/$value})" + done + + # adjust config files + for file in ./boot/isolinux/*.cfg ./boot/isolinux/*.msg \ + ./boot/grub/*.cfg ; do + sed -i "s/%$param%/$value/g" ${file} 2>/dev/null || true + done + done + done # }}} # generate the CD/DVD ISO {{{