Re: HOWTO articles for migrating from Linux to FreeBSD, especially for pkg?

From: Brooks Davis <brooks_at_freebsd.org>
Date: Fri, 18 Jul 2014 14:51:38 +0000
On Thu, Jul 17, 2014 at 11:07:39PM +0200, Baptiste Daroussin wrote:
> On Thu, Jul 17, 2014 at 01:57:52PM -0700, Adrian Chadd wrote:
> > On 17 July 2014 13:54, Baptiste Daroussin <bapt_at_freebsd.org> wrote:
> > > On Thu, Jul 17, 2014 at 10:21:17PM +0200, Andreas Nilsson wrote:
> > >> On Thu, Jul 17, 2014 at 10:15 PM, Navdeep Parhar <nparhar_at_gmail.com> wrote:
> > >>
> > >> > On 07/17/14 13:12, Adrian Chadd wrote:
> > >> > > On 17 July 2014 13:03, Alberto Mijares <amijaresp_at_gmail.com> wrote:
> > >> > >> On Thu, Jul 17, 2014 at 2:58 PM, Adrian Chadd <adrian_at_freebsd.org>
> > >> > wrote:
> > >> > >>> Hi!
> > >> > >>>
> > >> > >>> 3) The binary packages need to work out of the box
> > >> > >>> 4) .. which means, when you do things like pkg install apache, it
> > >> > >>> can't just be installed and not be enabled, because that's a bit of a
> > >> > >>> problem;
> > >> > >>
> > >> > >>
> > >> > >> No. Please NEVER do that! The user must be able to edit the files and
> > >> > >> start the service by himself.
> > >> > >
> > >> > > Cool, so what's the single line command needed to type in to start a
> > >> > > given package service?
> > >> >
> > >> > Aren't sysrc(8) and service(8) for this kind of stuff?
> > >> >
> > >>
> > >> They sure are.
> > >>
> > >> Well, pkg install $service ; sysrc ${service}_enable="YES" would do.
> > >> Although some services have different names than the packge, which is sort
> > >> of annoying.
> > >
> > > Maybe service needs to be extended (seriously sysrc ${service}_enable="YES" is
> > > not user friendly) we have service -l that list the services, maybe a service
> > > ${service} on that create /etc/rc.conf.d/${service} with ${service}_enable="YES"
> > > in it and service ${service} off to remove it
> > >
> > > maybe service -l could also be extended to show the current status (maybe with a
> > > -v switch)
> > >
> > > but for sure having the service off by default is a good idea :)
> > 
> > Yeah, maybe having it populate an entry of service_enable="NO" for now .
> 
> then you need to extend rcng to support /usr/local/etc/rc.conf.d so the packages
> can install them without touching base :) and we will need to wait for all
> supported FreeBSD version to have the said modification)

Here's a totally untested patch to do that.  I was rather surprised that
this wasn't configurable already.

-- Brooks

Index: defaults/rc.conf
===================================================================
--- defaults/rc.conf	(revision 268825)
+++ defaults/rc.conf	(working copy)
_at__at_ -56,6 +56,7 _at__at_
 local_startup="/usr/local/etc/rc.d" # startup script dirs.
 script_name_sep=" "	# Change if your startup scripts' names contain spaces
 rc_conf_files="/etc/rc.conf /etc/rc.conf.local"
+rc_conf_dirs="/etc/rc.conf.d /usr/local/etc/rc.conf.d"
 
 # ZFS support
 zfs_enable="NO"		# Set to YES to automatically mount ZFS file systems
Index: rc.subr
===================================================================
--- rc.subr	(revision 268825)
+++ rc.subr	(working copy)
_at__at_ -1289,10 +1289,12 _at__at_
 		fi
 		_rc_conf_loaded=true
 	fi
-	if [ -f /etc/rc.conf.d/"$_name" ]; then
-		debug "Sourcing /etc/rc.conf.d/${_name}"
-		. /etc/rc.conf.d/"$_name"
-	fi
+	for _dir in ${rc_conf_dirs}; do
+		if [ -f "$_dir"/"$_name" ]; then
+			debug "Sourcing ${_dir}/${_name}"
+			. "$dir"/"$_name"
+		fi
+	done
 
 	# Set defaults if defined.
 	for _var in $rcvar; do

Received on Fri Jul 18 2014 - 12:51:46 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:50 UTC