Date: Wed, 29 Jun 2005 10:44:05 +0400 From: Sergey Akifyev <asa@agava.com> To: Joe Marcus Clarke <marcus@marcuscom.com> Cc: FreeBSD GNOME Users <gnome@freebsd.org> Subject: Re: I've partially fixed gnome shares admin, testers needed Message-ID: <1120027445.11279.189.camel@asa> In-Reply-To: <1119896329.90788.39.camel@shumai.marcuscom.com> References: <1119435994.2686.11.camel@asa> <1119896329.90788.39.camel@shumai.marcuscom.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--=-LR86lZuBX6sNcrpfKfcT Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 8bit On пн, 2005-06-27 at 14:18 -0400, Joe Marcus Clarke wrote: > 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 Hello! You understood me wrong, this is not a port patch. This is test patch to already installed perl source. So no %%LOCALBASE%% in it :) Resending patch as an attachment for you ;) P.S. I've partially fixed NFS-shares now, so it is adding entries into /etc/exports. Unfortunately it does it using linux syntax, which is not compatible with BSD in all cases. -- regards, Sergey Akifyev <http://dpx.niibaca.ru> AGAVA Software Company <http://www.agava.com> PGP key available from: ftp://ftp.gascom.ru/pub/PGP-keys/asa.txt --=-LR86lZuBX6sNcrpfKfcT Content-Disposition: attachment; filename=service.diff Content-Type: text/x-patch; name=service.diff; charset=koi8-r Content-Transfer-Encoding: 7bit --- 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; } --=-LR86lZuBX6sNcrpfKfcT--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1120027445.11279.189.camel>