Author: jsmeix
Date: Thu Aug 28 18:34:10 2008
New Revision: 50463
URL: http://svn.opensuse.org/viewcvs/yast?rev=50463&view=rev
Log:
- Fixed build (new scripts were not packaged).
- The 'Printing via Network' dialog UI should now work correctly
but writing the values to the system is not yet implemented.
- 2.17.6
Modified:
trunk/printer/VERSION
trunk/printer/package/yast2-printer.changes
trunk/printer/src/Printerlib.ycp
trunk/printer/src/dialogs.ycp
trunk/printer/src/printingvianetwork.ycp
trunk/printer/tools/cups_client_only
trunk/printer/tools/modify_cupsd_conf
trunk/printer/yast2-printer.spec.in
Modified: trunk/printer/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/VERSION?rev=50463&r1=50462&r2=50463&view=diff
==============================================================================
--- trunk/printer/VERSION (original)
+++ trunk/printer/VERSION Thu Aug 28 18:34:10 2008
@@ -1 +1 @@
-2.17.5
+2.17.6
Modified: trunk/printer/package/yast2-printer.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/package/yast2-printer.changes?rev=50463&r1=50462&r2=50463&view=diff
==============================================================================
--- trunk/printer/package/yast2-printer.changes (original)
+++ trunk/printer/package/yast2-printer.changes Thu Aug 28 18:34:10 2008
@@ -1,4 +1,12 @@
-------------------------------------------------------------------
+Thu Aug 28 18:19:32 CEST 2008 - jsmeix@suse.de
+
+- Fixed build (new scripts were not packaged).
+- The 'Printing via Network' dialog UI should now work correctly
+ but writing the values to the system is not yet implemented.
+- 2.17.6
+
+-------------------------------------------------------------------
Wed Aug 27 16:22:28 CEST 2008 - jsmeix@suse.de
- Enhanced scripts in the tools directory to make them
Modified: trunk/printer/src/Printerlib.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/Printerlib.ycp?rev=50463&r1=50462&r2=50463&view=diff
==============================================================================
--- trunk/printer/src/Printerlib.ycp (original)
+++ trunk/printer/src/Printerlib.ycp Thu Aug 28 18:34:10 2008
@@ -1,7 +1,16 @@
+
{
+
module "Printerlib";
textdomain "printer";
+// Fortunately the tools are for all architectures always
+// installed in /usr/lib/YaST2/bin/ (i.e. no "lib64").
+// I tested this on Thu Aug 28 2008 using the command
+// rpm -qlp /work/CDs/all/full-sle10-sp2*/suse/*/yast2-printer.rpm | grep '/YaST2/bin/' | grep -v '/usr/lib/YaST2/bin/'
+global string yast_bin_dir = "/usr/lib/YaST2/bin/";
+
+// By default there is no active "ServerName" entry in /etc/cups/client.conf:
global boolean client_only = false;
global string client_conf_server_name = "";
@@ -12,9 +21,10 @@
// is explicitely set in /etc/cups/cupsd.conf.
global boolean browsing_on = true;
-// By default there is no "BrowseDeny" entry in /etc/cups/cupsd.conf
-// but there can be such entries of the form "BrowseDeny .*" or "BrowseDeny from .*":
-global string cupsd_conf_browse_deny = "";
+// By default there is "BrowseAllow all" in /etc/cups/cupsd.conf
+// which is even the fallback if there is no "BrowseAllow" entry at all
+// or when the "BrowseAllow" entries are deactivated by a leading '#' character.
+global string cupsd_conf_browse_allow = "all";
// The result map is used as a simple common local store for whatever additional results
// (in particular commandline exit code, stdout, stderr, and whatever messages)
@@ -51,22 +61,47 @@
global map cups_autoconfig = $[];
-global void Read(){
- client_only = ExecuteBashCommand( "egrep -i '^ServerName[[:space:]]+[[:alnum:]]' /etc/cups/client.conf" );
- if( ExecuteBashCommand( "sed -n -e 's/^[Se][Ee][Rr][Vv][Ee][Rr][Nn][Aa][Mm][Ee][[:space:]][[:space:]]*\\(.*\\)$/\\1/p' /etc/cups/client.conf | tr -d '[:space:]'" ) )
- client_conf_server_name = result["stdout"]:"";
-
- if( Printerlib::ExecuteBashCommand( "egrep -i '^Browsing[[:space:]]+Off|^Browsing[[:space:]]+No' /etc/cups/cupsd.conf" ) )
- browsing_on = false;
- string commandline = "egrep -i '^BrowseDeny[[:space:]]+|^BrowseDeny[[:space:]]+from[[:space:]]+' /etc/cups/cupsd.conf | sed -e 's/[Ff][Rr][Oo][Mm]//' | tr -s '[:space:]' | cut -d ' ' -f 2 | tr '[:space:]' ' '";
- if( Printerlib::ExecuteBashCommand( commandline ) ) cupsd_conf_browse_deny = Printerlib::result["stdout"]:"";
- // read cups-autoconfiguration settings
- cups_autoconfig = (map)SCR::Read(.etc.cups-auto.all);
-y2internal("read cups-auto %1", cups_autoconfig);
+global void Read()
+{ // Determine the 'Browsing [ On | Off ]' value in /etc/cups/cupsd.conf:
+ if( Printerlib::ExecuteBashCommand( Printerlib::yast_bin_dir + "modify_cupsd_conf Browsing" ) )
+ { // Ignore when this command fails and use the fallback "Printerlib::browsing_on = true"
+ string browsing = tolower( Printerlib::result["stdout"]:"On" );
+ if( "off" == browsing || "no" == browsing )
+ { Printerlib::browsing_on = false;
+ }
+ }
+ // Determine the 'BrowseAllow [ all | none | @LOCAL | IP-address[/netmask] ]' values in /etc/cups/cupsd.conf:
+ if( Printerlib::ExecuteBashCommand( Printerlib::yast_bin_dir + "modify_cupsd_conf BrowseAllow" ) )
+ { // Ignore when this command fails and use the fallback "Printerlib::cupsd_conf_browse_allow = "all"
+ Printerlib::cupsd_conf_browse_allow = Printerlib::result["stdout"]:"all";
+ }
+ // Determine the 'ServerName' value in /etc/cups/client.conf:
+ if( Printerlib::ExecuteBashCommand( Printerlib::yast_bin_dir + "cups_client_only" ) )
+ { // Ignore when this command fails and use the fallback "Printerlib::client_only = false"
+ // and the fallback "Printerlib::client_conf_server_name = ""
+ Printerlib::client_conf_server_name = Printerlib::result["stdout"]:"";
+ if( "" != Printerlib::client_conf_server_name
+ && "localhost" != Printerlib::client_conf_server_name )
+ { // Note that even 'localhost' is a valid ServerName value
+ // which is used to force client tools (e.g. lpadmin, lpinfo, lpstat)
+ // to ask the local cupsd via the IPP port on localhost (localhost:631)
+ // and not via the domain socket (/var/run/cups/cups.sock) because
+ // the latter failed in the past for certain third-party clients (e.g. Java).
+ // If the ServerName value in /etc/cups/client.conf is 'localhost'
+ // it is actually no client-only config because the local cupsd is used.
+ Printerlib::client_only = true;
+ }
+ }
+ // Read cups-autoconfiguration settings:
+ cups_autoconfig = (map)SCR::Read(.etc.cups-auto.all);
+ y2internal("read cups-auto %1", cups_autoconfig);
}
-global void Write(){
- y2milestone("Writing cups-autoconfig.conf\n%1", cups_autoconfig);
- SCR::Write(.etc.cups-auto.all, cups_autoconfig);
+global void Write()
+{ // Write cups-autoconfiguration settings:
+ y2milestone("Writing cups-autoconfig.conf\n%1", cups_autoconfig);
+ SCR::Write(.etc.cups-auto.all, cups_autoconfig);
}
+
}
+
Modified: trunk/printer/src/dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/dialogs.ycp?rev=50463&r1=50462&r2=50463&view=diff
==============================================================================
--- trunk/printer/src/dialogs.ycp (original)
+++ trunk/printer/src/dialogs.ycp Thu Aug 28 18:34:10 2008
@@ -262,8 +262,10 @@
"NETWORKPRINTING" : $[
"widget" : `custom,
"custom_widget" : widgetNetworkPrinting,
+ "init" : initNetworkPrinting,
"handle" : handleNetworkPrinting,
- "help" : HELPS["printing_via_network_dialog"]:""
+ "store" : storeNetworkPrinting,
+ "help" : HELPS["printing_via_network_dialog"]:""
],
"SHARING" : $[
"widget" : `custom,
Modified: trunk/printer/src/printingvianetwork.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/printingvianetwork.ycp?rev=50463&r1=50462&r2=50463&view=diff
==============================================================================
--- trunk/printer/src/printingvianetwork.ycp (original)
+++ trunk/printer/src/printingvianetwork.ycp Thu Aug 28 18:34:10 2008
@@ -47,34 +47,29 @@
`RadioButtonGroup( `id(`browsing_or_client_only_check_boxs),
`VBox( `Left( `RadioButton( `id(`cupsd_conf_browsing_off_radio_button),
`opt(`notify),
- _("&Do not Receive Printer Information from Remote CUPS servers"),
- ! Printerlib::client_only && ! Printerlib::browsing_on
+ _("&Do not Receive Printer Information from Remote CUPS servers")
)
),
`Left( `RadioButton( `id(`cupsd_conf_browsing_on_radio_button),
`opt(`notify),
- _("&Receive Printer Information from Remote CUPS servers"),
- ! Printerlib::client_only && Printerlib::browsing_on
+ _("Receive Printer &Information from Remote CUPS servers")
)
),
`HBox( `HSpacing( 3 ),
- `TextEntry( `id(`cupsd_conf_browse_deny_input),
- _("&Show Printers Published by CUPS Servers Except the Following (separated by spaces)"),
- Printerlib::cupsd_conf_browse_deny
+ `TextEntry( `id(`cupsd_conf_browse_allow_input),
+ _("Accept Information from those &Servers (separated by a space)")
)
),
`VSpacing( 1 ),
- `Left( `RadioButton( `id(`client_only_check_box),
+ `Left( `RadioButton( `id(`client_only_radio_button),
`opt(`notify),
- _("Do All Your Printing Directly via One Remote &CUPS Server"),
- Printerlib::client_only
+ _("Do All Your Printing Directly via &One Remote CUPS Server")
)
),
`HBox( `HSpacing( 3 ),
`HWeight( 2,
`TextEntry( `id(`client_conf_server_name_input),
- _("&Hostname / IP Address"),
- Printerlib::client_conf_server_name
+ _("&Hostname / IP Address")
)
),
`HWeight( 1,
@@ -97,57 +92,113 @@
`VStretch()
);
-
-symbol handleNetworkPrinting(string key, map event){
- if( Printerlib::browsing_on )
- { UI::ChangeWidget( `id(`cupsd_conf_browse_deny_input), `Enabled, true );
- UI::ChangeWidget( `id(`client_conf_server_name_input), `Enabled, false );
- UI::ChangeWidget( `id(`test_client_conf_server), `Enabled, false );
- UI::ChangeWidget( `id(`connection_wizard), `Enabled, true );
+void initNetworkPrinting(string key)
+{ y2milestone( "entering initNetworkPrinting with key '%1'", key );
+ // Determine the 'Browsing [ On | Off ]' value in /etc/cups/cupsd.conf:
+ if( Printerlib::ExecuteBashCommand( Printerlib::yast_bin_dir + "modify_cupsd_conf Browsing" ) )
+ { // Ignore when this command fails and use initially the fallback "Printerlib::browsing_on = true"
+ string browsing = tolower( Printerlib::result["stdout"]:"On" );
+ if( "off" == browsing || "no" == browsing )
+ { Printerlib::browsing_on = false;
+ }
+ else
+ { Printerlib::browsing_on = true;
+ }
}
- else
- { UI::ChangeWidget( `id(`cupsd_conf_browse_deny_input), `Enabled, false );
- UI::ChangeWidget( `id(`client_conf_server_name_input), `Enabled, false );
- UI::ChangeWidget( `id(`test_client_conf_server), `Enabled, false );
- UI::ChangeWidget( `id(`connection_wizard), `Enabled, true );
+ // Determine the 'BrowseAllow [ all | none | @LOCAL | IP-address[/netmask] ]' values in /etc/cups/cupsd.conf:
+ if( Printerlib::ExecuteBashCommand( Printerlib::yast_bin_dir + "modify_cupsd_conf BrowseAllow" ) )
+ { // Ignore when this command fails and use initially the fallback "Printerlib::cupsd_conf_browse_allow = "all"
+ Printerlib::cupsd_conf_browse_allow = Printerlib::result["stdout"]:"all";
+ }
+ // Determine the 'ServerName' value in /etc/cups/client.conf:
+ if( Printerlib::ExecuteBashCommand( Printerlib::yast_bin_dir + "cups_client_only" ) )
+ { // Ignore when this command fails and use initially the fallback "Printerlib::client_only = false"
+ // and the initiall fallback "Printerlib::client_conf_server_name = ""
+ Printerlib::client_conf_server_name = Printerlib::result["stdout"]:"";
+ if( "" != Printerlib::client_conf_server_name
+ && "localhost" != Printerlib::client_conf_server_name )
+ { // Note that even 'localhost' is a valid ServerName value
+ // which is used to force client tools (e.g. lpadmin, lpinfo, lpstat)
+ // to ask the local cupsd via the IPP port on localhost (localhost:631)
+ // and not via the domain socket (/var/run/cups/cups.sock) because
+ // the latter failed in the past for certain third-party clients (e.g. Java).
+ // If the ServerName value in /etc/cups/client.conf is 'localhost'
+ // it is actually no client-only config because the local cupsd is used.
+ Printerlib::client_only = true;
+ }
+ else
+ { Printerlib::client_only = false;
+ }
}
+ // Have all widgets disabled initially
+ // but nevertheless fill in the values of the current settings in the system:
+ UI::ChangeWidget( `id(`cupsd_conf_browsing_off_radio_button), `Value, false );
+ UI::ChangeWidget( `id(`cupsd_conf_browsing_on_radio_button), `Value, false );
+ UI::ChangeWidget( `id(`cupsd_conf_browse_allow_input), `Enabled, false );
+ UI::ChangeWidget( `id(`cupsd_conf_browse_allow_input), `Value, Printerlib::cupsd_conf_browse_allow );
+ UI::ChangeWidget( `id(`client_only_radio_button), `Value, false );
+ UI::ChangeWidget( `id(`client_conf_server_name_input), `Enabled, false );
+ UI::ChangeWidget( `id(`client_conf_server_name_input), `Value, Printerlib::client_conf_server_name );
+ UI::ChangeWidget( `id(`test_client_conf_server), `Enabled, false );
+ UI::ChangeWidget( `id(`connection_wizard), `Enabled, false );
+ // Enable those widgets which match to the current settings in the system:
+ // If there is 'Browsing On' in /etc/cups/cupsd.conf
+ // but there is also an active ServerName (!="localhost") in /etc/cups/client.conf
+ // have only the client-only widgets avtivated because client-only has topmost priority:
if( Printerlib::client_only )
- { UI::ChangeWidget( `id(`cupsd_conf_browse_deny_input), `Enabled, false );
+ { UI::ChangeWidget( `id(`client_only_radio_button), `Value, true );
UI::ChangeWidget( `id(`client_conf_server_name_input), `Enabled, true );
UI::ChangeWidget( `id(`test_client_conf_server), `Enabled, true );
- UI::ChangeWidget( `id(`connection_wizard), `Enabled, false );
}
+ else
+ { UI::ChangeWidget( `id(`connection_wizard), `Enabled, true );
+ if( Printerlib::browsing_on )
+ { UI::ChangeWidget( `id(`cupsd_conf_browsing_on_radio_button), `Value, true );
+ UI::ChangeWidget( `id(`cupsd_conf_browse_allow_input), `Enabled, true );
+ }
+ else
+ { UI::ChangeWidget( `id(`cupsd_conf_browsing_off_radio_button), `Value, true );
+ }
+ }
+ y2milestone( "leaving initNetworkPrinting" );
+}
- if ( event["EventReason"]:"" == "ValueChanged" ){
- if( event["ID"]:nil == `cupsd_conf_browsing_on_radio_button )
- { UI::ChangeWidget( `id(`cupsd_conf_browse_deny_input), `Enabled, true );
+symbol handleNetworkPrinting(string key, map event)
+{ y2milestone( "entering handleNetworkPrinting with key '%1'\nand event '%2'", key, event );
+ if( "ValueChanged" == event["EventReason"]:"" )
+ { if( `cupsd_conf_browsing_on_radio_button == event["ID"]:nil )
+ { UI::ChangeWidget( `id(`cupsd_conf_browse_allow_input), `Enabled, true );
UI::ChangeWidget( `id(`client_conf_server_name_input), `Enabled, false );
UI::ChangeWidget( `id(`test_client_conf_server), `Enabled, false );
UI::ChangeWidget( `id(`connection_wizard), `Enabled, true );
}
- if( event["ID"]:nil == `cupsd_conf_browsing_off_radio_button )
- { UI::ChangeWidget( `id(`cupsd_conf_browse_deny_input), `Enabled, false );
+ if( `cupsd_conf_browsing_off_radio_button == event["ID"]:nil )
+ { UI::ChangeWidget( `id(`cupsd_conf_browse_allow_input), `Enabled, false );
UI::ChangeWidget( `id(`client_conf_server_name_input), `Enabled, false );
UI::ChangeWidget( `id(`test_client_conf_server), `Enabled, false );
UI::ChangeWidget( `id(`connection_wizard), `Enabled, true );
}
- if( event["ID"]:nil == `client_only_check_box)
- { UI::ChangeWidget( `id(`cupsd_conf_browse_deny_input), `Enabled, false );
+ if( `client_only_radio_button == event["ID"]:nil )
+ { UI::ChangeWidget( `id(`cupsd_conf_browse_allow_input), `Enabled, false );
UI::ChangeWidget( `id(`client_conf_server_name_input), `Enabled, true );
UI::ChangeWidget( `id(`test_client_conf_server), `Enabled, true );
UI::ChangeWidget( `id(`connection_wizard), `Enabled, false );
}
}
-
- if (event["EventReason"]:""=="Activated" && event["ID"]:nil==`connection_wizard) return `connection_wizard;
-
- y2internal("event %1", event);
- return nil;
+ if( "Activated" == event["EventReason"]:"" )
+ { if( `connection_wizard == event["ID"]:nil )
+ { return `connection_wizard;
+ }
+ }
+ y2internal("event %1", event);
+ y2milestone( "leaving handleNetworkPrinting" );
+ return nil;
}
-
-
-
+void storeNetworkPrinting(string key, map event)
+{ y2milestone( "entering storeNetworkPrinting with key '%1'\nand event '%2'", key, event );
+ y2milestone( "leaving storeNetworkPrinting" );
+}
/**
Modified: trunk/printer/tools/cups_client_only
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/tools/cups_client_only?rev=50463&r1=50462&r2=50463&view=diff
==============================================================================
--- trunk/printer/tools/cups_client_only (original)
+++ trunk/printer/tools/cups_client_only Thu Aug 28 18:34:10 2008
@@ -45,7 +45,7 @@
# the output is the empty string (i.e. nothing at all - not even a '\n' character).
# The 'tr ... [:blank:]' makes sure that all active ServerName entries
# are found if there is more than one which is a broken config.
-SERVERNAME="$( grep -i '^ServerName ' /etc/cups/client.conf | tr -s '[:blank:]' ' ' | cut -s -d' ' -f2 )"
+SERVERNAME="$( grep -i '^ServerName ' /etc/cups/client.conf | tr -s '[:blank:]' ' ' | cut -s -d' ' -f2 | tr -s '\n' ' ' | sed -e 's/ *$//' )"
echo -n "$SERVERNAME"
# For a nicer output on a terminal where stdout and stderr is mixed up,
# output a '\n' on stderr to get subsequent stuff (e.g. the shell prompt
Modified: trunk/printer/tools/modify_cupsd_conf
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/tools/modify_cupsd_conf?rev=50463&r1=50462&r2=50463&view=diff
==============================================================================
--- trunk/printer/tools/modify_cupsd_conf (original)
+++ trunk/printer/tools/modify_cupsd_conf Thu Aug 28 18:34:10 2008
@@ -17,7 +17,12 @@
echo "Without a new value, the current value is reported." 1>&2
echo "Supported keywords and possible new values are:" 1>&2
echo "Browsing [ On | Off ]" 1>&2
- echo "BrowseAllow [ all | none | @LOCAL | IP-address ]" 1>&2
+ echo "BrowseAllow [ all | none | @LOCAL | IP-address[/netmask] ]" 1>&2
+ echo "E.g.: BrowseAllow '@LOCAL 192.168.100.1 192.168.200.0/255.255.255.0'" 1>&2
+ echo "There is a strict syntax for keywords and values:" 1>&2
+ echo "Case matters." 1>&2
+ echo "Neither leading nor trailing nor in-between spaces are allowed." 1>&2
+ echo "Multiple values for a keyword must be separated by exactly one space." 1>&2
exit 1
fi
@@ -34,7 +39,7 @@
{ if test -n "$VALUE"
then # If a value was specified, only 'On' or 'Off' (case sensitive) are allowed:
if ! test "On" = "$VALUE" -o "Off" = "$VALUE"
- then echo "Only '$KEY [ On | Off ]' is allowed." 1>&2
+ then echo "Only '$KEY [ On | Off ]' is supported." 1>&2
exit 4
fi
# Try to substitute an existing Browsing line (ignore case):
@@ -54,7 +59,8 @@
# Report the resulting setting in any case:
# The 'tr ... [:blank:]' makes sure that all active Browsing entries
# are found if there is more than one which is a broken config.
- RESULT="$( grep -i "^$KEY " $CUPSDCONF | tr -s '[:blank:]' ' ' | cut -s -d' ' -f2 )"
+ # Remove trailing spaces (needed for the test below).
+ RESULT="$( grep -i "^$KEY " $CUPSDCONF | tr -s '[:blank:]' ' ' | cut -s -d' ' -f2 | tr -s '\n' ' ' | sed -e 's/ *$//' )"
echo -n "$RESULT"
# For a nicer output on a terminal where stdout and stderr is mixed up,
# output a '\n' on stderr to get subsequent stuff (e.g. the shell prompt
@@ -67,20 +73,23 @@
fi
}
-# Function to deal with 'BrowseAllow [ all | none | @LOCAL | IP-address ]'
+# Function to deal with 'BrowseAllow [ all | none | @LOCAL | IP-address[/netmask] ]'
BrowseAllow()
{ if test -n "$VALUE"
then # If a value was specified, only 'all' or 'none' or '@LOCAL' (case sensitive)
- # or a single IP-address is allowed:
- if ! test "all" = "$VALUE" -o "none" = "$VALUE" -o "@LOCAL" = "$VALUE"
- then # Test if value matches to IP-address syntax:
- if ! echo $VALUE | egrep -q '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$'
- then echo "Only '$KEY [ all | none | @LOCAL | IP-address ]' is allowed." 1>&2
- exit 4
- fi
- fi
+ # or one or more IP-addresses are allowed:
+ for V in $VALUE
+ do if ! test "all" = "$V" -o "none" = "$V" -o "@LOCAL" = "$V"
+ then # Test if value matches to IP-address syntax:
+ if ! echo "$V" | egrep -q '^([0-9]{1,3}\.){3}[0-9]{1,3}(/([0-9]{1,2})|/(([0-9]{1,3}\.){3}[0-9]{1,3}))?$'
+ then echo "Only '$KEY [ all | none | @LOCAL | IP-address[/netmask] ]' is supported." 1>&2
+ exit 4
+ fi
+ fi
+ done
# Set 'BrowseOrder allow,deny' to deny browse packets by default
- # and then allow them from certain sources via a BrowseAllow entry.
+ # and then allow them from certain sources via BrowseAllow entries
+ # and finally deny from certain sources via BrowseDeny entries.
# All existing BrowseOrder lines are removed (ignore case).
sed -i.yast2save -e '/^BrowseOrder.*/Id' $CUPSDCONF
# Append the new BrowseOrder line below the last 'Brows' line (ignore case)
@@ -91,16 +100,22 @@
then sed -i -e "${LAST_BROWSE_LINE}aBrowseOrder allow,deny" $CUPSDCONF
else echo -en "\nBrowseOrder allow,deny\n\n" >>$CUPSDCONF
fi
- # All existing BrowseAllow lines are removed (ignore case):
+ # All existing active BrowseAllow lines are removed (ignore case):
sed -i -e '/^BrowseAllow.*/Id' $CUPSDCONF
- # Append a BrowseAllow line below the BrowseOrder line
- # to have the new BrowseAllow line at the matching place:
- sed -i -e "/^BrowseOrder /a$KEY from $VALUE" $CUPSDCONF
+ # All existing active BrowseDeny lines are deactivated (ignore case):
+ sed -i -e 's/^\(BrowseDeny.*\)$/#\1/i' $CUPSDCONF
+ # Insert BrowseAllow lines before the BrowseOrder line
+ # to have the new BrowseAllow lines at the matching place
+ # and in the ordering of the values (needed for the test below):
+ for V in $VALUE
+ do sed -i -e "/^BrowseOrder /i$KEY from $V" $CUPSDCONF
+ done
fi
# Report the resulting setting in any case:
# The 'tr ... [:blank:]' makes sure that all active BrowseAllow entries
# are found if there is more than one which is allowed.
- RESULT="$( grep -i "^$KEY " $CUPSDCONF | tr -s '[:blank:]' ' ' | cut -s -d' ' -f3 )"
+ # Remove trailing spaces (needed for the test below).
+ RESULT="$( grep -i "^$KEY " $CUPSDCONF | sed -e 's/from//I' | tr -s '[:blank:]' ' ' | cut -s -d' ' -f2 | tr -s '\n' ' ' | sed -e 's/ *$//' )"
echo -n "$RESULT"
# For a nicer output on a terminal where stdout and stderr is mixed up,
# output a '\n' on stderr to get subsequent stuff (e.g. the shell prompt
Modified: trunk/printer/yast2-printer.spec.in
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/yast2-printer.spec.in?rev=50463&r1=50462&r2=50463&view=diff
==============================================================================
--- trunk/printer/yast2-printer.spec.in (original)
+++ trunk/printer/yast2-printer.spec.in Thu Aug 28 18:34:10 2008
@@ -56,6 +56,8 @@
@ybindir@/autodetect_printers
@ybindir@/create_printer_ppd_database
@ybindir@/determine_printer_driver_options
+@ybindir@/cups_client_only
+@ybindir@/modify_cupsd_conf
#Documentation
%dir @docdir@
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org