mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
apache: Remove default welcome page
Closes: #1293. Tests: - Copy /usr/share/apache2/default-site/index.html to /var/www/html/index.html. Apply the patches. The file in /var/www/html/index.html is removed. - Create a new custom file in /var/www/html/index.html. Increment the setup version so apache2 setup is run. The file is not removed. - Copy the default file again and run setup again. The file is removed. - Increment setup version again and there are no errors due to missing file. [sunil: Add check to ensure that only default files are not removed] Signed-off-by: Frederico Gomes <fredericojfgomes@gmail.com> Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Tested-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
1 parent
60c8f41f79
commit
bb1a45ef0a
2 files changed
+11
-1
No files matched your search
@@ -86,7 +86,7 @@ class ApacheApp(app_module.App):
|
||||
|
||||
app_id = 'apache'
|
||||
|
||||
_version = 17
|
||||
_version = 18
|
||||
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
|
||||
@@ -62,6 +62,15 @@ def _disable_mod_php(webserver):
|
||||
webserver.disable('php' + version, kind='module')
|
||||
|
||||
|
||||
def _remove_default_index_html():
|
||||
"""Remove Apache's default welcome page."""
|
||||
default_page = pathlib.Path('/var/www/html/index.html')
|
||||
shipped_default_page = pathlib.Path(
|
||||
'/usr/share/apache2/default-site/index.html')
|
||||
if default_page.read_text() == shipped_default_page.read_text():
|
||||
default_page.unlink(missing_ok=True)
|
||||
|
||||
|
||||
@privileged
|
||||
def setup(old_version: int):
|
||||
"""Setup Apache configuration."""
|
||||
@@ -81,6 +90,7 @@ def setup(old_version: int):
|
||||
check=True)
|
||||
|
||||
_setup_oidc_config()
|
||||
_remove_default_index_html()
|
||||
|
||||
with action_utils.WebserverChange() as webserver:
|
||||
# Disable mod_php as we have switched to mod_fcgi + php-fpm. Disable
|
||||
|
||||
Reference in new issue
Block a user