upgrades: Skip enabling backports on testing and unstable

Uses lsb-release which is a dependency of unattended-upgrades.

Closes: #1844.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil: Minor change to the printed message]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
James Valleroy 2020-06-25 20:09:49 -04:00 committed by Sunil Mohan Adapa
parent 0c7c4b12fb
commit ba023c3ef8
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2

View File

@ -211,6 +211,12 @@ def _check_and_backports_sources():
'backports.')
return
release = subprocess.check_output(['lsb_release', '--release',
'--short']).decode().strip()
if release in ['testing', 'unstable']:
print(f'System release is {release}. Skip enabling backports.')
return
protocol = _get_protocol()
if protocol == 'tor+http':
print('Package download over Tor is enabled.')