upgrades: Update searx search engines during dist upgrade

Flush stdout after printing debug info.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
James Valleroy 2020-12-24 13:49:45 -05:00 committed by Sunil Mohan Adapa
parent 092c7e70d1
commit 30a0e69548
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2

View File

@ -384,12 +384,12 @@ def _check_and_dist_upgrade(develop=False, test_upgrade=False):
def _perform_dist_upgrade():
"""Perform upgrade to next release of Debian."""
# Hold freedombox package during entire dist upgrade.
print('Holding freedombox package...')
print('Holding freedombox package...', flush=True)
with apt_hold():
print('Updating Apt cache...')
print('Updating Apt cache...', flush=True)
run_apt_command(['update'])
print('Upgrading base-files and unattended-upgrades...')
print('Upgrading base-files and unattended-upgrades...', flush=True)
run_apt_command(['install', 'base-files'])
run_apt_command(['install', 'unattended-upgrades'])
@ -403,29 +403,35 @@ def _perform_dist_upgrade():
# Remove obsolete packages that may prevent other packages from
# upgrading.
print('Removing libgcc1...')
print('Removing libgcc1...', flush=True)
run_apt_command(['remove', 'libgcc1'])
# Hold packages known to have conffile prompts. FreedomBox service
# will handle their upgrade later.
packages_with_prompts = ['firewalld', 'mumble-server', 'radicale']
print('Holding packages with conffile prompts: ' +
', '.join(packages_with_prompts) + '...')
print(
'Holding packages with conffile prompts: ' +
', '.join(packages_with_prompts) + '...', flush=True)
with apt_hold(packages_with_prompts):
print('Running apt full-upgrade...')
print('Running apt full-upgrade...', flush=True)
run_apt_command(['full-upgrade'])
print('Running apt autoremove...')
# If searx is installed, update search engines list.
if pathlib.Path('/etc/searx/settings.yml').exists():
print('Updating searx search engines list...', flush=True)
subprocess.run(['./searx', 'setup'], check=True)
print('Running apt autoremove...', flush=True)
run_apt_command(['autoremove'])
print('Dist upgrade complete. Removing flag.')
print('Dist upgrade complete. Removing flag.', flush=True)
if dist_upgrade_flag.exists():
dist_upgrade_flag.unlink()
# FreedomBox Service may have tried to restart several times
# during the upgrade, but failed. It will stop trying after 5
# retries. Restart it once more to ensure it is running.
print('Restarting FreedomBox service...')
print('Restarting FreedomBox service...', flush=True)
service_restart('plinth')