From owner-freebsd-current@FreeBSD.ORG Fri Jul 18 14:28:39 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 781EA61E; Fri, 18 Jul 2014 14:28:39 +0000 (UTC) Received: from mail.0x20.net (mail.0x20.net [217.69.76.211]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1F8842A31; Fri, 18 Jul 2014 14:28:38 +0000 (UTC) Received: from e-new.0x20.net (mail.0x20.net [IPv6:2001:aa8:fffb:1::3]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.0x20.net (Postfix) with ESMTPS id CE0B76A6032; Fri, 18 Jul 2014 16:28:35 +0200 (CEST) Received: from e-new.0x20.net (localhost [127.0.0.1]) by e-new.0x20.net (8.14.7/8.14.7) with ESMTP id s6IESZla006848; Fri, 18 Jul 2014 16:28:35 +0200 (CEST) (envelope-from lars@e-new.0x20.net) Received: (from lars@localhost) by e-new.0x20.net (8.14.7/8.14.7/Submit) id s6IESZpS006396; Fri, 18 Jul 2014 16:28:35 +0200 (CEST) (envelope-from lars) Date: Fri, 18 Jul 2014 16:28:35 +0200 From: Lars Engels To: Andreas Nilsson Subject: Re: HOWTO articles for migrating from Linux to FreeBSD, especially for pkg? Message-ID: <20140718142835.GF96250@e-new.0x20.net> Mail-Followup-To: Lars Engels , Andreas Nilsson , Navdeep Parhar , Craig Rodrigues , Adrian Chadd , freebsd-doc@freebsd.org, Alberto Mijares , freebsd-current Current , ports References: <53C82EC4.8060304@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="aPdhxNJGSeOG9wFI" Content-Disposition: inline In-Reply-To: X-Editor: VIM - Vi IMproved 7.4 X-Operation-System: FreeBSD 8.4-RELEASE-p4 User-Agent: Mutt/1.5.23 (2014-03-12) Cc: Craig Rodrigues , Adrian Chadd , ports , freebsd-doc@freebsd.org, Alberto Mijares , freebsd-current Current , Navdeep Parhar X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jul 2014 14:28:39 -0000 --aPdhxNJGSeOG9wFI Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jul 17, 2014 at 10:21:17PM +0200, Andreas Nilsson wrote: > On Thu, Jul 17, 2014 at 10:15 PM, Navdeep Parhar wrot= e: >=20 > > On 07/17/14 13:12, Adrian Chadd wrote: > > > On 17 July 2014 13:03, Alberto Mijares wrote: > > >> On Thu, Jul 17, 2014 at 2:58 PM, Adrian Chadd > > 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? > > >=20 > They sure are. >=20 > 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=3DYES" 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! --aPdhxNJGSeOG9wFI Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iQF8BAEBCgBmBQJTyS8TXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ4RjQwMDE3RTRERjUzMTI1N0FGRTUxNDlF NTRDQjM3RDNBMDg5RDZEAAoJEOVMs306CJ1tfowH/A9Q4mw598FoIhOWJ3lQ40W3 srBxvcIOLpr80N4Z65QRuuO+Xun3hmRQ9SWUpBPgs+reV0VDV+GgCfg4/9P1zoVT rPyXSgHA99v/sDcVgA4dTiKUXqlD8bm9fEI7JbvSv8RQzKgFirNb1IPe96S7Rsex nsGXZw33yS/SZoAqVreLenJ//+Hxfj4dIBZ8YrrAZLxvMR4WmiOTUDfxctUTWf3F eWm4c5Joj4M+1iN1fuc1DW8oPvFOgtuRTkLX1PBjNcBDpRFtVxrU4E+46SrAlgxl H+fsRUPtjfaDIyLXfjvsx/dkfCqwLXBDh80Zp77P9TBr71hjmR+Sozi38lGkAAY= =Q4Si -----END PGP SIGNATURE----- --aPdhxNJGSeOG9wFI--