Hello,
I've created a Debian version 0 installation of a software, say named "softfoo". Everything is installed in the /opt/softfoo/* directory (a kind of miniature fractalized directory of a Linux). For a new installation, from scratch, the Debian installation softfoo_0.0.0.0_amd64.deb installs all very correctly. I'm happy.
Now, I'm creating a Debian version 1 installation. And of course, I'm now testing the "switch case" of maintainer scripts (prerm, preinst, postrm, postinst; Cf.
https://wiki.debian.org/MaintainerScripts) in oder to upgrade from version 1 over an already installed version 0. To be complete, in this case, my upgrade only needs to replace the old *.elf binary, and some *.htm online help files in situ, instead of the old ones
[^]. For the rest, the new *.elf will update the old centralised database, the old *.conf files, ..., by itself.
Question number 1: I've a constraint which is that I want to preserve an old detected installation (number 0, here). So, I want to do a bash cmd "mv" from the old installation towards /opt/softfoo_old_historized_version_0/*. I was thinking of writing this in the script '1->preinst "switch case" upgrade) 0', and rollback\cancel on error in 'this->postrm "switch case" abort-upgrade) 0'. Is this correct?
Question number 2: for file replacements (Cf.
[^*] above , i.e. in order to replace an existing old *.elf, and existing old *.htm online help files), my question is: where, in which maintainer script and with which event script "switch case" (upgrade, configure, ...), is it advisable to script (verify\validate\invalidate) such file to file replacement of a previous installation, and especially how to tell not to replace an old existing database (my installation and my database are in fact centralized: I install a software that can be launched by all users alternatively, but all using the same database)? I would like to code this as much as possible into a upgrade event script "switch case" (for semantic purpose).
Regards.