File: intro-5.html

package info (click to toggle)
linuxconf 1.26r4-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 56,432 kB
  • ctags: 27,217
  • sloc: cpp: 158,803; perl: 7,484; sh: 4,134; java: 3,105; ansic: 2,492; makefile: 2,216; python: 109
file content (66 lines) | stat: -rw-r--r-- 2,237 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
 <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
 <TITLE>shellmod: Using the virtual registry</TITLE>
 <LINK HREF="intro-6.html" REL=next>
 <LINK HREF="intro-4.html" REL=previous>
 <LINK HREF="intro.html#toc5" REL=contents>
</HEAD>
<BODY>
<A HREF="intro-6.html">Next</A>
<A HREF="intro-4.html">Previous</A>
<A HREF="intro.html#toc5">Contents</A>
<HR>
<H2><A NAME="s5">5. Using the virtual registry</A></H2>

<P>The virtual registry is a general interface to get and set
value from various modules in Linuxconf. You can learn more
about it by reading the "manual" page for the vregistry
module.
<P>We describe here how to use it from a shellmod script.
<P>
<H2><A NAME="ss5.1">5.1 vreg_set registry_variable_name value</A>
</H2>

<P>You can set any variable by issuing the vreg_set command.
The variable name is one registry variable. You can learn the
about the available variable by running <CODE>/sbin/vregistry --list</CODE>.
<P>You generally issue several vreg_set statements and then you
call the vreg_do function to commit the request. The various
modules are updated at this time only.
<P>
<P>
<H2><A NAME="ss5.2">5.2 vreg_get registry_variable_name shell-variable</A>
</H2>

<P>This will collect the value of the registry variable into
a local variable of the shell named shell-variable.
<P>You generally issue several vreg_get statements and then you
call the vreg_do function to commit the request. After having
called vreg_do, your shell variables are properly assigned.
<P>
<BLOCKQUOTE><CODE>
<PRE>
        qecho vreg_get samba.workgroup workgroup
        qecho vreg_get samba.winsserver wins
        # At this point, neither workgroup or wins are assigned
        vreg_do
        qecho notice "Your workgroup is $workgroup, wins server, $wins"
        
</PRE>
</CODE></BLOCKQUOTE>
<P>
<H2><A NAME="ss5.3">5.3 vreg_do</A>
</H2>

<P>vreg_do is a shell function. so you use it directly unlike most
other shellmod command which are "echoed". vreg_do acts like
the dispatch command. It requests action and grab the results.
<P>
<HR>
<A HREF="intro-6.html">Next</A>
<A HREF="intro-4.html">Previous</A>
<A HREF="intro.html#toc5">Contents</A>
</BODY>
</HTML>