feat: rename to vaultwarden

This commit is contained in:
ttionya
2021-05-06 20:27:17 +08:00
parent c442d097c3
commit 4a43025658
5 changed files with 41 additions and 41 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
FROM rclone/rclone:1.55.0 FROM rclone/rclone:1.55.1
LABEL "repository"="https://github.com/ttionya/BitwardenRS-Backup" \ LABEL "repository"="https://github.com/ttionya/vaultwarden-backup" \
"homepage"="https://github.com/ttionya/BitwardenRS-Backup" \ "homepage"="https://github.com/ttionya/vaultwarden-backup" \
"maintainer"="ttionya <git@ttionya.com>" "maintainer"="ttionya <git@ttionya.com>"
COPY scripts/*.sh /app/ COPY scripts/*.sh /app/
+15 -15
View File
@@ -8,42 +8,42 @@ function clear_dir() {
function backup_init() { function backup_init() {
NOW="$(date +"${BACKUP_FILE_DATE_FORMAT}")" NOW="$(date +"${BACKUP_FILE_DATE_FORMAT}")"
# backup bitwarden_rs database file # backup vaultwarden database file
BACKUP_FILE_DB="${BACKUP_DIR}/db.${NOW}.sqlite3" BACKUP_FILE_DB="${BACKUP_DIR}/db.${NOW}.sqlite3"
# backup bitwarden_rs config file # backup vaultwarden config file
BACKUP_FILE_CONFIG="${BACKUP_DIR}/config.${NOW}.json" BACKUP_FILE_CONFIG="${BACKUP_DIR}/config.${NOW}.json"
# backup bitwarden_rs rsakey files # backup vaultwarden rsakey files
BACKUP_FILE_RSAKEY="${BACKUP_DIR}/rsakey.${NOW}.tar" BACKUP_FILE_RSAKEY="${BACKUP_DIR}/rsakey.${NOW}.tar"
# backup bitwarden_rs attachments directory # backup vaultwarden attachments directory
BACKUP_FILE_ATTACHMENTS="${BACKUP_DIR}/attachments.${NOW}.tar" BACKUP_FILE_ATTACHMENTS="${BACKUP_DIR}/attachments.${NOW}.tar"
# backup bitwarden_rs sends directory # backup vaultwarden sends directory
BACKUP_FILE_SENDS="${BACKUP_DIR}/sends.${NOW}.tar" BACKUP_FILE_SENDS="${BACKUP_DIR}/sends.${NOW}.tar"
# backup zip file # backup zip file
BACKUP_FILE_ZIP="${BACKUP_DIR}/backup.${NOW}.${ZIP_TYPE}" BACKUP_FILE_ZIP="${BACKUP_DIR}/backup.${NOW}.${ZIP_TYPE}"
} }
function backup_db() { function backup_db() {
color blue "backup bitwarden_rs sqlite database" color blue "backup vaultwarden sqlite database"
if [[ -f "${DATA_DB}" ]]; then if [[ -f "${DATA_DB}" ]]; then
sqlite3 "${DATA_DB}" ".backup '${BACKUP_FILE_DB}'" sqlite3 "${DATA_DB}" ".backup '${BACKUP_FILE_DB}'"
else else
color yellow "not found bitwarden_rs sqlite database, skipping" color yellow "not found vaultwarden sqlite database, skipping"
fi fi
} }
function backup_config() { function backup_config() {
color blue "backup bitwarden_rs config" color blue "backup vaultwarden config"
if [[ -f "${DATA_CONFIG}" ]]; then if [[ -f "${DATA_CONFIG}" ]]; then
cp -f "${DATA_CONFIG}" "${BACKUP_FILE_CONFIG}" cp -f "${DATA_CONFIG}" "${BACKUP_FILE_CONFIG}"
else else
color yellow "not found bitwarden_rs config, skipping" color yellow "not found vaultwarden config, skipping"
fi fi
} }
function backup_rsakey() { function backup_rsakey() {
color blue "backup bitwarden_rs rsakey" color blue "backup vaultwarden rsakey"
local FIND_RSAKEY=$(find "${DATA_RSAKEY_DIRNAME}" -name "${DATA_RSAKEY_BASENAME}*" | xargs -I {} basename {}) local FIND_RSAKEY=$(find "${DATA_RSAKEY_DIRNAME}" -name "${DATA_RSAKEY_BASENAME}*" | xargs -I {} basename {})
local FIND_RSAKEY_COUNT=$(echo "${FIND_RSAKEY}" | wc -l) local FIND_RSAKEY_COUNT=$(echo "${FIND_RSAKEY}" | wc -l)
@@ -55,12 +55,12 @@ function backup_rsakey() {
tar -tf "${BACKUP_FILE_RSAKEY}" tar -tf "${BACKUP_FILE_RSAKEY}"
else else
color yellow "not found bitwarden_rs rsakey, skipping" color yellow "not found vaultwarden rsakey, skipping"
fi fi
} }
function backup_attachments() { function backup_attachments() {
color blue "backup bitwarden_rs attachments" color blue "backup vaultwarden attachments"
if [[ -d "${DATA_ATTACHMENTS}" ]]; then if [[ -d "${DATA_ATTACHMENTS}" ]]; then
tar -c -C "${DATA_ATTACHMENTS_DIRNAME}" -f "${BACKUP_FILE_ATTACHMENTS}" "${DATA_ATTACHMENTS_BASENAME}" tar -c -C "${DATA_ATTACHMENTS_DIRNAME}" -f "${BACKUP_FILE_ATTACHMENTS}" "${DATA_ATTACHMENTS_BASENAME}"
@@ -69,12 +69,12 @@ function backup_attachments() {
tar -tf "${BACKUP_FILE_ATTACHMENTS}" tar -tf "${BACKUP_FILE_ATTACHMENTS}"
else else
color yellow "not found bitwarden_rs attachments directory, skipping" color yellow "not found vaultwarden attachments directory, skipping"
fi fi
} }
function backup_sends() { function backup_sends() {
color blue "backup bitwarden_rs sends" color blue "backup vaultwarden sends"
if [[ -d "${DATA_SENDS}" ]]; then if [[ -d "${DATA_SENDS}" ]]; then
tar -c -C "${DATA_SENDS_DIRNAME}" -f "${BACKUP_FILE_SENDS}" "${DATA_SENDS_BASENAME}" tar -c -C "${DATA_SENDS_DIRNAME}" -f "${BACKUP_FILE_SENDS}" "${DATA_SENDS_BASENAME}"
@@ -83,7 +83,7 @@ function backup_sends() {
tar -tf "${BACKUP_FILE_SENDS}" tar -tf "${BACKUP_FILE_SENDS}"
else else
color yellow "not found bitwarden_rs sends directory, skipping" color yellow "not found vaultwarden sends directory, skipping"
fi fi
} }
+1 -1
View File
@@ -20,7 +20,7 @@ if [[ "$1" == "mail" ]]; then
init_env init_env
send_mail "BitwardenRS Backup Test" "Your SMTP looks configured correctly." send_mail "vaultwarden Backup Test" "Your SMTP looks configured correctly."
exit 0 exit 0
fi fi
+2 -2
View File
@@ -95,12 +95,12 @@ function send_mail_content() {
# successful # successful
if [[ "$1" == "TRUE" && "${MAIL_WHEN_SUCCESS}" == "TRUE" ]]; then if [[ "$1" == "TRUE" && "${MAIL_WHEN_SUCCESS}" == "TRUE" ]]; then
send_mail "BitwardenRS Backup Success" "$2" send_mail "vaultwarden Backup Success" "$2"
fi fi
# failed # failed
if [[ "$1" == "FALSE" && "${MAIL_WHEN_FAILURE}" == "TRUE" ]]; then if [[ "$1" == "FALSE" && "${MAIL_WHEN_FAILURE}" == "TRUE" ]]; then
send_mail "BitwardenRS Backup Failed" "$2" send_mail "vaultwarden Backup Failed" "$2"
fi fi
} }
+20 -20
View File
@@ -16,7 +16,7 @@ function clear_extract_dir() {
} }
function restore_zip() { function restore_zip() {
color blue "restore bitwarden_rs backup zip file" color blue "restore vaultwarden backup zip file"
local FIND_FILE_DB local FIND_FILE_DB
local FIND_FILE_CONFIG local FIND_FILE_CONFIG
@@ -31,9 +31,9 @@ function restore_zip() {
fi fi
if [[ $? == 0 ]]; then if [[ $? == 0 ]]; then
color green "extract bitwarden_rs backup zip file successful" color green "extract vaultwarden backup zip file successful"
else else
color red "extract bitwarden_rs backup zip file failed" color red "extract vaultwarden backup zip file failed"
exit 1 exit 1
fi fi
@@ -63,44 +63,44 @@ function restore_zip() {
} }
function restore_db() { function restore_db() {
color blue "restore bitwarden_rs sqlite database" color blue "restore vaultwarden sqlite database"
cp -f "${RESTORE_FILE_DB}" "${DATA_DB}" cp -f "${RESTORE_FILE_DB}" "${DATA_DB}"
if [[ $? == 0 ]]; then if [[ $? == 0 ]]; then
color green "restore bitwarden_rs sqlite database successful" color green "restore vaultwarden sqlite database successful"
else else
color red "restore bitwarden_rs sqlite database failed" color red "restore vaultwarden sqlite database failed"
fi fi
} }
function restore_config() { function restore_config() {
color blue "restore bitwarden_rs config" color blue "restore vaultwarden config"
cp -f "${RESTORE_FILE_CONFIG}" "${DATA_CONFIG}" cp -f "${RESTORE_FILE_CONFIG}" "${DATA_CONFIG}"
if [[ $? == 0 ]]; then if [[ $? == 0 ]]; then
color green "restore bitwarden_rs config successful" color green "restore vaultwarden config successful"
else else
color red "restore bitwarden_rs config failed" color red "restore vaultwarden config failed"
fi fi
} }
function restore_rsakey() { function restore_rsakey() {
color blue "restore bitwarden_rs rsakey" color blue "restore vaultwarden rsakey"
mkdir "${DATA_RSAKEY_DIRNAME}" mkdir "${DATA_RSAKEY_DIRNAME}"
tar -x -C "${DATA_RSAKEY_DIRNAME}" -f "${RESTORE_FILE_RSAKEY}" tar -x -C "${DATA_RSAKEY_DIRNAME}" -f "${RESTORE_FILE_RSAKEY}"
if [[ $? == 0 ]]; then if [[ $? == 0 ]]; then
color green "restore bitwarden_rs rsakey successful" color green "restore vaultwarden rsakey successful"
else else
color red "restore bitwarden_rs rsakey failed" color red "restore vaultwarden rsakey failed"
fi fi
} }
function restore_attachments() { function restore_attachments() {
color blue "restore bitwarden_rs attachments" color blue "restore vaultwarden attachments"
# When customizing the attachments folder, the root directory of the tar file # When customizing the attachments folder, the root directory of the tar file
# is the directory name at the time of packing # is the directory name at the time of packing
@@ -114,14 +114,14 @@ function restore_attachments() {
rm -rf "${DATA_ATTACHMENTS_EXTRACT}" rm -rf "${DATA_ATTACHMENTS_EXTRACT}"
if [[ $? == 0 ]]; then if [[ $? == 0 ]]; then
color green "restore bitwarden_rs attachments successful" color green "restore vaultwarden attachments successful"
else else
color red "restore bitwarden_rs attachments failed" color red "restore vaultwarden attachments failed"
fi fi
} }
function restore_sends() { function restore_sends() {
color blue "restore bitwarden_rs sends" color blue "restore vaultwarden sends"
# When customizing the sends folder, the root directory of the tar file # When customizing the sends folder, the root directory of the tar file
# is the directory name at the time of packing # is the directory name at the time of packing
@@ -135,9 +135,9 @@ function restore_sends() {
rm -rf "${DATA_SENDS_EXTRACT}" rm -rf "${DATA_SENDS_EXTRACT}"
if [[ $? == 0 ]]; then if [[ $? == 0 ]]; then
color green "restore bitwarden_rs sends successful" color green "restore vaultwarden sends successful"
else else
color red "restore bitwarden_rs sends failed" color red "restore vaultwarden sends failed"
fi fi
} }
@@ -210,14 +210,14 @@ function check_empty_input() {
if [[ -z "${RESTORE_FILE_ZIP}${RESTORE_FILE_DB}${RESTORE_FILE_CONFIG}${RESTORE_FILE_RSAKEY}${RESTORE_FILE_ATTACHMENTS}${RESTORE_FILE_SENDS}" ]]; then if [[ -z "${RESTORE_FILE_ZIP}${RESTORE_FILE_DB}${RESTORE_FILE_CONFIG}${RESTORE_FILE_RSAKEY}${RESTORE_FILE_ATTACHMENTS}${RESTORE_FILE_SENDS}" ]]; then
color yellow "Empty input" color yellow "Empty input"
color none "" color none ""
color none "Find out more at https://github.com/ttionya/BitwardenRS-Backup#restore" color none "Find out more at https://github.com/ttionya/vaultwarden-backup#restore"
exit 0 exit 0
fi fi
} }
function check_data_dir_exist() { function check_data_dir_exist() {
if [[ ! -d "${DATA_DIR}" ]]; then if [[ ! -d "${DATA_DIR}" ]]; then
color red "Bitwarden data directory not found" color red "vaultwarden data directory not found"
exit 1 exit 1
fi fi
} }