removed logic around gpg needing zip as gpg will just zip automactically. trying gpg command
This commit is contained in:
@@ -3,12 +3,6 @@ param (
|
||||
[switch]$gpg
|
||||
)
|
||||
|
||||
# the validatescript for the param was not working when -gpg -zip was passed in so this will be the fucntion
|
||||
if ($gpg -and -not $zip) {
|
||||
Write-Error "You cannot use -gpg without -zip."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# get the date/time for the back filename
|
||||
$dateTime = get-date -format ("yyyyMMdd-HHmmss")
|
||||
$env:Path += ";$PSScriptRoot\lib;$PSScriptRoot\lib\gpg\bin"
|
||||
@@ -71,13 +65,15 @@ $itemsWithAttachments | foreach {
|
||||
|
||||
$zipFilename = "Bitwarden Backup $dateTime.zip"
|
||||
|
||||
if ($zip) {
|
||||
if ($zip -or $gpg) {
|
||||
Write-Host "Zipping the backup together..."
|
||||
Compress-Archive -Path $PSScriptRoot\*.csv, $PSScriptRoot\*.json, $PSScriptRoot\attachments -DestinationPath "$PSScriptRoot\$zipFilename"
|
||||
|
||||
Write-Host "Securely deleting the exports and attachments..."
|
||||
sdelete64.exe -s -p 5 $PSScriptRoot\*.csv $PSScriptRoot\*.json $PSScriptRoot\attachments
|
||||
if ($gpg) {
|
||||
Write-Host "Encrypting the backup zip with your bitwarden password..."
|
||||
gpg.exe --symmetric --cipher-algo AES256 --digest-algo SHA512 --output "$PSScriptRoot\$zipFilename.gpg" "$PSScriptRoot\$zipFilename"
|
||||
gpg.exe --batch --passphrase "$password" --symmetric --cipher-algo AES256 --digest-algo SHA512 --output "$PSScriptRoot\$zipFilename.gpg" "$PSScriptRoot\$zipFilename"
|
||||
sdelete64.exe -p 5 "$PSScriptRoot\$zipFilename"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user