Removing config file entries

This commit is contained in:
Bob Mottram 2016-10-17 13:59:45 +01:00
parent d242b21900
commit 48cb40c2d3
2 changed files with 35 additions and 5 deletions

View File

@ -324,14 +324,13 @@ function remove_htmly {
if [ -d /var/www/$HTMLY_DOMAIN_NAME ]; then
rm -rf /var/www/$HTMLY_DOMAIN_NAME
fi
if [ $HTMLY_CODE ]; then
sed -i '/HTMLY_DOMAIN_NAME.*/d' $CONFIGURATION_FILE
sed -i '/HTMLY_CODE.*/d' $CONFIGURATION_FILE
fi
remove_config_param HTMLY_DOMAIN_NAME
remove_config_param HTMLY_CODE
function_check remove_onion_service
remove_onion_service htmly ${HTMLY_ONION_PORT}
sed -i '/install_htmly/d' $COMPLETION_FILE
remove_completion_param install_htmly
sed -i '/Htmly .*/d' $COMPLETION_FILE
sed -i '/htmly .*/d' $COMPLETION_FILE
}
function get_htmly_admin_password {

View File

@ -229,6 +229,37 @@ function write_config_param {
fi
}
function remove_config_param {
param_name="$1"
if [ ${#param_name} -gt 0 ]; then
if [ $CONFIGURATION_FILE ]; then
if [ -f $CONFIGURATION_FILE ]; then
if grep -q "${param_name}=" $CONFIGURATION_FILE; then
sed -i "/${param_name}=/d" $CONFIGURATION_FILE
fi
fi
fi
fi
}
function remove_completion_param {
param_name="$1"
if [ ${#param_name} -gt 0 ]; then
if [ $COMPLETION_FILE ]; then
if [ -f $COMPLETION_FILE ]; then
if grep -Fxq "${param_name}" $COMPLETION_FILE; then
sed -i "/${param_name}/d" $COMPLETION_FILE
fi
if grep -q "${param_name}:" $COMPLETION_FILE; then
sed -i "/${param_name}:/d" $COMPLETION_FILE
fi
fi
fi
fi
}
function save_configuration_values {
for v in "${configuration_variables[@]}"
do