|
|
|
@ -4,11 +4,9 @@ param ( |
|
|
|
[switch] $restart, |
|
|
|
[switch] $restart, |
|
|
|
[switch] $update, |
|
|
|
[switch] $update, |
|
|
|
[switch] $updatedb, |
|
|
|
[switch] $updatedb, |
|
|
|
[string] $output = "c:/bitwarden" |
|
|
|
[string] $output = "" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
$year = (Get-Date).year |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Write-Host @' |
|
|
|
Write-Host @' |
|
|
|
_ _ _ _ |
|
|
|
_ _ _ _ |
|
|
|
| |__ (_) |___ ____ _ _ __ __| | ___ _ __ |
|
|
|
| |__ (_) |___ ____ _ _ __ __| | ___ _ __ |
|
|
|
@ -19,46 +17,55 @@ Write-Host @' |
|
|
|
|
|
|
|
|
|
|
|
Write-Host " |
|
|
|
Write-Host " |
|
|
|
Open source password management solutions |
|
|
|
Open source password management solutions |
|
|
|
Copyright 2015-${year}, 8bit Solutions LLC |
|
|
|
Copyright 2015-${(Get-Date).year}, 8bit Solutions LLC |
|
|
|
https://bitwarden.com, https://github.com/bitwarden |
|
|
|
https://bitwarden.com, https://github.com/bitwarden |
|
|
|
" |
|
|
|
" |
|
|
|
|
|
|
|
|
|
|
|
$dir = Split-Path -Parent $MyInvocation.MyCommand.Path |
|
|
|
$dir = Split-Path -Parent $MyInvocation.MyCommand.Path |
|
|
|
$dockerDir = ".\docker" |
|
|
|
if($output -eq "") { |
|
|
|
|
|
|
|
$output="${dir}\bitwarden" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!(Test-Path -Path $output)) { |
|
|
|
|
|
|
|
New-Item -ItemType directory -Path $output | Out-Null |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scriptsDir = "${output}\scripts" |
|
|
|
|
|
|
|
$dockerDir = "${output}\docker" |
|
|
|
$githubBaseUrl = "https://raw.githubusercontent.com/bitwarden/core/master" |
|
|
|
$githubBaseUrl = "https://raw.githubusercontent.com/bitwarden/core/master" |
|
|
|
|
|
|
|
|
|
|
|
function Download-Run-Files { |
|
|
|
function Download-Run-Files { |
|
|
|
Invoke-RestMethod -OutFile run.ps1 -Uri "${githubBaseUrl}/scripts/run.ps1" |
|
|
|
Invoke-RestMethod -OutFile $scriptsDir\run.ps1 -Uri "${githubBaseUrl}/scripts/run.ps1" |
|
|
|
Invoke-RestMethod -OutFile $dockerDir\docker-compose.yml -Uri "${githubBaseUrl}/docker/docker-compose.yml" |
|
|
|
Invoke-RestMethod -OutFile $dockerDir\docker-compose.yml -Uri "${githubBaseUrl}/docker/docker-compose.yml" |
|
|
|
Invoke-RestMethod -OutFile $dockerDir\docker-compose.windows.yml ` -Uri "${githubBaseUrl}/docker/docker-compose.windows.yml" |
|
|
|
Invoke-RestMethod -OutFile $dockerDir\docker-compose.macwin.yml ` -Uri "${githubBaseUrl}/docker/docker-compose.macwin.yml" |
|
|
|
Invoke-RestMethod -OutFile $dockerDir\global.env -Uri "${githubBaseUrl}/docker/global.env" |
|
|
|
Invoke-RestMethod -OutFile $dockerDir\global.env -Uri "${githubBaseUrl}/docker/global.env" |
|
|
|
Invoke-RestMethod -OutFile $dockerDir\mssql.env -Uri "${githubBaseUrl}/docker/mssql.env" |
|
|
|
Invoke-RestMethod -OutFile $dockerDir\mssql.env -Uri "${githubBaseUrl}/docker/mssql.env" |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if($install) { |
|
|
|
if($install) { |
|
|
|
Invoke-RestMethod -OutFile install.ps1 ` -Uri "${githubBaseUrl}/scripts/install.ps1" |
|
|
|
Invoke-RestMethod -OutFile $scriptsDir\install.ps1 ` -Uri "${githubBaseUrl}/scripts/install.ps1" |
|
|
|
.\install.ps1 -outputDir $output |
|
|
|
$scriptsDir\install.ps1 -outputDir $output |
|
|
|
} |
|
|
|
} |
|
|
|
elseif($run -Or $restart) { |
|
|
|
elseif($run -Or $restart) { |
|
|
|
if(!(Test-Path -Path $dockerDir)){ |
|
|
|
if(!(Test-Path -Path $dockerDir)) { |
|
|
|
New-Item -ItemType directory -Path $dockerDir | Out-Null |
|
|
|
New-Item -ItemType directory -Path $dockerDir | Out-Null |
|
|
|
Download-Run-Files |
|
|
|
Download-Run-Files |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.\run.ps1 -dockerDir $dockerDir |
|
|
|
$scriptsDir\run.ps1 -dockerDir $dockerDir |
|
|
|
} |
|
|
|
} |
|
|
|
elseif($update) { |
|
|
|
elseif($update) { |
|
|
|
if(Test-Path -Path $dockerDir){ |
|
|
|
if(Test-Path -Path $dockerDir) { |
|
|
|
Remove-Item -Recurse -Force $dockerDir | Out-Null |
|
|
|
Remove-Item -Recurse -Force $dockerDir | Out-Null |
|
|
|
} |
|
|
|
} |
|
|
|
New-Item -ItemType directory -Path $dockerDir | Out-Null |
|
|
|
New-Item -ItemType directory -Path $dockerDir | Out-Null |
|
|
|
|
|
|
|
|
|
|
|
Download-Run-Files |
|
|
|
Download-Run-Files |
|
|
|
.\run.ps1 -dockerDir $dockerDir |
|
|
|
$scriptsDir\run.ps1 -dockerDir $dockerDir |
|
|
|
} |
|
|
|
} |
|
|
|
elseif($updatedb) { |
|
|
|
elseif($updatedb) { |
|
|
|
Invoke-RestMethod -OutFile update-db.ps1 -Uri "${githubBaseUrl}/scripts/update-db.ps1" |
|
|
|
Invoke-RestMethod -OutFile $scriptsDir\update-db.ps1 -Uri "${githubBaseUrl}/scripts/update-db.ps1" |
|
|
|
.\update-db.ps1 -outputDir $output |
|
|
|
$scriptsDir\update-db.ps1 -outputDir $output |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
|
echo "No command found." |
|
|
|
echo "No command found." |
|
|
|
|