Browse Source

Make default values for prompts more clear

update-clear-defaults
Vince Grassia 2 years ago
parent
commit
edbd0c0c99
No known key found for this signature in database
GPG Key ID: 9AD7505E8448CC08
  1. 32
      run.ps1
  2. 22
      run.sh

32
run.ps1

@ -40,7 +40,7 @@ if ("${env:BITWARDEN_CERTBOT_HTTPS_PORT}" -ne "") {
function Install() { function Install() {
[string]$letsEncrypt = "n" [string]$letsEncrypt = "n"
Write-Host "(!) " -f cyan -nonewline Write-Host "(!) " -f cyan -nonewline
[string]$domain = $( Read-Host "Enter the domain name for your Bitwarden instance (ex. bitwarden.example.com)" ) [string]$domain = $( Read-Host "Enter the domain name for your Bitwarden instance (ex. bitwarden.example.com) [localhost]" )
echo "" echo ""
if ($domain -eq "") { if ($domain -eq "") {
@ -49,10 +49,10 @@ function Install() {
if ($domain -ne "localhost") { if ($domain -ne "localhost") {
Write-Host "(!) " -f cyan -nonewline Write-Host "(!) " -f cyan -nonewline
$letsEncrypt = $( Read-Host "Do you want to use Let's Encrypt to generate a free SSL certificate? (y/n)" ) $letsEncrypt = $( Read-Host "Do you want to use Let's Encrypt to generate a free SSL certificate? (y/N)" )
echo "" echo ""
if ($letsEncrypt -eq "y") { if ($letsEncrypt.ToLower() -eq "y") {
Write-Host "(!) " -f cyan -nonewline Write-Host "(!) " -f cyan -nonewline
[string]$email = $( Read-Host ("Enter your email address (Let's Encrypt will send you certificate " + [string]$email = $( Read-Host ("Enter your email address (Let's Encrypt will send you certificate " +
"expiration reminders)") ) "expiration reminders)") )
@ -72,7 +72,7 @@ function Install() {
} }
Write-Host "(!) " -f cyan -nonewline Write-Host "(!) " -f cyan -nonewline
[string]$database = $( Read-Host "Enter the database name for your Bitwarden instance (ex. vault): ") [string]$database = $( Read-Host "Enter the database name for your Bitwarden instance [vault]: ")
echo "" echo ""
if ($database -eq "") { if ($database -eq "") {
@ -185,35 +185,37 @@ function Update([switch] $withpull) {
} }
function Uninstall() { function Uninstall() {
$keepDatabase = $(Write-Host "(WARNING: UNINSTALL STARTED) Would you like to save the database files? (y/n)" -f red -nonewline) + $(Read-host) $keepDatabase = $(Write-Host "(WARNING: UNINSTALL STARTED) Would you like to save the database files? (y/N)" -f red -nonewline) + $(Read-host)
if ($keepDatabase -eq "y") { if ($keepDatabase.ToLower() -eq "y") {
Write-Host "Saving database." Write-Host "Saving database."
Compress-Archive -Path "${outputDir}\mssql" -DestinationPath ".\bitwarden_database.zip" Compress-Archive -Path "${outputDir}\mssql" -DestinationPath ".\bitwarden_database.zip"
Write-Host "(SAVED DATABASE FILES: YES) `n(WARNING: ALL DATA WILL BE REMOVED, INCLUDING THE FOLDER $outputDir) " -f red -nonewline Write-Host "(SAVED DATABASE FILES: YES) `n(WARNING: ALL DATA WILL BE REMOVED, INCLUDING THE FOLDER $outputDir) " -f red -nonewline
$uninstallAction = $( Read-Host "Are you sure you want to uninstall Bitwarden? (y/n)" ) $uninstallAction = $( Read-Host "Are you sure you want to uninstall Bitwarden? (y/N)" )
} else { }
else {
Write-Host "(WARNING: ALL DATA WILL BE REMOVED, INCLUDING THE FOLDER $outputDir) " -f red -nonewline Write-Host "(WARNING: ALL DATA WILL BE REMOVED, INCLUDING THE FOLDER $outputDir) " -f red -nonewline
$uninstallAction = $( Read-Host "Are you sure you want to uninstall Bitwarden? (y/n)" ) $uninstallAction = $( Read-Host "Are you sure you want to uninstall Bitwarden? (y/N)" )
} }
if ($uninstallAction -eq "y") { if ($uninstallAction.ToLower() -eq "y") {
Write-Host "uninstalling Bitwarden..." Write-Host "uninstalling Bitwarden..."
Docker-Compose-Down Docker-Compose-Down
Write-Host "Removing $outputDir" Write-Host "Removing $outputDir"
Remove-Item -Path $outputDir -Force -Recurse Remove-Item -Path $outputDir -Force -Recurse
Write-Host "Bitwarden uninstall complete!" Write-Host "Bitwarden uninstall complete!"
} else { }
else {
Write-Host "Bitwarden uninstall canceled." Write-Host "Bitwarden uninstall canceled."
Exit Exit
} }
Write-Host "(!) " -f red -nonewline Write-Host "(!) " -f red -nonewline
$purgeAction = $( Read-Host "Would you like to purge all local Bitwarden container images? (y/n)" ) $purgeAction = $( Read-Host "Would you like to purge all local Bitwarden container images? (y/N)" )
if ($purgeAction -eq "y") { if ($purgeAction.ToLower() -eq "y") {
Docker-Prune Docker-Prune
} }
} }
function Print-Environment { function Print-Environment {

22
run.sh

@ -60,7 +60,7 @@ fi
function install() { function install() {
LETS_ENCRYPT="n" LETS_ENCRYPT="n"
echo -e -n "${CYAN}(!)${NC} Enter the domain name for your Bitwarden instance (ex. bitwarden.example.com): " echo -e -n "${CYAN}(!)${NC} Enter the domain name for your Bitwarden instance (ex. bitwarden.example.com) [localhost]: "
read DOMAIN read DOMAIN
echo "" echo ""
@ -71,11 +71,11 @@ function install() {
if [ "$DOMAIN" != "localhost" ] if [ "$DOMAIN" != "localhost" ]
then then
echo -e -n "${CYAN}(!)${NC} Do you want to use Let's Encrypt to generate a free SSL certificate? (y/n): " echo -e -n "${CYAN}(!)${NC} Do you want to use Let's Encrypt to generate a free SSL certificate? (y/N): "
read LETS_ENCRYPT read LETS_ENCRYPT
echo "" echo ""
if [ "$LETS_ENCRYPT" == "y" ] if [[ "$LETS_ENCRYPT" == "y" || "$LETS_ENCRYPT" == "Y" ]]
then then
echo -e -n "${CYAN}(!)${NC} Enter your email address (Let's Encrypt will send you certificate expiration reminders): " echo -e -n "${CYAN}(!)${NC} Enter your email address (Let's Encrypt will send you certificate expiration reminders): "
read EMAIL read EMAIL
@ -89,7 +89,7 @@ function install() {
fi fi
fi fi
echo -e -n "${CYAN}(!)${NC} Enter the database name for your Bitwarden instance (ex. vault): " echo -e -n "${CYAN}(!)${NC} Enter the database name for your Bitwarden instance [vault]: "
read DATABASE read DATABASE
echo "" echo ""
@ -236,22 +236,22 @@ function update() {
} }
function uninstall() { function uninstall() {
echo -e -n "${RED}(WARNING: UNINSTALL STARTED) Would you like to save the database files? (y/n): ${NC}" echo -e -n "${RED}(WARNING: UNINSTALL STARTED) Would you like to save the database files? (y/N): ${NC}"
read KEEP_DATABASE read KEEP_DATABASE
if [ "$KEEP_DATABASE" == "y" ] if [[ "$KEEP_DATABASE" == "y" || "$KEEP_DATABASE" == "Y" ]]
then then
echo "Saving database files." echo "Saving database files."
tar -cvzf "./bitwarden_database.tar.gz" "$OUTPUT_DIR/mssql" tar -cvzf "./bitwarden_database.tar.gz" "$OUTPUT_DIR/mssql"
echo -e -n "${RED}(SAVED DATABASE FILES: YES): WARNING: ALL DATA WILL BE REMOVED, INCLUDING THE FOLDER $OUTPUT_DIR): Are you sure you want to uninstall Bitwarden? (y/n): ${NC}" echo -e -n "${RED}(SAVED DATABASE FILES: YES): WARNING: ALL DATA WILL BE REMOVED, INCLUDING THE FOLDER $OUTPUT_DIR): Are you sure you want to uninstall Bitwarden? (y/N): ${NC}"
read UNINSTALL_ACTION read UNINSTALL_ACTION
else else
echo -e -n "${RED}WARNING: ALL DATA WILL BE REMOVED, INCLUDING THE FOLDER $OUTPUT_DIR): Are you sure you want to uninstall Bitwarden? (y/n): ${NC}" echo -e -n "${RED}WARNING: ALL DATA WILL BE REMOVED, INCLUDING THE FOLDER $OUTPUT_DIR): Are you sure you want to uninstall Bitwarden? (y/N): ${NC}"
read UNINSTALL_ACTION read UNINSTALL_ACTION
fi fi
if [ "$UNINSTALL_ACTION" == "y" ] if [[ "$UNINSTALL_ACTION" == "y" || "$UNINSTALL_ACTION" == "Y" ]]
then then
echo "Uninstalling Bitwarden..." echo "Uninstalling Bitwarden..."
dockerComposeDown dockerComposeDown
@ -265,9 +265,9 @@ function uninstall() {
exit 1 exit 1
fi fi
echo -e -n "${RED}(!) Would you like to purge all local Bitwarden container images? (y/n): ${NC}" echo -e -n "${RED}(!) Would you like to purge all local Bitwarden container images? (y/N): ${NC}"
read PURGE_ACTION read PURGE_ACTION
if [ "$PURGE_ACTION" == "y" ] if [[ "$PURGE_ACTION" == "y" || "$PURGE_ACTION" == "Y" ]]
then then
dockerPrune dockerPrune
echo -e -n "${CYAN}Bitwarden uninstall complete! ${NC}" echo -e -n "${CYAN}Bitwarden uninstall complete! ${NC}"

Loading…
Cancel
Save