Skip to content

Commit

Permalink
Merge pull request #52 from freedomofpress/check_drivers_already_inst…
Browse files Browse the repository at this point in the history
…alled

only install drivers if needed
  • Loading branch information
redshiftzero authored Jan 23, 2020
2 parents 11c6322 + a2c5917 commit 0f4cb03
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions securedrop_export/print/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,19 @@ def install_printer_ppd(self, uri):
printer_driver = LASERJET_DRIVER
printer_ppd = LASERJET_PPD

# Some drivers don't come with ppd files pre-compiled, we must compile them
self.submission.safe_check_call(
command=[
"sudo",
"ppdc",
printer_driver,
"-d",
"/usr/share/cups/model/",
],
error_message=ExportStatus.ERROR_PRINTER_DRIVER_UNAVAILABLE.value
)
# Compile and install drivers that are not already installed
if not os.path.exists(printer_ppd):
self.submission.safe_check_call(
command=[
"sudo",
"ppdc",
printer_driver,
"-d",
"/usr/share/cups/model/",
],
error_message=ExportStatus.ERROR_PRINTER_DRIVER_UNAVAILABLE.value
)

return printer_ppd

def setup_printer(self, printer_uri, printer_ppd):
Expand Down

0 comments on commit 0f4cb03

Please sign in to comment.