runtipi/scripts/unsafe-cleanup.sh
Nicolas Meienberger a92b5857f8 feat: cleanup folder before install
If an app gets installed insure that any existing folder in apps gets deleted. This will prevent the
user from getting in a limbo if an installation fails and the files are copied already
2022-08-23 21:16:14 +02:00

29 lines
747 B
Bash
Executable file

#!/usr/bin/env bash
#set -e # Exit immediately if a command exits with a non-zero status.
# Prompt to confirm
echo "This will reset your system to factory defaults. Are you sure you want to do this? (y/n)"
read confirm
if [ "$confirm" != "y" ]; then
echo "Aborting."
exit 1
fi
ROOT_FOLDER="$(readlink -f $(dirname "${BASH_SOURCE[0]}")/..)"
# Stop Tipi
"${ROOT_FOLDER}/scripts/stop.sh"
echo y | docker system prune
echo y | docker volume prune
echo y | docker network prune
echo y | docker container prune
echo y | docker image prune -a
# Remove everything in app-data folder
rm -rf "${ROOT_FOLDER}/app-data"
rm -rf "${ROOT_FOLDER}/data/postgres"
mkdir -p "${ROOT_FOLDER}/app-data"
cd "$ROOT_FOLDER"
"${ROOT_FOLDER}/scripts/start.sh"