Bugs item #1653947, was opened at 2007-02-07 10:44
Message generated for change (Comment added) made by righiandr
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=100259&aid=1653947&group_id=259

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Initial RAM Disk
>Group: v3.7.6
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Damien (madz06)
>Assigned to: Andrea Righi (righiandr)
Summary: Post-install scripts executed twice

Initial Comment:
Setup: server running debian etch, systemimager 3.7.6

Image name: sargetest
Hostname: tests1
Script: 90sargetest.script (in /var/lib/systemimager/scripts/post-install)

Post-install scripts with a class name are executed twice in my setup (scripts 
with "all" class are not concerned).

This bug is actually in the functions file (/etc/init.d/functions in initrd.img 
and in intrd template), in function run_post_install_scripts.
I just fixed this using sort -u instead of uniq, and it looks something like :

POST_INSTALL_SCRIPTS=`sort -u << EOL
$POST_INSTALL_SCRIPTS
EOL`

And it works just fine now. You may find a smarter way to fix this, just my 2 
cents ;)

----------------------------------------------------------------------

>Comment By: Andrea Righi (righiandr)
Date: 2007-02-10 17:40

Message:
Logged In: YES 
user_id=696767
Originator: NO

The command uniq (as sort -u) works only if the list is sorted, but we
want to preserve the order of the different classes (IMAGENAME,
BASE_HOSTNAME, HOSTNAME, all, OVERRIDES), so we cannot sort the whole
list with a single command.

The solution is to use a custom unique() function to remove duplicate
entries preseriving the original order.

unique() {
    ret=
    for i in $*; do
        flag=0
        for j in $ret; do
            [ "$i" = "$j" ] && flag=1 && break
        done
        [ $flag -eq 0 ] && ret="$ret $i"
    done
    echo $ret
    unset i j flag ret
}

Usage:

for script in `unique POST_INSTALL_SCRIPTS`; do
   execute script ...
done

Maybe there's a more elegant way to resolve, but this solution seems to
resolve. The fix is present in the trunk and it'll be available in 3.7.7.

Thanks for reporting,
-Andrea

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=100259&aid=1653947&group_id=259

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
sisuite-devel mailing list
sisuite-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sisuite-devel

Reply via email to