sysrc(8) -- a sysctl(8)-like utility for managing rc.conf(5)
Devin Teske
dteske at vicor.com
Wed Nov 3 03:48:05 UTC 2010
On Nov 2, 2010, at 6:06 PM, Devin Teske wrote:
> On Wed, 2010-10-20 at 23:46 -0700, Devin Teske wrote:
>> On Oct 19, 2010, at 10:50 AM, Devin Teske wrote:
>>
>>> On Mon, 2010-10-18 at 17:39 -0700, Devin Teske wrote:
>>>> On Wed, 2010-10-13 at 12:05 -0700, Devin Teske wrote:
>>>>> On Tue, 2010-10-12 at 16:13 -0700, Devin Teske wrote:
>>>>>> Hey all,
>>>>>>
>>>>>> [...]
>>>>>>
>>>>>> Behold... sysrc(8) v2.0
>>>>>>
>>>>>> #!/bin/sh
>>>>>> [...]
>>>>>
>>>>> Version 2.1 is available here: http://druidbsd.sf.net/
>>>>
>>>> Version 2.2 now.
>>>> Same links.
>>>>
>>>> I added `-R dir' for specifying an alternate root (other than `/')
>>>> directory (mostly for handling jails).
>>>
>>> Version 2.3 now.
>>> Same links.
>>>
>>
>> Version 2.4 now.
>> Same links.
>>
>
> Version 2.5 now.
> Same links.
>
> That should be all the features that were requested (and some that
> weren't).
Minor fix ^_^
Version 2.5.1 now.
>
>>>
>>>>
>>>>>
>>>>> Direct links:
>>>>> http://druidbsd.sf.net/download/sysrc.gz (download gzipped)
>>>>> http://druidbsd.sf.net/download/sysrc.txt (view as text)
>>>>>
>>>>> Here's the changes:
>>>>>
>>>>
>>>
>
>
--- 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=4 :: 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=
IFS=
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]*}" != "$new_value" ] \
&& new_value='"'"$new_value"'"'
+ elif echo "$LINE" | grep -Eq "$regex"; then
+ # found null-assignment
+ found=1
+ regex="$regex()()()"
+
+ # Always use quotes
+ new_value='"'"$new_value"'"'
fi
+ # Do the deed...
[ "$found" ] && LINE="$( echo "$LINE" \
| sed -re "s/$regex/\1\2$new_value\4/" )"
--
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 at 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+
------END GEEK CODE BLOCK------
http://www.geekcode.com/
-> END TRANSMISSION <-
More information about the freebsd-rc
mailing list