mirror of
https://github.com/bitwarden/server.git
synced 2025-02-16 01:51:21 +01:00
bitwarden main script
This commit is contained in:
parent
7aaf185365
commit
374bb8305d
65
bitwarden.ps1
Normal file
65
bitwarden.ps1
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
param (
|
||||||
|
[switch] $install,
|
||||||
|
[switch] $run,
|
||||||
|
[switch] $restart,
|
||||||
|
[switch] $update,
|
||||||
|
[switch] $updatedb,
|
||||||
|
[string] $output = "c:/bitwarden"
|
||||||
|
)
|
||||||
|
|
||||||
|
$year = (Get-Date).year
|
||||||
|
|
||||||
|
Write-Host @'
|
||||||
|
_ _ _ _
|
||||||
|
| |__ (_) |___ ____ _ _ __ __| | ___ _ __
|
||||||
|
| '_ \| | __\ \ /\ / / _` | '__/ _` |/ _ \ '_ \
|
||||||
|
| |_) | | |_ \ V V / (_| | | | (_| | __/ | | |
|
||||||
|
|_.__/|_|\__| \_/\_/ \__,_|_| \__,_|\___|_| |_|
|
||||||
|
'@
|
||||||
|
|
||||||
|
Write-Host "
|
||||||
|
Open source password management solutions
|
||||||
|
Copyright 2015-${year}, 8bit Solutions LLC
|
||||||
|
https://bitwarden.com, https://github.com/bitwarden
|
||||||
|
"
|
||||||
|
|
||||||
|
$dir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||||
|
$dockerDir = ".\docker"
|
||||||
|
$githubBaseUrl = "https://raw.githubusercontent.com/bitwarden/core/master"
|
||||||
|
|
||||||
|
function Download-Run-Files {
|
||||||
|
Invoke-RestMethod -OutFile run.ps1 -Uri "${githubBaseUrl}/scripts/run.ps1"
|
||||||
|
Invoke-RestMethod -OutFile docker\docker-compose.yml -Uri "${githubBaseUrl}/docker/docker-compose.yml"
|
||||||
|
Invoke-RestMethod -OutFile docker\docker-compose.windows.yml ` -Uri "${githubBaseUrl}/docker/docker-compose.windows.yml"
|
||||||
|
Invoke-RestMethod -OutFile docker\global.env -Uri "${githubBaseUrl}/docker/global.env"
|
||||||
|
Invoke-RestMethod -OutFile docker\mssql.env -Uri "${githubBaseUrl}/docker/mssql.env"
|
||||||
|
}
|
||||||
|
|
||||||
|
if($install) {
|
||||||
|
Invoke-RestMethod -OutFile install.ps1 ` -Uri "${githubBaseUrl}/scripts/install.ps1"
|
||||||
|
.\install.ps1 -outputDir $output
|
||||||
|
}
|
||||||
|
elseif($run -Or $restart) {
|
||||||
|
if(!(Test-Path -Path $dockerDir)){
|
||||||
|
New-Item -ItemType directory -Path $dockerDir | Out-Null
|
||||||
|
Download-Run-Files
|
||||||
|
}
|
||||||
|
|
||||||
|
.\run.ps1 -dockerDir $dockerDir
|
||||||
|
}
|
||||||
|
elseif($update) {
|
||||||
|
if(Test-Path -Path $dockerDir){
|
||||||
|
Remove-Item -Recurse -Force $dockerDir | Out-Null
|
||||||
|
}
|
||||||
|
New-Item -ItemType directory -Path $dockerDir | Out-Null
|
||||||
|
|
||||||
|
Download-Run-Files
|
||||||
|
.\run.ps1 -dockerDir $dockerDir
|
||||||
|
}
|
||||||
|
elseif($updatedb) {
|
||||||
|
Invoke-RestMethod -OutFile update-db.ps1 -Uri "${githubBaseUrl}/scripts/update-db.ps1"
|
||||||
|
.\update-db.ps1 -outputDir $output
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo "No command found."
|
||||||
|
}
|
@ -2,22 +2,6 @@ param (
|
|||||||
[string]$outputDir = "c:/bitwarden"
|
[string]$outputDir = "c:/bitwarden"
|
||||||
)
|
)
|
||||||
|
|
||||||
$year = (Get-Date).year
|
|
||||||
|
|
||||||
Write-Host @'
|
|
||||||
_ _ _ _
|
|
||||||
| |__ (_) |___ ____ _ _ __ __| | ___ _ __
|
|
||||||
| '_ \| | __\ \ /\ / / _` | '__/ _` |/ _ \ '_ \
|
|
||||||
| |_) | | |_ \ V V / (_| | | | (_| | __/ | | |
|
|
||||||
|_.__/|_|\__| \_/\_/ \__,_|_| \__,_|\___|_| |_|
|
|
||||||
'@
|
|
||||||
|
|
||||||
Write-Host "
|
|
||||||
Open source password management solutions
|
|
||||||
Copyright 2015-${year}, 8bit Solutions LLC
|
|
||||||
https://bitwarden.com, https://github.com/bitwarden
|
|
||||||
"
|
|
||||||
|
|
||||||
if(!(Test-Path -Path $outputDir )){
|
if(!(Test-Path -Path $outputDir )){
|
||||||
New-Item -ItemType directory -Path $outputDir
|
New-Item -ItemType directory -Path $outputDir
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user