exit-script fix

pull/1312/head
nicedevil007 2 years ago
parent f7ab4fda4a
commit 62586bcb41
  1. 9
      ct/alpine-vaultwarden.sh
  2. 14
      install/alpine-vaultwarden-install.sh

@ -1,9 +1,9 @@
#!/usr/bin/env bash
source <(curl -s https://raw.githubusercontent.com/nicedevil007/Proxmox/main/misc/build.func)
# Copyright (c) 2021-2023 tteck
# Author: tteck (tteckster)
# Copyright (c) 2021-2023 nicedevil007
# Author: nicedevil007 (nicedevil007ster)
# License: MIT
# https://github.com/tteck/Proxmox/raw/main/LICENSE
# https://github.com/nicedevil007/Proxmox/raw/main/LICENSE
function header_info {
clear
@ -73,13 +73,14 @@ function update_script() {
exit
;;
2)
NEWTOKEN=$(whiptail --passwordbox "Setup your ADMIN-TOKEN (make it strong)" 10 58 3>&1 1>&2 2>&3)
if NEWTOKEN=$(whiptail --passwordbox "Setup your ADMIN-TOKEN (make it strong)" 10 58 3>&1 1>&2 2>&3); then
if [[ -z "$NEWTOKEN" ]]; then exit-script; fi
ADMINTOKEN=$(echo -n ${NEWTOKEN} | argon2 "$(openssl rand -base64 32)" -e -id -k 19456 -t 2 -p 1)
if [[ -f /var/lib/vaultwarden/config.json ]]; then
sed -i '/admin_token/d' /var/lib/vaultwarden/config.json
sed -i "2i\\ \"admin_token\": \"$ADMINTOKEN\"" /var/lib/vaultwarden/config.json
fi
fi
cat <<EOF >/etc/conf.d/vaultwarden
export DATA_FOLDER=/var/lib/vaultwarden
export WEB_VAULT_FOLDER=/var/lib/vaultwarden/web-vault

@ -1,9 +1,9 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2023 tteck
# Author: tteck (tteckster)
# Copyright (c) 2021-2023 nicedevil007
# Author: nicedevil007 (nicedevil007ster)
# License: MIT
# https://github.com/tteck/Proxmox/raw/main/LICENSE
# https://github.com/nicedevil007/Proxmox/raw/main/LICENSE
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
color
@ -19,9 +19,8 @@ $STD apk add openssl
$STD apk add argon2
msg_ok "Installed Dependencies"
NEWTOKEN=$(whiptail --passwordbox "Setup your ADMIN-TOKEN (make it strong)" 10 58 3>&1 1>&2 2>&3)
if [[ ! -z "$NEWTOKEN" ]]; then
ADMINTOKEN=$(echo -n ${NEWTOKEN} | argon2 "$(openssl rand -base64 32)" -e -id -k 19456 -t 2 -p 1)
if NEWTOKEN=$(whiptail --passwordbox "Setup your ADMIN-TOKEN (make it strong)" 10 58 3>&1 1>&2 2>&3); then
if [[ -z "$NEWTOKEN" ]]; then exit-script; fi
else
exit-script
fi
@ -29,6 +28,7 @@ clear
msg_info "Installing Alpine-Vaultwarden"
$STD apk add vaultwarden
ADMINTOKEN=$(echo -n ${NEWTOKEN} | argon2 "$(openssl rand -base64 32)" -e -id -k 19456 -t 2 -p 1)
cat <<EOF >/etc/conf.d/vaultwarden
export DATA_FOLDER=/var/lib/vaultwarden
export WEB_VAULT_FOLDER=/var/lib/vaultwarden/web-vault
@ -36,8 +36,6 @@ export WEB_VAULT_ENABLED=true
export ADMIN_TOKEN='$ADMINTOKEN'
export ROCKET_ADDRESS=0.0.0.0
EOF
#sed -i '/admin_token/d' /var/lib/vaultwarden/config.json
#sed -i "2i\\ \"admin_token\": \"$ADMINTOKEN\"" /var/lib/vaultwarden/config.json
$STD rc-service vaultwarden start
$STD rc-update add vaultwarden default
msg_ok "Installed Alpine-Vaultwarden"

Loading…
Cancel
Save