gravity-sync/includes/gs-purge.sh
Michael Stanclift 9dae851a9c
3.0.0 (#100)
* first!

* folders

* break out colors

* home

* seperate update

* breakout pull

* move file

* breakout push

* breakout smart

* restore breakout

* include restore

* breakout logs validate ssh

* breakout config exit intent

* source exit

* breakout backup automation and purge

* breakout root

* file headers

* create push pull restore smart functions

* consolidate options

* include root check

* includes

* includes 2

* automate

* rearrange imports

* header

* ssh rsync

* new install steps

* ticks

* yellow

* host check

* check for git

* ticks

* check for pihole

* check sudo powers

* create sudo file

* write output

* pihole directory

* install sudo file

* purge error message

* comment cleanup

* installer

* header

* instructions

* l

* read p

* header

* skip prompts

* sudo no longer in config

* compare exit code

* exit with change

* 3.0

Co-authored-by: Michael Stanclift <vmstan@Sovereign.vmstan.net>
Co-authored-by: Michael Stanclift <vmstan@Sovereign.local>
2020-10-07 17:45:39 -05:00

78 lines
1.8 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} Requested"
echo_good
MESSAGE="THIS WILL RESET YOUR ENTIRE GRAVITY SYNC INSTALLATION"
echo_warn
MESSAGE="This will remove:"
echo_warn
MESSAGE="- All backups files."
echo_warn
MESSAGE="- Your ${CONFIG_FILE} file."
echo_warn
if [ -f "$HOME/${LOCAL_FOLDR}/dev" ]
then
MESSAGE="- Your development branch updater."
elif [ -f "$HOME/${LOCAL_FOLDR}/beta" ]
then
MESSAGE="- Your beta branch updater."
fi
echo_warn
MESSAGE="- All cronjob/automation tasks."
echo_warn
MESSAGE="- All job history/logs."
echo_warn
MESSAGE="- Associated SSH id_rsa keys."
echo_warn
MESSAGE="This function cannot be undone!"
echo_warn
MESSAGE="YOU WILL NEED TO REBUILD GRAVITY SYNC AFTER EXECUTION"
echo_warn
MESSAGE="Pi-hole binaries, configuration and services ARE NOT impacted!"
echo_info
MESSAGE="Your device will continue to resolve and block DNS requests,"
echo_info
MESSAGE="but your ${GRAVITY_FI} and ${CUSTOM_DNS} WILL NOT sync anymore,"
echo_info
MESSAGE="until you reconfigure Gravity Sync on this device."
echo_info
intent_validate
MESSAGE="Cleaning Gravity Sync Directory"
echo_stat
git clean -f -X -d >/dev/null 2>&1
error_validate
clear_cron
MESSAGE="Deleting SSH Key-files"
echo_stat
rm -f $HOME/${SSH_PKIF} >/dev/null 2>&1
rm -f $HOME/${SSH_PKIF}.pub >/dev/null 2>&1
error_validate
MESSAGE="Realigning Dilithium Matrix"
echo_stat
sleep 1
MESSAGE="Realigning Dilithium Matrix"
echo_good
update_gs
}