Sunday, December 7, 2008

KDE Network Configuration tool and Slackware

This weekend I tried to help someone on LinuxQuestions.org who asked about the knetworkconf tool from KDEs Control Center.
In Slackware this tool hasn't been working for quite some time, it simply says that our operating system is not supported:


(My KDE is in Portuguese, but you'll get the idea...)

I never bothered about it, as I prefer to do all configuring the 'Slackware-way': editing text files. This way I know what's happening and I am in control.

But I understand that this is not for everyone, so this subject pops up once in a while on the forums and I decided to take a look again.

The knetworkconf tool uses several Perl scripts that are stored in /usr/share/apps/knetworkconf/backends
I am definitely not a Perl-guru, but browsing through the several files, I discovered it was nothing too complicated. Basically, network configuration hasn't changed much in Slackware over the last several versions so first I just added the newer version numbers to all files where they were checked.

Posting the first patch file on LinuxQuestions.org a fellow forum member (thanks Woodsman!) discovered that the KDE tool did not show the configured domain correctly.
This actually was a bug in the tool, not my patch, but I managed to solve it.

After some more testing I discovered that every time I saved any changes with knetworkconf, my Samba server stopped working and was even disabled.
This turned out to be another silly bug in knetworkconf, where they forgot to use a variable that holds the current status of Samba.

I posted all patches on the forum and Pat has already included them in the -current branch (see the changelog).
I also sent the patches upstream to the fellows at KDE, so hopefully it makes it into the next versions there as well.

Those who use Slackware 12.1 (the most recent stable version), can copy the following lines and save them in a file:

*** orig/network-conf 2008-12-06 10:17:03.000000000 -0200
--- /usr/share/apps/knetworkconf/backends/network-conf 2008-12-06 10:25:17.000000000 -0200
***************
*** 78,83 ****
--- 78,84 ----
"vine-3.0", "vine-3.1",
"ark",
"slackware-9.1.0", "slackware-10.0.0", "slackware-10.1.0", "slackware-10.2.0",
+ "slackware-11.0.0", "slackware-12.0.0", "slackware-12.1.0", "slackware-12.2.0",
"gentoo", "vlos-1.2", "freebsd-5", "freebsd-6");

$description =<<"end_of_description;";
*** orig/network.pl 2008-12-06 10:16:52.000000000 -0200
--- /usr/share/apps/knetworkconf/backends/network.pl 2008-12-06 21:52:53.000000000 -0200
***************
*** 541,546 ****
--- 541,550 ----
"slackware-10.0.0" => "redhat-6.2",
"slackware-10.1.0" => "redhat-6.2",
"slackware-10.2.0" => "redhat-6.2",
+ "slackware-11.0.0" => "redhat-6.2",
+ "slackware-12.0.0" => "redhat-6.2",
+ "slackware-12.1.0" => "redhat-6.2",
+ "slackware-12.2.0" => "redhat-6.2",
"gentoo" => "debian-2.2",
"vlos-1.2" => "debian-2.2",
"freebsd-5" => "debian-2.2",
***************
*** 1855,1860 ****
--- 1859,1868 ----
"slackware-10.0.0" => \&gst_network_deb22_get_file,
"slackware-10.1.0" => \&gst_network_deb22_get_file,
"slackware-10.2.0" => \&gst_network_deb22_get_file,
+ "slackware-11.0.0" => \&gst_network_deb22_get_file,
+ "slackware-12.0.0" => \&gst_network_deb22_get_file,
+ "slackware-12.1.0" => \&gst_network_deb22_get_file,
+ "slackware-12.2.0" => \&gst_network_deb22_get_file,
"gentoo" => \&gst_network_deb22_get_file,
"freebsd-5" => \&gst_network_deb22_get_file,
"freebsd-6" => \&gst_network_deb22_get_file,
***************
*** 3985,3990 ****
--- 3993,4002 ----
"slackware-10.0.0" => "",
"slackware-10.1.0" => "",
"slackware-10.2.0" => "",
+ "slackware-11.0.0" => "",
+ "slackware-12.0.0" => "",
+ "slackware-12.1.0" => "",
+ "slackware-12.2.0" => "",
"gentoo" => "",
"vlos-1.2" => "",
"freebsd-5" => "",
***************
*** 4160,4165 ****
--- 4172,4181 ----
"slackware-10.0.0" => "slackware-9.1.0",
"slackware-10.1.0" => "slackware-9.1.0",
"slackware-10.2.0" => "slackware-9.1.0",
+ "slackware-11.0.0" => "slackware-9.1.0",
+ "slackware-12.0.0" => "slackware-9.1.0",
+ "slackware-12.1.0" => "slackware-9.1.0",
+ "slackware-12.2.0" => "slackware-9.1.0",
"gentoo" => "gentoo",
"vlos-1.2" => "gentoo",
"freebsd-5" => "freebsd-5",
***************
*** 4442,4447 ****
--- 4458,4464 ----
[ "hostname", \&gst_parse_fq_hostname, HOSTNAME ],
[ "nameserver", \&gst_parse_split_all_unique_hash_comment, RESOLV_CONF, "nameserver", "[ \t]+" ],
[ "searchdomain", \&gst_parse_split_first_array_unique, RESOLV_CONF, "search", "[ \t]+", "[ \t]+" ],
+ [ "domain", \&gst_parse_fq_domain, HOSTNAME ],
[ "domain", \&gst_parse_split_first_str, RESOLV_CONF, "domain", "[ \t]+" ],
[ "order", \&gst_parse_split_first_array, HOST_CONF, "order", "[ \t]+", ",[ \t]*" ],
[ "hostmatch", \&gst_parse_split_first_bool, HOST_CONF, "multi", "[ \t]+" ],
***************
*** 4591,4596 ****
--- 4608,4617 ----
"slackware-10.0.0" => "slackware-9.1.0",
"slackware-10.1.0" => "slackware-9.1.0",
"slackware-10.2.0" => "slackware-9.1.0",
+ "slackware-11.0.0" => "slackware-9.1.0",
+ "slackware-12.0.0" => "slackware-9.1.0",
+ "slackware-12.1.0" => "slackware-9.1.0",
+ "slackware-12.2.0" => "slackware-9.1.0",
"gentoo" => "gentoo",
"vlos-1.2" => "gentoo",
"freebsd-5" => "freebsd-5",
***************
*** 5439,5444 ****
--- 5460,5469 ----
"slackware-10.0.0" => "slackware-9.1.0",
"slackware-10.1.0" => "slackware-9.1.0",
"slackware-10.2.0" => "slackware-9.1.0",
+ "slackware-11.0.0" => "slackware-9.1.0",
+ "slackware-12.0.0" => "slackware-9.1.0",
+ "slackware-12.1.0" => "slackware-9.1.0",
+ "slackware-12.2.0" => "slackware-9.1.0",
"gentoo" => "gentoo",
"vlos-1.2" => "gentoo",
"freebsd-5" => "freebsd-5",
***************
*** 5719,5725 ****
[ "smbdesc", \&gst_replace_ini, SMB_CONF, "global", "server string" ],
[ "winsserver", \&gst_replace_ini, SMB_CONF, "global", "wins server" ],
[ "winsuse", \&gst_replace_ini_bool, SMB_CONF, "global", "wins support" ],
! [ "smbuse", \&gst_service_bsd_set_status, "/etc/rc.d/rc.samba" ],
[ "interface", \&gst_network_interfaces_set, OLD_HASH ],
[ "gateway", \&gst_network_route_set_default_gw, "%gatewaydev%" ]
]
--- 5744,5750 ----
[ "smbdesc", \&gst_replace_ini, SMB_CONF, "global", "server string" ],
[ "winsserver", \&gst_replace_ini, SMB_CONF, "global", "wins server" ],
[ "winsuse", \&gst_replace_ini_bool, SMB_CONF, "global", "wins support" ],
! [ "smbuse", \&gst_service_bsd_set_status, "/etc/rc.d/rc.samba", "%smbuse%" ],
[ "interface", \&gst_network_interfaces_set, OLD_HASH ],
[ "gateway", \&gst_network_route_set_default_gw, "%gatewaydev%" ]
]
***************
*** 5855,5860 ****
--- 5880,5889 ----
"slackware-10.0.0" => "slackware-9.1.0",
"slackware-10.1.0" => "slackware-9.1.0",
"slackware-10.2.0" => "slackware-9.1.0",
+ "slackware-11.0.0" => "slackware-9.1.0",
+ "slackware-12.0.0" => "slackware-9.1.0",
+ "slackware-12.1.0" => "slackware-9.1.0",
+ "slackware-12.2.0" => "slackware-9.1.0",
"gentoo" => "gentoo",
"vlos-1.2" => "gentoo",
"freebsd-5" => "freebsd-5",
*** orig/platform.pl 2008-12-06 10:17:58.000000000 -0200
--- /usr/share/apps/knetworkconf/backends/platform.pl 2008-12-06 10:35:27.000000000 -0200
***************
*** 90,95 ****
--- 90,99 ----
"slackware-10.0.0" => "Slackware 10.0.0",
"slackware-10.1.0" => "Slackware 10.1.0",
"slackware-10.2.0" => "Slackware 10.2.0",
+ "slackware-11.0.0" => "Slackware 11.0.0",
+ "slackware-12.0.0" => "Slackware 12.0.0",
+ "slackware-12.1.0" => "Slackware 12.1.0",
+ "slackware-12.2.0" => "Slackware 12.2.0",
"freebsd-4" => "FreeBSD 4",
"freebsd-5" => "FreeBSD 5",
"freebsd-6" => "FreeBSD 6",
*** orig/service.pl 2008-12-06 10:16:37.000000000 -0200
--- /usr/share/apps/knetworkconf/backends/service.pl 2008-12-06 10:36:52.000000000 -0200
***************
*** 275,280 ****
--- 275,284 ----
"slackware-10.0.0" => "slackware-9.1.0",
"slackware-10.1.0" => "slackware-9.1.0",
"slackware-10.2.0" => "slackware-9.1.0",
+ "slackware-11.0.0" => "slackware-9.1.0",
+ "slackware-12.0.0" => "slackware-9.1.0",
+ "slackware-12.1.0" => "slackware-9.1.0",
+ "slackware-12.2.0" => "slackware-9.1.0",

"gentoo" => "gentoo",
"vlos-1.2" => "gentoo",

Be careful with the longer lines!
Next, open a console as root and type the following:

cd /usr/share/apps/knetworkconf/backends
patch < (your_saved_patchfile)

This should work with all versions since 11.0, but I only tested it on 12.1 and 12.2-RC1, so all standard disclaimers apply...

The result is a working knetworkconf:

Labels: , , ,

2 Comments:

Anonymous Anonymous said...

I did this in both slackware 12.0 and 12.1. I pasted it in a file using cat>patch. when I pasted from the blog in both cases the patch failed with the following message:
root@slack:/usr/share/apps/knetworkconf/backends# patch < patch
patch: **** malformed patch at line 7: "vine-3.0", "vine-3.1",
but when I highlighted and pasted from Linux Questions It worked in both.
Thanks for your time and the patch.

December 10, 2008 at 9:53 PM  
Blogger holson said...

ok, thanks for the warning. Copying text from here can be a bit tricky, as you don't get the necessary spaces. For those interested, the patch can be found on this page on LinuxQuestions.org

December 11, 2008 at 12:09 AM  

Post a Comment

Subscribe to Post Comments [Atom]

<< Home