genconfig: Describe backup conf deletion

* Handle back-up configuration deletion better by informing the user
  why the back-up vanished and why.
* Closes #33
This commit is contained in:
Kyle Manna 2015-03-07 16:35:08 -08:00
parent 96ffed0984
commit 8d8f19d951

View File

@ -193,8 +193,14 @@ for i in "${OVPN_PUSH[@]}"; do
echo push \"$i\" >> "$conf" echo push \"$i\" >> "$conf"
done done
# Clean-up duplicate configs (always return success) # Clean-up duplicate configs
diff -q "$bak_env" "$OVPN_ENV" 2> /dev/null && rm "$bak_env" || true if diff -q "$bak_env" "$OVPN_ENV"; then
diff -q "$bak" "$conf" 2> /dev/null && rm "$bak" || true echo "Removing duplicate back-up: $bak_env"
rm -fv "$bak_env"
fi
if diff -q "$bak" "$conf"; then
echo "Removing duplicate back-up: $bak"
rm -fv "$bak"
fi
echo "Successfully generated config" echo "Successfully generated config"