gravity-sync/includes/gs-purge.sh
Michael Stanclift d97f92ccea
3.3.3 is 3.4.0 (#185)
* new first line of script

* no requested

* Abort!

* Test silent folder validation

* sameline

* echo newline

* echo_sameline

* what happened?

* sameline for ssh

* sqlite sameline

* Lower case

* Reset line

* clear line

* Flip the line

* version update

* Backup lowercase

* More lowercase

* Remove file names from standard messages

* Breakout backup message

* Output backup folder size

* Just H

* Invalid replication settings

* Compare updated

* Colors and updates

* Lower case for version output

* For Pihole

* Cron cleanup

* Sudo, or no sudo.

* Branch!

* Silent error validate

* Silent error validate

* Clearing up status messages

* Records

* Primary and secondary

* Gravity database

* Domain Database

* Backup output cleanup

* Move file permission validation into new functions

* Change restart

* UI variables test

* Breakout UI variables into new file

* Unified validation functions

* Replace text strings with variables

* Replace text strings with variables

* Replace logging with variables

* Convert backup to UI variables

* Switch restore to UI variables

* Fix bug where gravity database did not restore

* App validation checks

* Rev to 3.4.0

* Convert Push functions to new strings

* Completing push UI changes

* remove added line

* Move purge to UI strings

* Move automation to UI strings

* Move core strings into UI

* Exit strings

* First pass at hashing UI

* Escape the remote system query (#179)

* hashing committed

Co-authored-by: Michael Stanclift <vmstan@mstanclift-a03.local>
Co-authored-by: Veduco <59983694+Veduco@users.noreply.github.com>
2021-04-01 15:16:20 -05:00

66 lines
1.9 KiB
Bash

# GRAVITY SYNC BY VMSTAN #####################
# gs-purge.sh ################################
# For documentation or downloading updates visit https://github.com/vmstan/gravity-sync
# This code is called from the main gravity-sync.sh file and should not execute directly!
## Purge Task
function task_purge {
TASKTYPE="THE-PURGE"
MESSAGE="${MESSAGE}: ${TASKTYPE}"
echo_good
echo_lines
echo -e "THIS WILL RESET YOUR ENTIRE GRAVITY SYNC INSTALLATION"
echo -e "This will remove:"
echo -e "- All backups files."
echo -e "- Your ${CONFIG_FILE} file."
if [ -f "${LOCAL_FOLDR}/dev" ]
then
echo -e "- Your development branch updater."
elif [ -f "${LOCAL_FOLDR}/beta" ]
then
echo -e "- Your beta branch updater."
fi
echo -e "- All cronjob/automation tasks."
echo -e "- All job history/logs."
echo -e "- Associated SSH id_rsa keys."
echo -e ""
echo -e "This function cannot be undone!"
echo -e ""
echo -e "YOU WILL NEED TO REBUILD GRAVITY SYNC AFTER EXECUTION"
echo -e "Pi-hole binaries, configuration and services ARE NOT impacted!"
echo -e "Your device will continue to resolve and block DNS requests,"
echo -e "but your ${UI_GRAVITY_NAME} and ${UI_CUSTOM_NAME} WILL NOT sync anymore,"
echo -e "until you reconfigure Gravity Sync on this device."
echo_lines
intent_validate
MESSAGE="${UI_PURGE_CLEANING_DIR}"
echo_stat
git clean -f -X -d >/dev/null 2>&1
error_validate
clear_cron
MESSAGE="${UI_PURGE_DELETE_SSH_KEYS}"
echo_stat
rm -f $HOME/${SSH_PKIF} >/dev/null 2>&1
rm -f $HOME/${SSH_PKIF}.pub >/dev/null 2>&1
error_validate
MESSAGE="${UI_PURGE_MATRIX_ALIGNMENT}"
echo_info
sleep 1
# MESSAGE="Realigning Dilithium Matrix"
# echo_good
update_gs
}