Fix datapack backup

This commit is contained in:
LinuxSquare 2024-01-06 17:11:14 +01:00
parent 2554113aa2
commit c6b0c245da
2 changed files with 13 additions and 13 deletions

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
# CONSTANTS
readonly PKGVER="0.2.3"
readonly PKGVER="0.2.4"
readonly LICENSE="GNU AGPLv3"
readonly ROOTPATH="$(dirname $(readlink -f $(which $0)))"
readonly TEMPLATEDIR="${ROOTPATH}/.template"

View file

@ -20,18 +20,18 @@ function reset() {
done
local backedup=false
while [[ ! $backupDatapacksAns =~ [YyNn] ]]; do
read -p "Do you want to backup the datapack .zip found in $datapack_dir ?: " backupDatapacksAns
case "$backupDatapacksAns" in
"Y"|"y")
if [[ -n $(find "${datapack_dir}" -maxdepth 1 -type f) ]]; then
local backedup=true
local tempdir=$(mktemp -d /tmp/pms-cli.XXXXXX)
mv ${datapack_dir}/*.zip ${tempdir}/
fi
;;
esac
done
if [[ -n $(find "${datapack_dir}" -maxdepth 1 -type f) ]]; then
while [[ ! $backupDatapacksAns =~ [YyNn] ]]; do
read -p "Do you want to backup the datapack .zip found in $datapack_dir ?: " backupDatapacksAns
case "$backupDatapacksAns" in
"Y"|"y")
local backedup=true
local tempdir=$(mktemp -d /tmp/pms-cli.XXXXXX)
mv ${datapack_dir}/*.zip ${tempdir}/
;;
esac
done
fi
rm -rf "$dir/data"
mkdir -p "$dir/data/world/datapacks"