Revert "escaped every parameter in all scripts"

This reverts commit c0897eebb7.
This commit is contained in:
ttionya
2021-02-24 01:03:26 +08:00
parent 8528a048f7
commit 0304ca7929
7 changed files with 40 additions and 40 deletions
+19 -19
View File
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
. /app/includes.sh
@@ -9,7 +9,7 @@ RESTORE_FILE_ZIP=""
ZIP_PASSWORD=""
function clear_extract_dir() {
rm -rf "${RESTORE_EXTRACT_DIR}"
rm -rf ${RESTORE_EXTRACT_DIR}
}
function restore_zip() {
@@ -20,9 +20,9 @@ function restore_zip() {
local FIND_FILE_ATTACHMENTS
if [[ -n "${ZIP_PASSWORD}" ]]; then
unzip -P "${ZIP_PASSWORD}" "${RESTORE_FILE_ZIP}" -d "${RESTORE_EXTRACT_DIR}"
unzip -P ${ZIP_PASSWORD} ${RESTORE_FILE_ZIP} -d ${RESTORE_EXTRACT_DIR}
else
unzip "${RESTORE_FILE_ZIP}" -d "${RESTORE_EXTRACT_DIR}"
unzip ${RESTORE_FILE_ZIP} -d ${RESTORE_EXTRACT_DIR}
fi
if [[ $? == 0 ]]; then
@@ -34,21 +34,21 @@ function restore_zip() {
# get restore db file
RESTORE_FILE_DB=""
FIND_FILE_DB="$( basename "$(ls ${RESTORE_EXTRACT_DIR}/db.*.sqlite3)" )"
FIND_FILE_DB=$(basename $(ls ${RESTORE_EXTRACT_DIR}/db.*.sqlite3))
if [[ -n "${FIND_FILE_DB}" ]]; then
RESTORE_FILE_DB="extract/${FIND_FILE_DB}"
fi
# get restore config file
RESTORE_FILE_CONFIG=""
FIND_FILE_CONFIG="$( basename "$(ls ${RESTORE_EXTRACT_DIR}/config.*.json)" )"
FIND_FILE_CONFIG=$(basename $(ls ${RESTORE_EXTRACT_DIR}/config.*.json))
if [[ -n "${FIND_FILE_CONFIG}" ]]; then
RESTORE_FILE_CONFIG="extract/${FIND_FILE_CONFIG}"
fi
# get restore attachments file
RESTORE_FILE_ATTACHMENTS=""
FIND_FILE_ATTACHMENTS="$( basename "$(ls ${RESTORE_EXTRACT_DIR}/attachments.*.tar)" )"
FIND_FILE_ATTACHMENTS=$(basename $(ls ${RESTORE_EXTRACT_DIR}/attachments.*.tar))
if [[ -n "${FIND_FILE_ATTACHMENTS}" ]]; then
RESTORE_FILE_ATTACHMENTS="extract/${FIND_FILE_ATTACHMENTS}"
fi
@@ -60,7 +60,7 @@ function restore_zip() {
function restore_db() {
color blue "restore bitwarden_rs sqlite database"
cp -f "${RESTORE_FILE_DB}" "${DATA_DB}"
cp -f ${RESTORE_FILE_DB} ${DATA_DB}
if [[ $? == 0 ]]; then
color green "restore bitwarden_rs sqlite database successful"
@@ -72,7 +72,7 @@ function restore_db() {
function restore_config() {
color blue "restore bitwarden_rs config"
cp -f "${RESTORE_FILE_CONFIG}" "${DATA_CONFIG}"
cp -f ${RESTORE_FILE_CONFIG} ${DATA_CONFIG}
if [[ $? == 0 ]]; then
color green "restore bitwarden_rs config successful"
@@ -84,8 +84,8 @@ function restore_config() {
function restore_attachments() {
color blue "restore bitwarden_rs attachments"
rm -rf "${DATA_ATTACHMENTS}"
tar -x -C "${DATA_DIR}" -f "${RESTORE_FILE_ATTACHMENTS}"
rm -rf ${DATA_ATTACHMENTS}
tar -x -C ${DATA_DIR} -f ${RESTORE_FILE_ATTACHMENTS}
if [[ $? == 0 ]]; then
color green "restore bitwarden_rs attachments successful"
@@ -103,7 +103,7 @@ function check_restore_file_exist() {
function restore_file() {
if [[ -n "${RESTORE_FILE_ZIP}" ]]; then
check_restore_file_exist "${RESTORE_FILE_ZIP}" "--zip-file"
check_restore_file_exist ${RESTORE_FILE_ZIP} "--zip-file"
RESTORE_FILE_ZIP="${RESTORE_DIR}/${RESTORE_FILE_ZIP}"
@@ -112,19 +112,19 @@ function restore_file() {
clear_extract_dir
else
if [[ -n "${RESTORE_FILE_DB}" ]]; then
check_restore_file_exist "${RESTORE_FILE_DB}" "--db-file"
check_restore_file_exist ${RESTORE_FILE_DB} "--db-file"
RESTORE_FILE_DB="${RESTORE_DIR}/${RESTORE_FILE_DB}"
fi
if [[ -n "${RESTORE_FILE_CONFIG}" ]]; then
check_restore_file_exist "${RESTORE_FILE_CONFIG}" "--config-file"
check_restore_file_exist ${RESTORE_FILE_CONFIG} "--config-file"
RESTORE_FILE_CONFIG="${RESTORE_DIR}/${RESTORE_FILE_CONFIG}"
fi
if [[ -n "${RESTORE_FILE_ATTACHMENTS}" ]]; then
check_restore_file_exist "${RESTORE_FILE_ATTACHMENTS}" "--attachments-file"
check_restore_file_exist ${RESTORE_FILE_ATTACHMENTS} "--attachments-file"
RESTORE_FILE_ATTACHMENTS="${RESTORE_DIR}/${RESTORE_FILE_ATTACHMENTS}"
fi
@@ -169,22 +169,22 @@ function restore() {
;;
--zip-file)
shift
RESTORE_FILE_ZIP="$(basename "$1")"
RESTORE_FILE_ZIP=$(basename "$1")
shift
;;
--db-file)
shift
RESTORE_FILE_DB="$(basename "$1")"
RESTORE_FILE_DB=$(basename "$1")
shift
;;
--config-file)
shift
RESTORE_FILE_CONFIG="$(basename "$1")"
RESTORE_FILE_CONFIG=$(basename "$1")
shift
;;
--attachments-file)
shift
RESTORE_FILE_ATTACHMENTS="$(basename "$1")"
RESTORE_FILE_ATTACHMENTS=$(basename "$1")
shift
;;
*)