Merge branch 'master' of euphorik.ch:rup into master
[rup.git] / deploy.ps1
index 5edd2a4..b03e439 100755 (executable)
@@ -1,14 +1,30 @@
+if ($args.Count -lt 1) {
+   $scriptName = [Environment]::GetCommandLineArgs()[1]
+   Write-Output "Usage: $scriptName <destination>"
+   exit 1
+}
+
 git pull
 cargo build --release
 
+systemctl --user stop www-rouleunpet.service
+
 $destination=$args[0]
 
 if (!(Test-Path -Path $destination)) {
    New-Item -ItemType directory -Path $destination
 }
 
+strip target/release/rup # To reduce the executable size.
 Copy-Item target/release/rup -Destination $destination
 Copy-Item key.secret -Destination $destination
-Copy-Item conf.ron -Destination $destination
+
 Copy-Item static -Destination $destination -Recurse -Force
 
+# Do not overwrite the configuration.
+if (!(Test-Path -Path $destination/conf.ron)) {
+   Copy-Item conf.ron -Destination $destination
+}
+
+systemctl --user start www-rouleunpet.service
+