Discussion:
[Sisuite-devel] [ systemimager-Bugs-1653947 ] Post-install scripts executed twice
SourceForge.net
2007-02-07 09:44:17 UTC
Permalink
Bugs item #1653947, was opened at 2007-02-07 10:44
Message generated for change (Tracker Item Submitted) made by Item Submitter
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.3
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Damien (madz06)
Assigned to: Nobody/Anonymous (nobody)
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 ;)

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

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100259&aid=1653947&group_id=259
SourceForge.net
2007-02-10 16:40:37 UTC
Permalink
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
Loading...