diff --git a/src/freedombone-app-htmly b/src/freedombone-app-htmly index 73a61ef6..6413acf1 100755 --- a/src/freedombone-app-htmly +++ b/src/freedombone-app-htmly @@ -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 { diff --git a/src/freedombone-utils-config b/src/freedombone-utils-config index e8ef5d28..f6ba4142 100755 --- a/src/freedombone-utils-config +++ b/src/freedombone-utils-config @@ -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