People talk about idempotency, as if it's complicated because it's a 5 syllable word.
if ! which sometool; then
install sometool
fi
That's an idempotent shell script, in all it's simple glory.