[Install Scripts] Detecting upgrades between major releases

3 posts / 0 new
Last post
#1 Thu, 07/21/2011 - 15:04

[Install Scripts] Detecting upgrades between major releases


Is there any way of detecting the difference between an installed current version of a script and the version that a user wants to install?

I know there is the compare_versions() method. Is there a way to use it in this way so that I can do a proper upgrade procedure (the script has different procedures for upgrading between minor and major releases).

Thanks for your help.

Fri, 07/22/2011 - 20:09

You would have to implement this yourself in the script_whatever_install function .. for example, you could use code like :

sub script_whatever_install
my ($d, $version, $opts, $files, $upgrade, $domuser, $dompass) = @_;
if ($upgrade) {
  if ($ver >= 2 && $upgrade->{'version'} < 2) {
    # Perform major upgrade
  } else {
    # Perform minor upgrade
} else {
  # Perform new install


Mon, 07/25/2011 - 09:06

Ah, thank you very much! That helps a lot.

Topic locked