893N/A# The contents of this file are subject to the terms of the 893N/A# Common Development and Distribution License (the "License"). 893N/A# You may not use this file except in compliance with the License. 893N/A# See the License for the specific language governing permissions 893N/A# and limitations under the License. 893N/A# When distributing Covered Code, include this CDDL HEADER in each 893N/A# If applicable, add the following below this CDDL HEADER, with the 893N/A# fields enclosed by brackets "[]" replaced with your own identifying 893N/A# information: Portions Copyright [yyyy] [name of copyright owner] 893N/A# Copyright 2009 Sun Microsystems, Inc. All rights reserved. 893N/A# Use is subject to license terms. 893N/A# This program manages the "active" print service selection. 893N/A# If called as 'print-service', it takes one of four options. 893N/A# [-s[et] service [-m]] Select the "active" print service, optionally 893N/A# migrating basic print queue configuration. 893N/A# [-q[uery]] Display the "active" print service. 893N/A# [-e[xport] file] Export basic print queue configuration to 893N/A# [-i[mport] file] Import basic print queue configuration from 893N/A# If called by any other name, it will look for a corresponding command 893N/A# under /usr/lib/{active-service}/bin/{command} and execute that program 893N/A# with the original arguments. 893N/A $cmd [-s[et] service [-m]] Select the \"active\" print service, 893N/A optionally migrating basic print queue 893N/A $cmd [-q[uery]] Display the "active" print service. 893N/A $cmd [-e[xport] file] Export basic print queue configuration 893N/A $cmd [-i[mport] file] Import basic print queue configuration 893N/A fatal("failed to detect active print service: $!\n"); 893N/A # CUPS has it's own names for enable and disable if (/device for (.+): (.+)/) { print $FH "<Printer $1>\nDeviceURI $2\n"; print $FH "</Printer>\n"; # store queue info in the 'active' print service } elsif (/([^\s]+)\s(.+)/) { print "importing $printer{'Printer'}...\n"; # export old print queue configuration (if migrating) print("disabling LP services...\n"); print("enabling CUPS services...\n"); system("pkill -USR1 -f '/desktop-print-management-applet'"); print("disabling CUPS services...\n"); print("enabling LP services...\n"); system("pkill -USR1 -f '/desktop-print-management-applet'"); # import the new print queue configuration (if migrating) fatal("failed to detect active print service: $!\n"); print "active print service: $service\n"; if ($cmd eq 'print-service') {