acieroid/newsome

Need for cleaning mechanisms in install scripts?

Opened this issue · 3 comments

It happened, but is it still the case, that the install scripts needs to be re-runed?
If so, can we setup a trap on SIGINT or a clean.sh script to undo everything
which as been done by the scripts?

This would indeed be useful for the postinst.sh and more importantly the postinst-setup.sh. I also think the postinst-setup.sh could be split into multiple smaller scripts (eg. one to create the master jail, one to install nginx in the master jail, etc.). When a script fails, we just need to clean what it did and we can restart the post-installation from there.

Also (related to #20), having the postinst-setup.sh splitted in multiple components would allow to select which components we want (eg. I want an ircd on awesom's main server, but not on bli), that could be installed later on.

Agree for splitting.
For cleaning, what about something around:

set -e # exit on error
clean() {
…
}
trap clean SIGINT SIGTERM EXIT

EXIT is a pseudo-signal called upon exit. Seems POSIX.