Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions usr/bin/mintupdate-automation
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,15 @@ def do_disable(_automation_id):
print("%s %s removed." % (name, filename))

def add_user_blacklist(outfile):
import tempfile
# The user's blacklist arrives on stdin. Never read it from a shared
# location such as /tmp: another user could swap the file for a symlink
# while the authentication dialog is open.
if sys.stdin is None or sys.stdin.isatty():
return
try:
infile = os.path.join(tempfile.gettempdir(), "mintUpdate/blacklist")
with open(infile, "r") as export:
with open(outfile, "a") as f:
for line in export:
f.write(line)
os.remove(infile)
with open(outfile, "a") as f:
for line in sys.stdin:
f.write(line)
print("User blacklist exported.")
except:
pass
Expand Down
Binary file not shown.
7 changes: 2 additions & 5 deletions usr/lib/linuxmint/mintUpdate/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import json
import os
import subprocess
import tempfile

import gi
gi.require_version('Gtk', '3.0')
Expand Down Expand Up @@ -215,11 +214,9 @@ def _build_automation(self, builder):
section.add_row(switch)

def _export_blacklist(self, widget):
filename = os.path.join(tempfile.gettempdir(), "mintUpdate/blacklist")
blacklist = self.settings.get_strv("blacklisted-packages")
with open(filename, "w") as f:
f.write("\n".join(blacklist) + "\n")
subprocess.run(["pkexec", "/usr/bin/mintupdate-automation", "blacklist", "enable"])
subprocess.run(["pkexec", "/usr/bin/mintupdate-automation", "blacklist", "enable"],
input="\n".join(blacklist) + "\n", text=True)

def _set_auto_upgrade(self, widget, param):
self._toggle_automation(widget, "upgrade")
Expand Down