I've partially fixed gnome shares admin, testers needed
Joe Marcus Clarke
marcus at marcuscom.com
Mon Jun 27 18:18:58 GMT 2005
On Wed, 2005-06-22 at 14:26 +0400, Sergey Akifyev wrote:
> Hello, folks!
>
> Try to apply attached patch
> to /usr/X11R6/share/setup-tool-backends/scripts/service.pl . After that,
> SMB sharing should work, and config changes even apply after you press
> OK. I didn't even start any work with NFS.
>
> The patch can affect other admin tools, as it adopts to the script to
> real FreeBSD RCNG. For example with the changes time-admin really runs
> ntpd server, not only enable it in rc.conf.
Nice. One nit I can see quickly. You can't just use "/usr/local". You
have to use %%LOCALBASE%%, and handle the substitution correctly. Also,
can you roll up your patches into an attachment? Thanks!
Joe
>
> Inline included patch:
> --- service.pl.orig Wed Jun 22 12:40:06 2005
> +++ service.pl Wed Jun 22 14:22:30 2005
> @@ -956,7 +956,9 @@
> my ($service) = @_;
> my ($fd, $line, $active);
>
> - $fd = &gst_file_run_pipe_read ("/etc/rc.d/$service rcvar");
> + $path = "/etc/rc.d/$service rcvar";
> + $path = "/usr/local/etc/rc.d/$service.sh" if (-f
> "/usr/local/etc/rc.d/$service.sh");
> + $fd = &gst_file_run_pipe_read ("$path rcvar");
>
> while (<$fd>)
> {
> @@ -1369,6 +1371,31 @@
> }
> }
>
> +# Start or stop the service, depending on $active. Set
> +# links accordingly. $force makes this function use
> +# start/stop only, without considerations for restart.
> +# Not to be called from parse/replace tables, due to last $force
> +# param: use the following two functions instead.
> +sub gst_service_rcng_set_status_do
> +{
> + my ($service, $active, $force) = @_;
> + my ($arg, $status);
> +
> + $status = &gst_service_rcng_get_status ($service);
> + if ($status && !$force)
> + {
> + # if it's already active and you want it active, restart.
> + $arg = $active? "restart" : "stop";
> + }
> + else
> + {
> + # normal operation.
> + $arg = $active? "start" : "stop";
> + }
> +
> + return &gst_service_rcng_run_script ($service, $arg);
> +}
> +
> sub gst_service_rcng_set_status
> {
> my ($service, $action) = @_;
> @@ -1376,9 +1403,11 @@
> my ($default_rcconf) = "/etc/defaults/rc.conf";
> my ($rcconf) = "/etc/rc.conf";
>
> - if (&gst_file_exists ("/etc/rc.d/$service"))
> + $path = "/etc/rc.d/$service";
> + $path = "/usr/local/etc/rc.d/$service.sh" if (-f
> "/usr/local/etc/rc.d/$service.sh");
> + if (&gst_file_exists ("$path"))
> {
> - $fd = &gst_file_run_pipe_read ("/etc/rc.d/$service rcvar");
> + $fd = &gst_file_run_pipe_read ("$path rcvar");
>
> while (<$fd>)
> {
> @@ -1401,18 +1430,7 @@
> }
>
> &gst_file_close ($fd);
> - }
> - elsif (&gst_file_exists ("/usr/local/etc/rc.d/$service.sh"))
> - {
> - if ($action)
> - {
> - gst_file_copy ("/usr/local/etc/rc.d/$service.sh.sample",
> - "/usr/local/etc/rc.d/$service.sh");
> - }
> - else
> - {
> - gst_file_remove ("/usr/local/etc/rc.d/$service.sh");
> - }
> + &gst_service_rcng_set_status_do ($service, $action, 1);
> }
> }
>
> @@ -1547,7 +1565,12 @@
> {
> my ($service) = @_;
>
> - $line = gst_file_run_backtick ("/etc/rc.d/$service forcestatus");
> + if ( -f "/usr/local/etc/rc.d/$service.sh" ) {
> + $line = gst_file_run_backtick ("/usr/local/etc/rc.d/$service.sh
> forcestatus");
> + } else {
> + $line = gst_file_run_backtick ("/etc/rc.d/$service forcestatus");
> + }
> +
> return 1 if ($line =~ /pid [0-9]*/);
>
> # hacky as hell, we need to check services in /usr/local/etc/rc.d
> @@ -1727,7 +1750,9 @@
>
> $farg = $map {$arg};
>
> - if (!&gst_file_run ("/etc/rc.d/$service $farg"))
> + $path = "/etc/rc.d/$service";
> + $path = "/usr/local/etc/rc.d/$service.sh" if (-f
> "/usr/local/etc/rc.d/$service.sh");
> + if (!&gst_file_run ("$path $farg"))
> {
> &gst_report ("service_sysv_op_success", $service, $str);
> &gst_report_leave ();
> @@ -1801,7 +1826,7 @@
> my ($service) = @_;
>
> return 1 if ( -f "/etc/rc.d/$service");
> - return 1 if ( -f "/usr/local/etc/rc.d/$service.sh.sample");
> + return 1 if ( -f "/usr/local/etc/rc.d/$service.sh");
> return 0;
> }
>
>
>
--
PGP Key : http://www.marcuscom.com/pgp.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: This is a digitally signed message part
Url : http://lists.freebsd.org/pipermail/freebsd-gnome/attachments/20050627/a4381a18/attachment.bin
More information about the freebsd-gnome
mailing list