From 0ac2280fcf8dd459898028105a9228482fe857d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebleu?= Date: Mon, 16 May 2016 14:22:10 +0200 Subject: [PATCH] [enh] Ask the user to upgrade to v2.4 on cli --- lib/yunohost/tools.py | 15 ++++++++++++--- locales/en.json | 1 + 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/yunohost/tools.py b/lib/yunohost/tools.py index c8e937155..8bd72e6ac 100644 --- a/lib/yunohost/tools.py +++ b/lib/yunohost/tools.py @@ -413,16 +413,25 @@ def tools_upgrade(auth, ignore_apps=False, ignore_packages=False, v24=False): """ from yunohost.app import app_upgrade + # Retrieve interface + is_api = True if msettings.get('interface') == 'api' else False + # Special case for v2.2 to v2.4 upgrade + if not v24 and not is_api: + try: + i = msignals.prompt(m18n.n('upgrade_24_confirm', + answers='y/N')) + except NotImplemented: + pass + else: + if i == 'y' or i == 'Y': + v24 = True if v24: return tools_upgrade_v24(auth) # End of v2.4 special case failure = False - # Retrieve interface - is_api = True if msettings.get('interface') == 'api' else False - if not ignore_packages: cache = apt.Cache() cache.open(None) diff --git a/locales/en.json b/locales/en.json index 9498ecb88..59357fe97 100644 --- a/locales/en.json +++ b/locales/en.json @@ -197,6 +197,7 @@ "format_datetime_short" : "%m/%d/%Y %I:%M %p", + "upgrade_24_confirm" : "YunoHost should be upgraded to v2.4, do you want to proceed? [{answers:s}]", "upgrade_24_not_jessie" : "Upgrading to YunoHost v2.4 will only work on Debian Jessie. Please upgrade your system before upgrading YunoHost.", "upgrade_24_update_failed" : "An error occurred while updating the packages list, you should maybe check your network connection.", "upgrade_24_system_failed" : "An error occurred while upgrading your system, we will try to fix broken packages...",