Fix issue where existing symlink is not updated
[exim-website.git] / 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 {