I am creating DEB package for Ubuntu which copies binary and configuration files. When I am installing/reinstalling with a new DEB file in case of patch, upgrade or downgrade, I need information in preinst file.I need to know the version of binary shipped with my package, and compare it with one already installed, and perform action accordingly. Binary version can be found using ./binary --version
Is there a way to get the file packaged inside DEB and run commands on it as part of preinst script. I am also ok, if I can hardcode this information in control file, and read control file in preinst script.