瀏覽代碼

set loopback alias via parameter in ps1 script

Armin Schrenk 2 年之前
父節點
當前提交
1b0eb34734
共有 2 個文件被更改,包括 6 次插入4 次删除
  1. 3 1
      dist/win/build.bat
  2. 3 3
      dist/win/build.ps1

+ 3 - 1
dist/win/build.bat

@@ -9,8 +9,9 @@ SET ABOUT_URL="https://cryptomator.org"
 SET UPDATE_URL="https://cryptomator.org/downloads/"
 SET HELP_URL="https://cryptomator.org/contact/"
 SET MODULE_AND_MAIN_CLASS="org.cryptomator.desktop/org.cryptomator.launcher.Cryptomator"
+SET LOOPBACK_ALIAS="cryptomator-vault"
 
-powershell -NoLogo -NoExit -ExecutionPolicy Unrestricted -Command .\build.ps1^
+powershell -NoLogo -ExecutionPolicy Unrestricted -Command .\build.ps1^
  -AppName %APPNAME%^
  -MainJarGlob "%MAIN_JAR_GLOB%"^
  -ModuleAndMainClass "%MODULE_AND_MAIN_CLASS%"^
@@ -20,4 +21,5 @@ powershell -NoLogo -NoExit -ExecutionPolicy Unrestricted -Command .\build.ps1^
  -AboutUrl "%ABOUT_URL%"^
  -HelpUrl "%HELP_URL%"^
  -UpdateUrl "%UPDATE_URL%"^
+ -LoopbackAlias "%LOOPBACK_ALIAS%"^
  -Clean 1

+ 3 - 3
dist/win/build.ps1

@@ -8,6 +8,7 @@ Param(
 	[Parameter(Mandatory, HelpMessage="Please provide a help url")][string] $HelpUrl,
 	[Parameter(Mandatory, HelpMessage="Please provide an update url")][string] $UpdateUrl,
 	[Parameter(Mandatory, HelpMessage="Please provide an about url")][string] $AboutUrl,
+	[Parameter(Mandatory, HelpMessage="Please provide an alias for localhost")][string] $LoopbackAlias,
 	[bool] $clean
 )
 
@@ -35,7 +36,6 @@ Write-Output "`$buildDir=$buildDir"
 Write-Output "`$Env:JAVA_HOME=$Env:JAVA_HOME"
 
 $copyright = "(C) $CopyrightStartYear - $((Get-Date).Year) $Vendor"
-$loopbackAlias = $AppName.toLower() + "-vault"
 
 # compile
 &mvn -B -f $buildDir/../../pom.xml clean package -DskipTests -Pwin
@@ -86,7 +86,7 @@ if ($clean -and (Test-Path -Path $appPath)) {
 	--java-options "-Dcryptomator.ipcSocketPath=`"~/AppData/Roaming/$AppName/ipc.socket`"" `
 	--java-options "-Dcryptomator.p12Path=`"~/AppData/Roaming/$AppName/key.p12`"" `
 	--java-options "-Dcryptomator.mountPointsDir=`"~/$AppName`"" `
-	--java-options "-Dcryptomator.loopbackAlias=`"$loopbackAlias`"" `
+	--java-options "-Dcryptomator.loopbackAlias=`"$LoopbackAlias`"" `
 	--java-options "-Dcryptomator.integrationsWin.autoStartShellLinkName=`"$AppName`"" `
 	--java-options "-Dcryptomator.integrationsWin.keychainPaths=`"~/AppData/Roaming/$AppName/keychain.json`"" `
 	--java-options "-Dcryptomator.showTrayIcon=true" `
@@ -110,7 +110,7 @@ attrib -r "$AppName\$AppName.exe"
 # patch batch script to set hostfile
 $webDAVPatcher = "$AppName\patchWebDAV.bat"
 try {
-	(Get-Content $webDAVPatcher ) -replace '::REPLACE ME', "SET LOOPBACK_ALIAS=`"$loopbackAlias`"" | Set-Content $webDAVPatcher
+	(Get-Content $webDAVPatcher ) -replace '::REPLACE ME', "SET LOOPBACK_ALIAS=`"$LoopbackAlias`"" | Set-Content $webDAVPatcher
 } catch {
    Write-Host "Failed to set LOOPBACK_ALIAS for patchWebDAV.bat"
    exit 1