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 authored and Sunil Mohan Adapa committed 2020-06-28 21:57:10 -07:00
1 parent 0c7c4b12fb
commit ba023c3ef8
1 file changed
+6
+6
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.')