[Ovirt-devel] [PATCH node-image] avoid image-minimizer fall-out

Jim Meyering jim at meyering.net
Wed Oct 8 14:16:09 UTC 2008


"Daniel P. Berrange" <berrange at redhat.com> wrote:
...
> How about instead, adding another  '%post' at the end of the 'common-post.ks'
> script, so that it resets things back to being processed by 'sh', instead
> of the image-minimizer.
>
> If an include file changes semantics for a period, it is good practice to
> restore the original semantics to avoid these kind of surprises.

Yes, that's better.  Thanks:

>From 321b3fe26c9fe6252693d54db6f320864a7249e5 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Wed, 8 Oct 2008 16:14:51 +0200
Subject: [PATCH node-image] common-post.ks: add empty %post marker at end

I noticed the following error go by today:

    Removing blacklisted files and directories
    Cleanup empty directory structures in /usr/share
    Running image-minimizer...
==> Unknown Command: touch
    e2fsck 1.41.0 (10-Jul-2008)
    Pass 1: Checking inodes, blocks, and sizes

That's due to the new use of image-minimizer in common-post.ks (cool, btw!).
It appears at the end of that file:

    echo "Cleanup empty directory structures in /usr/share"
    find /usr/share -type d -exec rmdir {} \; > /dev/null 2>&1

    echo "Running image-minimizer..."
    %post --nochroot --interpreter image-minimizer
    drop /usr/lib/libboost*
    keep /usr/lib/libboost_program_options.so*
    keep /usr/lib/libboost_filesystem.so*
    drop /usr/lib64/libboost*
    keep /usr/lib64/libboost_program_options.so*
    keep /usr/lib64/libboost_filesystem.so*

However, common-post.ks is included from ovirt-node-image.ks like this:

    ...
    %post
    %include common-post.ks

    touch /.autorelabel

    %end

Which means the "touch" command is interpreted by image-minimizer.

The patch below fixes that by adding an %post directive after
the image-minimizer list, in order to restore the expected state.
---
 common-post.ks |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/common-post.ks b/common-post.ks
index deee9a5..a38820b 100644
--- a/common-post.ks
+++ b/common-post.ks
@@ -156,3 +156,7 @@ keep /usr/lib/libboost_filesystem.so*
 drop /usr/lib64/libboost*
 keep /usr/lib64/libboost_program_options.so*
 keep /usr/lib64/libboost_filesystem.so*
+
+# this empty "%post" section ends image-minimizer input, so that when this
+# file is inserted into another .ks file, they're in the expected state.
+%post
--
1.6.0.2.307.gc427




More information about the ovirt-devel mailing list