-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from sanger/creating_printers_in_cupsd
Adding printer to cups
- Loading branch information
Showing
8 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/expect | ||
set printername [lindex $argv 0]; | ||
spawn lpadmin -U "$env(CUPSD_USERNAME)" -p $printername -v socket://$printername.internal.sanger.ac.uk -E | ||
expect "Password for $env(CUPSD_USERNAME) on cupsd?" | ||
send -- "$env(CUPSD_PASSWORD)\n" | ||
expect eof |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
#!/bin/bash | ||
mkdir /etc/cups/ | ||
echo "ServerName $CUPSD_SERVER_NAME" > /etc/cups/client.conf | ||
if [ $CUPSD_UPDATE == "true" ] | ||
then | ||
echo "-> Running printers rake task" | ||
bundle exec rails printers:create | ||
echo "-> Printers rake task complete" | ||
fi | ||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# frozen_string_literal: true | ||
|
||
# Can only run in production, unless config for auto_create_printer_in_cupsd is changed | ||
namespace :printers do | ||
desc 'generate list of printers' | ||
task create: :environment do |_t| | ||
existing_printers = Printer.existing_cups_printers | ||
Printer.all.each do |printer| | ||
printer.check_if_printer_exists(existing_printers) | ||
end | ||
end | ||
end |