mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[enh] Add --v24 option to upgrade command. WIP #308
This commit is contained in:
parent
7ad44b7a9a
commit
4ca5476d2d
3 changed files with 54 additions and 2 deletions
|
@ -1146,6 +1146,9 @@ tools:
|
||||||
--ignore-packages:
|
--ignore-packages:
|
||||||
help: Ignore APT packages upgrade
|
help: Ignore APT packages upgrade
|
||||||
action: store_true
|
action: store_true
|
||||||
|
--v24:
|
||||||
|
help: Manual upgrade from v2.2 to v2.4 (Debian Jessie only)
|
||||||
|
action: store_true
|
||||||
|
|
||||||
|
|
||||||
#############################
|
#############################
|
||||||
|
|
|
@ -399,7 +399,7 @@ def tools_update(ignore_apps=False, ignore_packages=False):
|
||||||
return { 'packages': packages, 'apps': apps }
|
return { 'packages': packages, 'apps': apps }
|
||||||
|
|
||||||
|
|
||||||
def tools_upgrade(auth, ignore_apps=False, ignore_packages=False):
|
def tools_upgrade(auth, ignore_apps=False, ignore_packages=False, v24=False):
|
||||||
"""
|
"""
|
||||||
Update apps & package cache, then display changelog
|
Update apps & package cache, then display changelog
|
||||||
|
|
||||||
|
@ -410,6 +410,11 @@ def tools_upgrade(auth, ignore_apps=False, ignore_packages=False):
|
||||||
"""
|
"""
|
||||||
from yunohost.app import app_upgrade
|
from yunohost.app import app_upgrade
|
||||||
|
|
||||||
|
# Special case for v2.2 to v2.4 upgrade
|
||||||
|
if v24:
|
||||||
|
return tools_upgrade_v24(auth)
|
||||||
|
# End of v2.4 special case
|
||||||
|
|
||||||
failure = False
|
failure = False
|
||||||
|
|
||||||
# Retrieve interface
|
# Retrieve interface
|
||||||
|
@ -469,3 +474,44 @@ def tools_upgrade(auth, ignore_apps=False, ignore_packages=False):
|
||||||
if is_api:
|
if is_api:
|
||||||
from yunohost.service import service_log
|
from yunohost.service import service_log
|
||||||
return { "log": service_log('yunohost-api', number="100").values()[0] }
|
return { "log": service_log('yunohost-api', number="100").values()[0] }
|
||||||
|
|
||||||
|
|
||||||
|
def tools_upgrade_v24(auth):
|
||||||
|
"""
|
||||||
|
YunoHost upgrade to new Yunohost version (on jessie)
|
||||||
|
"""
|
||||||
|
import platform
|
||||||
|
|
||||||
|
# Retrieve interface
|
||||||
|
is_api = True if msettings.get('interface') == 'api' else False
|
||||||
|
|
||||||
|
# Get Debian major version
|
||||||
|
debian_major_version = platform.linux_distribution()[1].split('.')[0]
|
||||||
|
if debian_major_version is not '8':
|
||||||
|
msignals.display(m18n.n('upgrade_24_not_jessie'), 'error')
|
||||||
|
return
|
||||||
|
|
||||||
|
# Upgrade with current sources
|
||||||
|
os.system('apt-get update')
|
||||||
|
os.system('yes "q" | DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get -y --force-yes -qq -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade')
|
||||||
|
|
||||||
|
# Change sources
|
||||||
|
with open('/etc/apt/sources.list.d/yunohost.list', "w") as sources:
|
||||||
|
sources.write('deb http://repo.yunohost.org/debian/ jessie stable')
|
||||||
|
|
||||||
|
# Upgrade with new sources
|
||||||
|
os.system('apt-get update')
|
||||||
|
os.system('yes "q" | DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get install -y --force-yes -qq -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" yunohost')
|
||||||
|
os.system('yes "q" | DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get -y --force-yes -qq -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade')
|
||||||
|
os.system('yes "q" | DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get remove -y --force-yes amavisd-new')
|
||||||
|
os.system('yes "q" | DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get -y --force-yes autoremove')
|
||||||
|
os.system('yunohost service regen-conf -f')
|
||||||
|
|
||||||
|
msignals.display(m18n.n('system_upgraded'), 'success')
|
||||||
|
|
||||||
|
# Prepare systemctl
|
||||||
|
with open('/etc/cron.d/yunohost-regenconf', 'w+') as f:
|
||||||
|
f.write('00 * * * * root PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin systemctl start yunohost-api && rm -f /etc/cron.d/yunohost-regenconf\n' )
|
||||||
|
|
||||||
|
# Reboot user notice
|
||||||
|
msignals.display(m18n.n('upgrade_24_reboot'), 'warning')
|
||||||
|
|
|
@ -195,6 +195,9 @@
|
||||||
"pattern_port_or_range" : "Must be a valid port number (i.e. 0-65535) or range of ports (e.g. 100:200)",
|
"pattern_port_or_range" : "Must be a valid port number (i.e. 0-65535) or range of ports (e.g. 100:200)",
|
||||||
"pattern_backup_archive_name" : "Must be a valid filename with alphanumeric and -_. characters only",
|
"pattern_backup_archive_name" : "Must be a valid filename with alphanumeric and -_. characters only",
|
||||||
|
|
||||||
"format_datetime_short" : "%m/%d/%Y %I:%M %p"
|
"format_datetime_short" : "%m/%d/%Y %I:%M %p",
|
||||||
|
|
||||||
|
"upgrade_24_not_jessie" : "Upgrading to YunoHost v2.4 will only work on Debian Jessie. Please upgrade your system before upgrading YunoHost.",
|
||||||
|
"upgrade_24_reboot" : "You must reboot your server for the changes to take effect. Enter the 'reboot' command right now."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue