Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Nov 2010 20:48:00 -0700
From:      Devin Teske <dteske@vicor.com>
To:        Devin Teske <dteske@vicor.com>
Cc:        freebsd-rc@freebsd.org
Subject:   Re: sysrc(8) -- a sysctl(8)-like utility for managing rc.conf(5)
Message-ID:  <17B64023-A64A-40DA-9CBC-A601710AB5BB@vicor.com>
In-Reply-To: <1288746388.7362.4.camel@localhost.localdomain>
References:  <1286925182.32724.18.camel@localhost.localdomain> <1286996709.32724.60.camel@localhost.localdomain> <1287448781.5713.3.camel@localhost.localdomain> <1287510629.25599.2.camel@localhost.localdomain> <D763F474-8F19-4C65-B23F-78C9B137A8FE@vicor.com> <1288746388.7362.4.camel@localhost.localdomain>

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

On Nov 2, 2010, at 6:06 PM, Devin Teske wrote:

> On Wed, 2010-10-20 at 23:46 -0700, Devin Teske wrote:=20
>> On Oct 19, 2010, at 10:50 AM, Devin Teske wrote:
>>=20
>>> On Mon, 2010-10-18 at 17:39 -0700, Devin Teske wrote:
>>>> On Wed, 2010-10-13 at 12:05 -0700, Devin Teske wrote:=20
>>>>> On Tue, 2010-10-12 at 16:13 -0700, Devin Teske wrote:
>>>>>> Hey all,
>>>>>>=20
>>>>>> [...]
>>>>>>=20
>>>>>> Behold... sysrc(8) v2.0
>>>>>>=20
>>>>>> #!/bin/sh
>>>>>> [...]
>>>>>=20
>>>>> Version 2.1 is available here: http://druidbsd.sf.net/
>>>>=20
>>>> Version 2.2 now.
>>>> Same links.
>>>>=20
>>>> I added `-R dir' for specifying an alternate root (other than `/')
>>>> directory (mostly for handling jails).
>>>=20
>>> Version 2.3 now.
>>> Same links.
>>>=20
>>=20
>> Version 2.4 now.
>> Same links.
>>=20
>=20
> Version 2.5 now.
> Same links.
>=20
> That should be all the features that were requested (and some that
> weren't).

Minor fix ^_^
Version 2.5.1 now.

>=20
>>>=20
>>>>=20
>>>>>=20
>>>>> Direct links:
>>>>> http://druidbsd.sf.net/download/sysrc.gz (download gzipped)
>>>>> http://druidbsd.sf.net/download/sysrc.txt (view as text)
>>>>>=20
>>>>> Here's the changes:
>>>>>=20
>>>>=20
>>>=20
>=20
>=20


--- sysrc.2_5	2010-11-02 17:56:54.000000000 -0700
+++ sysrc	2010-11-02 20:35:12.000000000 -0700
@@ -2,7 +2,7 @@
 # -*- tab-width:  4 -*- ;; Emacs
 # vi: set tabstop=3D4     :: Vi/ViM
 #
-# Revision: 2.5
+# Revision: 2.5.1
 # Last Modified: November 2nd, 2010
 ############################################################ COPYRIGHT
 #
@@ -30,6 +30,7 @@
 # SUCH DAMAGE.
 #
 # AUTHOR      DATE      DESCRIPTION
+# dteske   2010.11.02   Fix quotes when replacing null assignment.
 # dteske   2010.11.02   Preserve leading/trailing whitespace in =
sysrc_set().
 # dteske   2010.11.02   Deprecate lrev() in favor of tail(1)'s `-r' =
flag.
 # dteske   2010.11.02   Map `-R dir' to `-j jail' if `dir' maps to a =
single
@@ -461,6 +462,7 @@
 	( found=3D
 	  IFS=3D
 	  while read -r LINE; do
+		# If already found, just spew...
 	  	if [ "$found" ]; then
 			echo "$LINE"
 			continue
@@ -491,8 +493,16 @@
 			# Use quotes if replacing with multi-word value
 			[ "${new_value%[$__IFS]*}" !=3D "$new_value" ] \
 				&& new_value=3D'"'"$new_value"'"'
+		elif echo "$LINE" | grep -Eq "$regex"; then
+			# found null-assignment
+			found=3D1
+			regex=3D"$regex()()()"
+
+			# Always use quotes
+			new_value=3D'"'"$new_value"'"'
 		fi
=20
+		# Do the deed...
 		[ "$found" ] && LINE=3D"$( echo "$LINE" \
 			| sed -re "s/$regex/\1\2$new_value\4/" )"
=20


--
Cheers,
Devin Teske

-> CONTACT INFORMATION <-
Business Solutions Consultant II
FIS - fisglobal.com
510-735-5650 Mobile
510-621-2038 Office
510-621-2020 Office Fax
909-477-4578 Home/Fax
devin.teske@fisglobal.com

-> LEGAL DISCLAIMER <-
This message  contains confidential  and proprietary  information
of the sender,  and is intended only for the person(s) to whom it
is addressed. Any use, distribution, copying or disclosure by any
other person  is strictly prohibited.  If you have  received this
message in error,  please notify  the e-mail sender  immediately,
and delete the original message without making a copy.

-> FUN STUFF <-
-----BEGIN GEEK CODE BLOCK-----
Version 3.1
GAT/CS d(+) s: a- C++(++++) UB++++$ P++(++++) L++(++++) !E--- W++ N? o? =
K- w O
M+ V- PS+ PE Y+ PGP- t(+) 5? X+(++) R>++ tv(+) b+(++) DI+(++) D(+) G+>++ =
e>+ h
r>++ y+=20
------END GEEK CODE BLOCK------
http://www.geekcode.com/

-> END TRANSMISSION <-




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?17B64023-A64A-40DA-9CBC-A601710AB5BB>