this post was submitted on 24 Apr 2025
191 points (89.3% liked)
Linux
7079 readers
1298 users here now
A community for everything relating to the GNU/Linux operating system
Also check out:
Original icon base courtesy of [email protected] and The GIMP
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Yeah, that is a very good question. It's one of the last commands in the script and initially I thought they had set up the script so that it would abort, if any of the commands before it would fail.
But then a colleague pointed out that it's actually the opposite. So, you can tell the shell to abort execution on error by running
set -e
. But what they had written at the top wasset +e
, which explicitly turns that off (even though it should be off by default).The last command in the script is also
exit 0
, so it always indicates success.So, yeah, they seem to have knowingly made it so that if the script fails, then it doesn't retry or anything. It tries to plough through as many of the commands as it can manage (ignoring any that fail on the way) and then it always deletes itself.
I guess, it's not as egregious of an assumption, because it only runs on a fresh OS. That's a pretty controlled environment to be executing in, so the chance of something going wrong is rather low.
Well, and the other question is what else would you do? If the script fails and you don't delete it, it's going to re-run on the next boot. What's going to be different on the next boot to make it succeed then? Might as well do as much as you can and then quit...