-add_dkim_record=0
-if [ ! -f "/etc/dkimkeys/${dkim_selector}.private" ]; then
- add_dkim_record=1
- set +e
- dpkg -s opendkim-tools &> /dev/null
- preinstalled="$?"
- set -e
- if [ ! "${preinstalled}" -eq "0" ]; then
- apt install -y opendkim-tools
- fi
- opendkim-genkey -s "${dkim_selector}"
- mv "${dkim_selector}.private" /etc/dkimkeys/
- if [ ! "${preinstalled}" -eq "0" ]; then
- apt -y --purge autoremove opendkim-tools
- fi
+set +e
+dpkg -s opendkim-tools &> /dev/null
+preinstalled="$?"
+set -e
+if [ ! "${preinstalled}" -eq "0" ]; then
+ apt install -y opendkim-tools
+fi
+opendkim-genkey -s "${dkim_selector}"
+mv "${dkim_selector}.private" /etc/dkimkeys/
+if [ ! "${preinstalled}" -eq "0" ]; then
+ apt -y --purge autoremove opendkim-tools