gravity-sync/includes/gs-config.sh

87 lines
2.4 KiB
Bash
Raw Normal View History

2020-12-31 02:49:54 +00:00
error_validate
2020-12-31 02:45:47 +00:00
PING_AVOID=1
fi
2020-12-31 02:49:54 +00:00
2020-12-31 02:45:47 +00:00
MESSAGE="Use Custom SSH PKIF Location? (Leave blank for default '.ssh/id_rsa')"
echo_need
read INPUT_CUSTOM_PKIF
INPUT_CUSTOM_PKIF="${INPUT_CUSTOM_PKIF:-.ssh/id_rsa}"
2020-12-31 02:49:54 +00:00
2020-12-31 02:45:47 +00:00
if [ "${INPUT_CUSTOM_PKIF}" != ".ssh/id_rsa" ]
then
MESSAGE="Saving Custom PKIF to ${CONFIG_FILE}"
echo_stat
sed -i "/# SSH_PKIF=''/c\SSH_PKIF='${INPUT_CUSTOM_PKIF}'" ${LOCAL_FOLDR}/${CONFIG_FILE}
error_validate
fi
MESSAGE="Enable Replicate 'Local DNS Records' Feature? (Leave blank for default 'Yes')"
echo_need
read INPUT_SKIP_CUSTOM
INPUT_SKIP_CUSTOM="${INPUT_SKIP_CUSTOM:-Y}"
if [ "${INPUT_SKIP_CUSTOM}" != "Y" ]
then
MESSAGE="Saving Local DNS Preference to ${CONFIG_FILE}"
echo_stat
sed -i "/# SKIP_CUSTOM=''/c\SKIP_CUSTOM='1'" ${LOCAL_FOLDR}/${CONFIG_FILE}
error_validate
fi
MESSAGE="Change Backup Retention in Days? (Leave blank for default '7')"
echo_need
read INPUT_BACKUP_RETAIN
INPUT_BACKUP_RETAIN="${INPUT_BACKUP_RETAIN:-7}"
if [ "${INPUT_BACKUP_RETAIN}" != "7" ]
then
MESSAGE="Saving Backup Retention to ${CONFIG_FILE}"
echo_stat
sed -i "/# BACKUP_RETAIN=''/c\BACKUP_RETAIN='1'" ${LOCAL_FOLDR}/${CONFIG_FILE}
error_validate
fi
}
## Delete Existing Configuration
function config_delete {
2020-12-31 02:45:47 +00:00
source ${LOCAL_FOLDR}/${CONFIG_FILE}
MESSAGE="Configuration File Exists"
echo_warn
echo -e "========================================================"
cat ${LOCAL_FOLDR}/${CONFIG_FILE}
echo -e "========================================================"
MESSAGE="Are you sure you want to erase this configuration?"
echo_warn
2020-12-31 02:49:54 +00:00
2020-12-31 02:45:47 +00:00
intent_validate
2020-12-31 02:49:54 +00:00
2020-12-31 02:45:47 +00:00
MESSAGE="Erasing Existing Configuration"
echo_stat
rm -f ${LOCAL_FOLDR}/${CONFIG_FILE}
2020-12-31 02:49:54 +00:00
error_validate
2020-12-31 02:45:47 +00:00
config_generate
3.1.0 (#105) * Begin work on Docker support * rewrite permission detection * wrong else * Change pihole detection based on sudo results * Write out to devnull * nosodo handle * AND then * scanning * nosudo more * clearer wording on failures * headers * handle nosudo on docker detection better * SUDO sudo * AND THEN * status report rewrite * link * alert on no local install detected * yellow headers like the rest of GS * semi critical issues * purple instead of red * clean up output of sudo detection * give me space * Auto run config script * added logo * center logo * move intro * trying dev/tty * advanced config generate * != * logic is hard * new logo * image * fonts * svg image * remove h1 * use rihole variable * New root check * better method of checking sudo * remove messages * rihole * attempting realpath * GS_FILEPATH * remove $HOME call * remove config requirement for updates * no config for updates * all the variables * all kinds of variable replacements * double quotes * it’s like I’ve forgotten how to write this stuff * removals * updated requirements * variable rearrangement * validation check for docker * riholes * placeholder * more riholes * even more riholes * docker examples * docker rewrite * docker docker docker * docker custom checks * update from anywhere * correct validation error * check for current owner only if local install * give me space * stuff * more stuff * bash alias creation * cleanup installer * fix .sh * config errors, remove sshpass validation * skip directories if done * limit config script * fix for changes when both targets have changed * RIHOLE * cleanup warning messages * stop sign * big red * documenting new variables * master Co-authored-by: Michael Stanclift <vmstan@sovereign.vmstan.net> Co-authored-by: Michael Stanclift <vmstan@sovereign.local>
2020-10-19 18:48:23 +00:00
}
## Detect Docker
function docker_detect {
2020-12-31 02:45:47 +00:00
if hash docker 2>/dev/null
then
FTLCHECK=$(sudo docker container ls | grep 'pihole/pihole')
if [ "$FTLCHECK" != "" ]
then
DOCKERREADY="1"
fi
fi
3.1.0 (#105) * Begin work on Docker support * rewrite permission detection * wrong else * Change pihole detection based on sudo results * Write out to devnull * nosodo handle * AND then * scanning * nosudo more * clearer wording on failures * headers * handle nosudo on docker detection better * SUDO sudo * AND THEN * status report rewrite * link * alert on no local install detected * yellow headers like the rest of GS * semi critical issues * purple instead of red * clean up output of sudo detection * give me space * Auto run config script * added logo * center logo * move intro * trying dev/tty * advanced config generate * != * logic is hard * new logo * image * fonts * svg image * remove h1 * use rihole variable * New root check * better method of checking sudo * remove messages * rihole * attempting realpath * GS_FILEPATH * remove $HOME call * remove config requirement for updates * no config for updates * all the variables * all kinds of variable replacements * double quotes * it’s like I’ve forgotten how to write this stuff * removals * updated requirements * variable rearrangement * validation check for docker * riholes * placeholder * more riholes * even more riholes * docker examples * docker rewrite * docker docker docker * docker custom checks * update from anywhere * correct validation error * check for current owner only if local install * give me space * stuff * more stuff * bash alias creation * cleanup installer * fix .sh * config errors, remove sshpass validation * skip directories if done * limit config script * fix for changes when both targets have changed * RIHOLE * cleanup warning messages * stop sign * big red * documenting new variables * master Co-authored-by: Michael Stanclift <vmstan@sovereign.vmstan.net> Co-authored-by: Michael Stanclift <vmstan@sovereign.local>
2020-10-19 18:48:23 +00:00
}
## Create Bash Alias
function create_alias {
2020-12-31 02:45:47 +00:00
MESSAGE="Creating Bash Alias"
echo_stat
echo -e "alias gravity-sync='${GS_FILEPATH}'" | sudo tee -a /etc/bash.bashrc > /dev/null
2020-12-31 02:49:54 +00:00
error_validate
}