diff --git a/.gitignore b/.gitignore index 7c47be4f..a75a9e67 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ embark_db/ www/ .venv/ safe/ +.embark_db_backup # other stuff *.zip diff --git a/export-DB.sh b/export-DB.sh index e14a92f6..c429c9f3 100755 --- a/export-DB.sh +++ b/export-DB.sh @@ -49,20 +49,5 @@ fi echo "USER is ${SUDO_USER:-${USER}}" import_helper - -# WSL/OS version check -# WSL support - currently experimental! -if grep -q -i wsl /proc/version; then - echo -e "\n${ORANGE}INFO: System running in WSL environment!$NC" - echo -e "\n${ORANGE}INFO: WSL is currently experimental!$NC" - WSL=1 -fi - -if [[ "$WSL" -eq 1 ]]; then - check_docker_wsl -fi - -# read .env file -export "$(grep -v '^#' .env | xargs)" - -docker-compose exec -T --privileged --user root embark_db mysqldump --user="$DATABASE_USER" --password="$DATABASE_PASSWORD" "$DATABASE_NAME" --no-tablespaces > full-backup-"$(date +%F)".sql \ No newline at end of file +cp -urvi ./embark_db ./.embark_db_backup +tar -cf full-backup-"$(date +%F)".tar ./.embark_db_backup \ No newline at end of file diff --git a/import-DB.sh b/import-DB.sh index 0c533cb5..89aea6fa 100755 --- a/import-DB.sh +++ b/import-DB.sh @@ -38,11 +38,16 @@ import_helper() echo -e "\\n""==> ""$GREEN""Imported ""$HELPER_COUNT"" necessary files""$NC\\n" } -SQL_FILE="${1:-}" - -if ! [[ -f "$SQL_FILE" ]]; then - echo -e "\\n$RED""No SQL-FILE supplied!""$NC\\n" - exit 1 +ALT_BACKUP_FILE="${1:-}" +export BACKUP_FILE="" +if [[ -n "${ALT_BACKUP_FILE}" ]]; then + if ! [[ -f "${ALT_BACKUP_FILE}" ]]; then + echo -e "\\n$RED""Error with input for BACKUP FILE!""$NC\\n" + exit 1 + fi + BACKUP_FILE="${ALT_BACKUP_FILE}" +else + BACKUP_FILE="$(find . -type f -iname "full-backup-*.tar" | sort -n | tail -n 1)" fi cd "$(dirname "$0")" || exit 1 @@ -56,25 +61,10 @@ echo "USER is ${SUDO_USER:-${USER}}" import_helper -# WSL/OS version check -# WSL support - currently experimental! -if grep -q -i wsl /proc/version; then - echo -e "\n${ORANGE}INFO: System running in WSL environment!$NC" - echo -e "\n${ORANGE}INFO: WSL is currently experimental!$NC" - WSL=1 -fi - -if [[ "$WSL" -eq 1 ]]; then - check_docker_wsl -fi - -# read .env file -export "$(grep -v '^#' .env | xargs)" - -docker-compose -f ./docker-compose.yml up -d +tar -xf "${BACKUP_FILE}" -echo "$SQL_FILE" +rsync -a --progress ./.embark_db_backup/ ./embark_db/ -docker-compose exec -T --privileged --user root embark_db mysql --user="$DATABASE_USER" --password="$DATABASE_PASSWORD" "$DATABASE_NAME" < "$SQL_FILE" +rm -rf ./.embark_db_backup/ echo -e "\\n""==> ""$GREEN""Import successful""$NC" \ No newline at end of file diff --git a/installer.sh b/installer.sh index d195deda..63650bc3 100755 --- a/installer.sh +++ b/installer.sh @@ -465,6 +465,9 @@ uninstall (){ if [[ -d ./static ]]; then rm -Rv ./static fi + if [[ -d ./embark/static/external ]]; then + rm -Rv ./embark/static/external + fi if [[ -d ./cert ]]; then rm -Rv ./cert fi @@ -511,7 +514,7 @@ uninstall (){ # delete .env echo -e "$ORANGE""$BOLD""Delete env""$NC" if [[ -f ./.env ]]; then - rm ./.env + rm -Rvf ./.env fi # delete shared volumes and migrations