Updating Debian package does not copy state.yml

Hello

I just wanted to report a probably not wanted interaction between the elastic-agent debian packages when managed by a fleet Server.

We had the problem, that we always needed to enroll an agent again after an update via dpkg.
We found out that the updated version does not copy the state.yml from the last version in /var/lib. (/var/lib/elastic-agent/data/elastic-agent-*)

after copying the state.yml from the previous version the Agent worked again.
this is an easy fix and should probably be included into the post install script.
Also all the old versions are still available in var/lib and should probably be purged on removal of a version. (postrm)