Skip to content

Commit 034115a

Browse files
committed
Removed v3.7 to v3.8 3P app installation disk space requirement
Before, the disk space requirement was part of the update itself. Moved away from that model to install apps separately of the update to minimise the requirement (divide and conquer). However, the App Store does not check for disk space before installing an app so account for this here naively. Requirements (disk_req) in MB were made with apt on a clean system.
1 parent 21bc140 commit 034115a

File tree

3 files changed

+63
-26
lines changed

3 files changed

+63
-26
lines changed

debian/changelog

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,13 @@ kano-updater (3.16.2-0) unstable; urgency=low
6464
* Backport: Added apt HTTPS dependency
6565
* Backport: Increased the minimum disk requirement buffer to 850MB for dpkg
6666
* Backport: Added free disk space check before download phase
67+
* Backport: Migrate to using mirrored version of Raspbian repo
68+
* PreUpdate workaround for installing firmware-ralink over firmware-misc-nonfree
69+
* Backport: Configure dpkg to run in noninteractive mode to avoid potential update freezes
70+
* Backport: Prioritised update from v3.7 to v3.8 over installation of 3rd
71+
party apps in PostUpdate scenario
6772

68-
-- Team Kano <dev@kano.me> Mon, 21 Jan 2019 14:12:00 +0000
73+
-- Team Kano <dev@kano.me> Tue, 12 Feb 2019 15:12:00 +0000
6974

7075
kano-updater (3.16.1-0) unstable; urgency=low
7176

kano_updater/disk_requirements.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33
# Copyright (C) 2018-2019 Kano Computing Ltd.
44
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2
55
#
6-
# Variables pertaining to required disk usage for upgrade
6+
# Required disk usage for upgrade
77

88

99
from kano.logging import logger
1010

1111

1212
SPACE_BUFFER = 850 # MB
13-
UPGRADE_3_8_0_SPACE = 1000 # MB
1413

1514

1615
def check_disk_space(priority):
@@ -21,18 +20,11 @@ def check_disk_space(priority):
2120
from kano.utils.disk import get_free_space
2221

2322
from kano_updater.apt_wrapper import AptWrapper
24-
from kano_updater.os_version import get_system_version, OSVersion
2523

2624
apt_handle = AptWrapper.get_instance()
2725
mb_free = get_free_space()
2826
required_space = apt_handle.get_required_upgrade_space() + SPACE_BUFFER
2927

30-
# Allowance for installing extra packages in the postupdate scenarios
31-
# during the update to 3.8.0
32-
system_version = get_system_version()
33-
if system_version < OSVersion.from_version_string("Kanux-Beta-3.8.0"):
34-
required_space += UPGRADE_3_8_0_SPACE
35-
3628
logger.info('Final upgrade required size is {} MB'.format(required_space))
3729

3830
if mb_free < required_space:

kano_updater/scenarios.py

Lines changed: 56 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import os
99
import shutil
10+
import traceback
1011

1112
from kano.logging import logger
1213

@@ -23,6 +24,7 @@
2324
purge, rclocal_executable, migrate_repository, get_users, run_for_every_user
2425
from kano_updater.paths import PYLIBS_DIR, PYFALLBACK_DIR, SOURCES_DIR, \
2526
OS_SOURCES_REFERENCE, REFERENCE_STRETCH_LIST, CMDLINE_TXT_PATH
27+
from kano_updater.reporting import send_crash_report
2628

2729

2830
STRETCH_MIGRATION_LIST = os.path.join(
@@ -908,22 +910,60 @@ def beta_370_to_beta_380(self, dummy_progress):
908910

909911
self._bootconfig_set_value_helper("gpu_mem", "256")
910912

911-
new_apps = [
912-
'adventure',
913-
'openttd',
914-
'tux-paint',
915-
'tux-typing',
916-
'libreoffice',
917-
'numpty-physics',
918-
'gmail',
919-
'google-drive',
920-
'google-maps',
921-
'wikipedia',
922-
'whatsapp'
923-
]
924-
925-
for app in new_apps:
926-
run_cmd_log('kano-apps install --no-gui {app}'.format(app=app))
913+
try:
914+
# Install 3rd party apps from Kano World using the App Store.
915+
# Before, the disk space requirement was part of the update itself.
916+
# Moved away from that model to install apps separately of the update
917+
# to minimise the requirement (divide and conquer).
918+
# However, the App Store does not check for disk space before
919+
# installing an app so account for this here naively.
920+
# Requirements (disk_req) in MB were made with apt on a clean system.
921+
922+
from kano.utils.disk import get_free_space
923+
924+
new_apps = [
925+
{'kw_app': 'tux-paint', 'disk_req': 413},
926+
{'kw_app': 'numpty-physics', 'disk_req': 2},
927+
{'kw_app': 'gmail', 'disk_req': 1},
928+
{'kw_app': 'google-drive', 'disk_req': 1},
929+
{'kw_app': 'google-maps', 'disk_req': 1},
930+
{'kw_app': 'wikipedia', 'disk_req': 1},
931+
{'kw_app': 'whatsapp', 'disk_req': 1},
932+
{'kw_app': 'adventure', 'disk_req': 5},
933+
{'kw_app': 'openttd', 'disk_req': 21},
934+
{'kw_app': 'tux-typing', 'disk_req': 26},
935+
{'kw_app': 'libreoffice', 'disk_req': 385},
936+
]
937+
938+
run_cmd_log('apt-get autoremove -y')
939+
940+
for app in new_apps:
941+
run_cmd_log('apt-get clean')
942+
943+
mb_free = get_free_space()
944+
mb_required = app['disk_req'] + 250 # MB buffer
945+
946+
if mb_free > mb_required:
947+
run_cmd_log('kano-apps install --no-gui {app}'.format(app=app['kw_app']))
948+
else:
949+
logger.warn(
950+
"Cannot install {app} as it requires {mb_required} but"
951+
" only has {mb_free}"
952+
.format(
953+
app=app['kw_app'],
954+
mb_required=mb_required,
955+
mb_free=mb_free
956+
)
957+
)
958+
except Exception as e:
959+
logger.error("Failed to install 3rd party apps", exception=e)
960+
send_crash_report(
961+
"PostUpdate 3.7 to 3.8 app install",
962+
"Failed with unexpected exception\n{}"
963+
.format(traceback.format_exc())
964+
)
965+
finally:
966+
run_cmd_log('apt-get clean')
927967

928968
# Tell kano-init to put the automatic logins up-to-date
929969
reconfigure_autostart_policy()

0 commit comments

Comments
 (0)