Fix issue where existing symlink is not updated
authorNigel Metheringham <nigel.metheringham@dev.intechnology.co.uk>
Fri, 7 Jan 2011 12:15:26 +0000 (12:15 +0000)
committerNigel Metheringham <nigel.metheringham@dev.intechnology.co.uk>
Fri, 7 Jan 2011 12:15:26 +0000 (12:15 +0000)
also failed silently :-(

script/gen.pl

index 76734bf1bfa1ebd2d084a93d8aa1c729233052e3..82ab22440136ed48791b1c5454fec24e2469ffed 100755 (executable)
@@ -26,7 +26,9 @@ do_web() if exists $opt{web};
 
 ## Add the exim-html-current symlink
 print "Symlinking exim-html-current to exim-html-$opt{latest}\n";
-symlink( "$opt{docroot}/exim-html-$opt{latest}", "$opt{docroot}/exim-html-current" );
+unlink("$opt{docroot}/exim-html-current") if ( -l "$opt{docroot}/exim-html-current" );
+symlink( "$opt{docroot}/exim-html-$opt{latest}", "$opt{docroot}/exim-html-current" )
+  || die "symlink to $opt{docroot}/exim-html-current failed";
 
 ## Generate the website files
 sub do_web {