mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Have a specific upgrade for nginx-common because some people edit /etc/nginx/nginx.conf
This commit is contained in:
parent
9570832f42
commit
2843ce923d
3 changed files with 26 additions and 2 deletions
|
@ -230,6 +230,7 @@
|
||||||
"migration_0003_patching_sources_list": "Patching the sources.lists ...",
|
"migration_0003_patching_sources_list": "Patching the sources.lists ...",
|
||||||
"migration_0003_main_upgrade": "Starting main upgrade ...",
|
"migration_0003_main_upgrade": "Starting main upgrade ...",
|
||||||
"migration_0003_fail2ban_upgrade": "Starting the fail2ban upgrade ...",
|
"migration_0003_fail2ban_upgrade": "Starting the fail2ban upgrade ...",
|
||||||
|
"migration_0003_nginx_upgrade": "Starting the nginx-common upgrade ...",
|
||||||
"migration_0003_yunohost_upgrade": "Starting the yunohost package upgrade ... The migration will end, but the actual upgrade will happen right after. After the operation is complete, you might have to re-log on the webadmin.",
|
"migration_0003_yunohost_upgrade": "Starting the yunohost package upgrade ... The migration will end, but the actual upgrade will happen right after. After the operation is complete, you might have to re-log on the webadmin.",
|
||||||
"migration_0003_not_jessie": "The current debian distribution is not Jessie !",
|
"migration_0003_not_jessie": "The current debian distribution is not Jessie !",
|
||||||
"migration_0003_system_not_fully_up_to_date": "Your system is not fully up to date. Please perform a regular upgrade before running the migration to stretch.",
|
"migration_0003_system_not_fully_up_to_date": "Your system is not fully up to date. Please perform a regular upgrade before running the migration to stretch.",
|
||||||
|
|
|
@ -15,7 +15,10 @@ from moulinette.utils.filesystem import read_file
|
||||||
|
|
||||||
from yunohost.tools import Migration
|
from yunohost.tools import Migration
|
||||||
from yunohost.app import unstable_apps
|
from yunohost.app import unstable_apps
|
||||||
from yunohost.service import _run_service_command, service_regen_conf, manually_modified_files
|
from yunohost.service import (_run_service_command,
|
||||||
|
service_regen_conf,
|
||||||
|
manually_modified_files,
|
||||||
|
manually_modified_files_compared_to_debian_default)
|
||||||
from yunohost.utils.filesystem import free_space_in_directory
|
from yunohost.utils.filesystem import free_space_in_directory
|
||||||
from yunohost.utils.packages import get_installed_version
|
from yunohost.utils.packages import get_installed_version
|
||||||
|
|
||||||
|
@ -47,7 +50,7 @@ class MyMigration(Migration):
|
||||||
self.apt_update()
|
self.apt_update()
|
||||||
apps_packages = self.get_apps_equivs_packages()
|
apps_packages = self.get_apps_equivs_packages()
|
||||||
self.unhold(["metronome"])
|
self.unhold(["metronome"])
|
||||||
self.hold(YUNOHOST_PACKAGES + apps_packages + ["fail2ban"])
|
self.hold(YUNOHOST_PACKAGES + apps_packages + ["fail2ban", "nginx-common"])
|
||||||
|
|
||||||
# Main dist-upgrade
|
# Main dist-upgrade
|
||||||
logger.warning(m18n.n("migration_0003_main_upgrade"))
|
logger.warning(m18n.n("migration_0003_main_upgrade"))
|
||||||
|
@ -68,6 +71,11 @@ class MyMigration(Migration):
|
||||||
self.apt_dist_upgrade(conf_flags=["new", "miss", "def"])
|
self.apt_dist_upgrade(conf_flags=["new", "miss", "def"])
|
||||||
_run_service_command("restart", "fail2ban")
|
_run_service_command("restart", "fail2ban")
|
||||||
|
|
||||||
|
# Specific upgrade for nginx-common...
|
||||||
|
logger.warning(m18n.n("migration_0003_nginx_upgrade"))
|
||||||
|
self.unhold(["nginx-common"])
|
||||||
|
self.apt_dist_upgrade(conf_flags=["new", "def"])
|
||||||
|
|
||||||
# Clean the mess
|
# Clean the mess
|
||||||
os.system("apt autoremove --assume-yes")
|
os.system("apt autoremove --assume-yes")
|
||||||
os.system("apt clean --assume-yes")
|
os.system("apt clean --assume-yes")
|
||||||
|
@ -129,6 +137,10 @@ class MyMigration(Migration):
|
||||||
|
|
||||||
# Manually modified files ? (c.f. yunohost service regen-conf)
|
# Manually modified files ? (c.f. yunohost service regen-conf)
|
||||||
modified_files = manually_modified_files()
|
modified_files = manually_modified_files()
|
||||||
|
# We also have a specific check for nginx.conf which some people
|
||||||
|
# modified and needs to be upgraded...
|
||||||
|
if "/etc/nginx/nginx.conf" in manually_modified_files_compared_to_debian_default():
|
||||||
|
modified_files.append("/etc/nginx/nginx.conf")
|
||||||
modified_files = "".join(["\n - "+f for f in modified_files ])
|
modified_files = "".join(["\n - "+f for f in modified_files ])
|
||||||
|
|
||||||
message = m18n.n("migration_0003_general_warning")
|
message = m18n.n("migration_0003_general_warning")
|
||||||
|
|
|
@ -793,3 +793,14 @@ def manually_modified_files():
|
||||||
output.append(filename)
|
output.append(filename)
|
||||||
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
|
def manually_modified_files_compared_to_debian_default():
|
||||||
|
|
||||||
|
# from https://serverfault.com/a/90401
|
||||||
|
r = subprocess.check_output("dpkg-query -W -f='${Conffiles}\n' '*' \
|
||||||
|
| awk 'OFS=\" \"{print $2,$1}' \
|
||||||
|
| md5sum -c 2>/dev/null \
|
||||||
|
| awk -F': ' '$2 !~ /OK/{print $1}'", shell=True)
|
||||||
|
return r.strip().split("\n")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue