mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-08-19 12:36:06 +00:00
Use regexs to match more valid configs for unattended-upgrades.
This commit is contained in:
parent
5939292c86
commit
6292b47e54
@ -23,6 +23,7 @@ Configures or runs unattended-upgrades
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
CONF_FILE = '/etc/apt/apt.conf.d/50unattended-upgrades'
|
||||
@ -100,13 +101,13 @@ def setup():
|
||||
lines = conffile.readlines()
|
||||
|
||||
for line in lines:
|
||||
if '"origin=Debian";' in line:
|
||||
if re.match(r'\s*"o(rigin)?=Debian";', line):
|
||||
return # already configured
|
||||
|
||||
with open(CONF_FILE, 'w') as conffile:
|
||||
for line in lines:
|
||||
conffile.write(line)
|
||||
if 'Unattended-Upgrade::Origins-Pattern {' in line:
|
||||
if re.match(r'\s*Unattended-Upgrade::Origins-Pattern', line):
|
||||
conffile.write(' "origin=Debian";\n')
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user