mirror of
https://github.com/lalanza808/xmr.sh.git
synced 2025-05-11 20:45:06 -04:00
uninstall: clean excluding data
This commit is contained in:
parent
3c232d9672
commit
b2ab5d2ab5
1 changed files with 19 additions and 4 deletions
23
uninstall
23
uninstall
|
@ -34,6 +34,16 @@ XMRSH_LOG_FILE="/tmp/xmr.sh-$(date +%Y%m%d-%H%M%S).log"
|
||||||
# Functions #
|
# Functions #
|
||||||
################################################################
|
################################################################
|
||||||
|
|
||||||
|
check_root() {
|
||||||
|
echo -ne "${OkBullet}Checking root... ${Off}"
|
||||||
|
if [[ $EUID -ne 0 ]]; then
|
||||||
|
echo -e "${Fail}"
|
||||||
|
echo -e "${ErrBullet}You need to run this script as root (UID=0).${Off}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo -e "${Ok}"
|
||||||
|
}
|
||||||
|
|
||||||
check_return() {
|
check_return() {
|
||||||
if [ "$1" -ne 0 ]; then
|
if [ "$1" -ne 0 ]; then
|
||||||
echo -e "${Fail}"
|
echo -e "${Fail}"
|
||||||
|
@ -43,20 +53,21 @@ check_return() {
|
||||||
}
|
}
|
||||||
|
|
||||||
uninstall() {
|
uninstall() {
|
||||||
pushd $XMRSH_DIR || check_return $?
|
pushd $XMRSH_DIR >>"${XMRSH_LOG_FILE}" 2>&1 || check_return $?
|
||||||
echo -e "${OkBullet}Uninstalling xmr.sh..."
|
echo -e "${OkBullet}Uninstalling xmr.sh..."
|
||||||
docker-compose down >>"${XMRSH_LOG_FILE}" 2>&1
|
if [ -f docker-compose.yml ]; then
|
||||||
|
docker-compose down >>"${XMRSH_LOG_FILE}" 2>&1
|
||||||
|
fi
|
||||||
check_return $?
|
check_return $?
|
||||||
while true; do
|
while true; do
|
||||||
read -r -e -p " Do you want to keep the data directory with the blockchain and other data files? [y/n]: " yn
|
read -r -e -p " Do you want to keep the data directory with the blockchain and other data files? [y/n]: " yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]*)
|
[Yy]*)
|
||||||
rm -rf !("data")
|
find . -type f -not -name 'data' -print0 | xargs -0 -I {} rm {}
|
||||||
check_return $?
|
check_return $?
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
[Nn]*)
|
[Nn]*)
|
||||||
popd || check_return $?
|
|
||||||
rm -rf ./*
|
rm -rf ./*
|
||||||
check_return $?
|
check_return $?
|
||||||
break
|
break
|
||||||
|
@ -64,7 +75,11 @@ uninstall() {
|
||||||
*) echo " Please answer yes or no." ;;
|
*) echo " Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
popd || check_return $?
|
||||||
echo -e "${OkBullet}Uninstall complete."
|
echo -e "${OkBullet}Uninstall complete."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_root
|
||||||
|
uninstall
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue