Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 19 Jul 2014 18:08:09 +0200
From:      Lars Engels <lars.engels@0x20.net>
To:        Adrian Chadd <adrian@freebsd.org>
Cc:        Craig Rodrigues <rodrigc@freebsd.org>, freebsd-rc@freebsd.org, ports <freebsd-ports@freebsd.org>, freebsd-doc@freebsd.org, freebsd-current Current <freebsd-current@freebsd.org>, Andreas Nilsson <andrnils@gmail.com>, Navdeep Parhar <nparhar@gmail.com>
Subject:   [PATCHES] Extend service(8) and rc(8) was: Re: HOWTO articles for migrating from Linux to FreeBSD, especially for pkg?
Message-ID:  <20140719160809.GU96250@e-new.0x20.net>
In-Reply-To: <CAJ-VmoktHRSCxze91SxUaMB4CmfyqrDL3_ako3hObDmR3SrY5g@mail.gmail.com>
References:  <CAG=rPVcyqq2072%2BgF_X91BocxykJB6%2BU0cMhaNexxfVFpVqUbA@mail.gmail.com> <CAJ-Vmo=p6-7KCL8C09O4dPq04pitW5wDbtsDAyz-u4Qtr7rpRA@mail.gmail.com> <CAGZBXN8-Gq1=w8SBHCw26ZX4a29KHBx%2B4FV9XGK1HJiCOGuJ9A@mail.gmail.com> <CAJ-Vmo=8uAXqmX8D%2BoP%2B63dHWVKN6cn8wBH0HNsVmUciNRF1BA@mail.gmail.com> <53C82EC4.8060304@gmail.com> <CAPS9%2BSuswkJNuwhT=o%2B7sBQpbaN0-jhnRK5drugqZw54%2BqzgzA@mail.gmail.com> <20140718142835.GF96250@e-new.0x20.net> <CAJ-VmoktHRSCxze91SxUaMB4CmfyqrDL3_ako3hObDmR3SrY5g@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--ElEgulhWJDonIdTi
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Jul 18, 2014 at 12:10:34PM -0700, Adrian Chadd wrote:
> Hi!
>=20
>=20
> On 18 July 2014 07:28, Lars Engels <lars.engels@0x20.net> 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@gmail.com> w=
rote:
> >>
> >> > On 07/17/14 13:12, Adrian Chadd wrote:
> >> > > On 17 July 2014 13:03, Alberto Mijares <amijaresp@gmail.com> wrote:
> >> > >> On Thu, Jul 17, 2014 at 2:58 PM, Adrian Chadd <adrian@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=3D"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=3DY=
ES"
> > 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!
>=20
> Having a way for sysrc and service to know what particular options and
> services are exposed by a given package or installed "thing" would be
> nice. Right now the namespace is very flat and it's not obvious in all
> instances what needs to happen to make it useful and what the options
> are.
>=20
> "Oh, hm, I'd like to know what options there are for controlling the
> installed apache24 package, let's see"...
>=20
> I remember IRIX having that command to list services, stop them and
> start them, configure them enabled and disabled. Solaris grew
> something like that with Solaris 10 and after the initial learning
> curve it was great. Hving something like that would be 100% awesome.

I've updated the patch and extended it a little:

https://phabric.freebsd.org/D451

It can now print the rc options for a service.
It needs however to have the options listed as comments between the
KEYWORDS section and the sourcing of /etc/rc.subr.


And I've made some changes to rc.subr itself:

https://phabric.freebsd.org/D452

So now you can use

# service sshd describe
Secure Shell Daemon

and

# service sshd extracommands
configtest keygen reload


Sorry for the mess in phabricator's SUMMARY. I will learn the markup
syntax later...


Lars

--ElEgulhWJDonIdTi
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (FreeBSD)

iQF8BAEBCgBmBQJTypfpXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ4RjQwMDE3RTRERjUzMTI1N0FGRTUxNDlF
NTRDQjM3RDNBMDg5RDZEAAoJEOVMs306CJ1twRoH/jnqPDvSF3PxNhIqJPM9zmaa
afViSj5ONY67Y1KsU39vZcM0eqfCSYWoPlZXB93Cj5mK01BcdaxDDMYOrNhx2rwT
dq4ZRzYbtuCKNIrwkCqBrLHUmlzGoRP1txv9fpX/skAVN1Ftf9DcDZHsw+CoLbfI
DrxeVu0OnTNqX6SjqeY/cEjgcmC2uUEpk4os7axaY5PDmGkmxfeHD0gWMazOqrJT
/4G1C7WBBdyNJrGI9D1Llfk76IuVZicy9uj9BXpp6CeVL+sFt48F+DRzOpdx+sIM
DwcEOItw6MI6cD4kV59+/3OhiB4dws2ZYI5mNl2jmXm9jVwAmrk/4Ip1nVytNFs=
=ij8V
-----END PGP SIGNATURE-----

--ElEgulhWJDonIdTi--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140719160809.GU96250>