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

Lars Engels lars.engels at 0x20.net
Fri Jul 18 14:28:39 UTC 2014


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.

I hacked up a solution for service(8):

http://bsd-geek.de/FreeBSD/service.sh.enable-disable.patch

The patch adds the following directives to service(8):

enable: Grabs an rc script's rcvar value and runs "sysrc foo_enable=YES"
disable: The opposite of enable
rcdelete: Deletes an rc script's rcvar value from /etc/rc.conf using
          "sysrc -x foo_enable"

The nice thing about is that you can use one of the new directives on
one line with the old ones, as long as the new are the first argument:

# service syslogd enable
# service apache24 disable stop
# service apache24 rcdelete stop
# service nginx enable start


So after installing a package, to start and enable a daemon permanently
all you have to run is
# service foo enable start

Lars

P.S.: Thansk to Devin for his hard work on sysrc!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 618 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-doc/attachments/20140718/dae6b091/attachment.sig>


More information about the freebsd-doc mailing list