Nitpicking note
While adding || :
or || true
to every shell statement outside of if
, elif
, while
and other conditional statements prevents a shell invoked with the option -e
to stop executing a shell-script when a statement has an exit status not equal to 0
, the scriptlets (i.e. %pre*
, %post*
, %trigger*
and %file*
) scripts in an RPM spec-file are not executed in a shell invoked with the option -e
(in contrast to the scripts in the “body” of an RPM spec-file, i.e. %prep
, %build
and %install
).
The only condition the scriptlets must fulfil in order to not accidentally abort an RPM file’s installation, update or removal, is to exit with a status of 0
. Consequently concluding RPM spec-file scriptlets with an exit 0
statement (or any other statement which is guaranteed to return 0
) is fully sufficient.
Source: RPM documentation