Commit 08a8d412 authored by sympa-authors's avatar sympa-authors
Browse files

Changes related to sympa upgrade :

  * no more saving data_structure.version if verion did not change
  * adding a log "upgrading from x to y"
  * initialize the data_structure.version file if missing


git-svn-id: https://subversion.renater.fr/sympa/trunk@3430 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent 58adb726
......@@ -255,12 +255,15 @@ clean:
install: importantchanges installsrc installwws installwebtt2 installmailtt2 installlocale installman installscript installsample installdir installconfig installdoc installsoap
importantchanges:
@( PERL=$(PERL); export PERL; \
( PERL=$(PERL); export PERL; \
UMASK=0600; export UMASK; \
DESTDIR=$(DESTDIR); export DESTDIR; \
BINDIR=$(SBINDIR); export BINDIR; \
SBINDIR=$(SBINDIR); export SBINDIR; \
LIBDIR=$(LIBDIR); export LIBDIR; \
ETCDIR=$(ETCDIR); export ETCDIR;\
USER=$(USER); export USER;\
GROUP=$(GROUP); export GROUP;\
SYMPA_VERSION=$(SYMPA_VERSION); export SYMPA_VERSION; \
$(PERL) ./important_changes.pl \
) ;
......
......@@ -598,12 +598,15 @@ clean:
install: importantchanges installsrc installwws installwebtt2 installmailtt2 installlocale installman installscript installsample installdir installconfig installdoc installsoap
importantchanges:
@( PERL=$(PERL); export PERL; \
( PERL=$(PERL); export PERL; \
UMASK=0600; export UMASK; \
DESTDIR=$(DESTDIR); export DESTDIR; \
BINDIR=$(SBINDIR); export BINDIR; \
SBINDIR=$(SBINDIR); export SBINDIR; \
LIBDIR=$(LIBDIR); export LIBDIR; \
ETCDIR=$(ETCDIR); export ETCDIR;\
USER=$(USER); export USER;\
GROUP=$(GROUP); export GROUP;\
SYMPA_VERSION=$(SYMPA_VERSION); export SYMPA_VERSION; \
$(PERL) ./important_changes.pl \
) ;
......
......@@ -48,6 +48,26 @@ unless ($first_install) {
}
close VERSION;
## Create the data_structure.version file if none exists
my $version_file = "$ENV{'ETCDIR'}/data_structure.version";
if ($ENV{'ETCDIR'} && ! -f $version_file) {
print STDERR "Creating missing $version_file\n";
unless (open VFILE, ">$version_file") {
printf STDERR "Unable to write %s ; sympa.pl needs write access on %s directory : %s\n", $version_file, $ENV{'ETCDIR'}, $!;
return undef;
}
printf VFILE "# This file is automatically created by sympa.pl after installation\n# Unless you know what you are doing, you should not modify it\n";
if ($previous_version) {
printf VFILE "%s\n", $previous_version;
}else {
printf VFILE "%s\n", $current_version;
}
close VFILE;
}
`chown $ENV{'USER'}.$ENV{'GROUP'} $version_file`;
if (($previous_version eq $current_version) ||
&higher($previous_version,$current_version)){
exit 0;
......
......@@ -10300,9 +10300,17 @@ sub maintenance {
}
close VFILE;
}else {
&do_log('notice', "No previous data_structure.version file was found ; assuming you are upgrading to %s", $Version::Version);
$previous_version = '0';
}
## Skip if version is the same
if ($previous_version eq $Version::Version) {
return 1;
}
&do_log('notice', "Upgrading from Sympa version %s to %s", $previous_version, $Version::Version);
## Set 'subscribed' data field to '1' is none of 'subscribed' and 'included' is set
unless (&tools::higher_version($previous_version, '4.2a')) {
......@@ -10506,9 +10514,9 @@ sub maintenance {
}
## Saving current version
## Saving current version if required
unless (open VFILE, ">$version_file") {
do_log('err', "Unable to open %s : %s", $version_file, $!);
do_log('err', "Unable to write %s ; sympa.pl needs write access on %s directory : %s", $version_file, $Conf{'etc'}, $!);
return undef;
}
printf VFILE "# This file is automatically created by sympa.pl after installation\n# Unless you know what you are doing, you should not modify it\n";
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment