source: other-projects/trunk/realistic-books/packages/AntInstaller/web/manual1.7.0/manual/OptionalTasks/chown.html@ 19253

Last change on this file since 19253 was 19253, checked in by davidb, 15 years ago

Establishing a source code repository for Veronica's Realistic Book's software

File size: 5.6 KB
Line 
1<!--
2 Licensed to the Apache Software Foundation (ASF) under one or more
3 contributor license agreements. See the NOTICE file distributed with
4 this work for additional information regarding copyright ownership.
5 The ASF licenses this file to You under the Apache License, Version 2.0
6 (the "License"); you may not use this file except in compliance with
7 the License. You may obtain a copy of the License at
8
9 http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16-->
17<html>
18
19<head>
20<meta http-equiv="Content-Language" content="en-us">
21<link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
22<title>Chown Task</title>
23</head>
24
25<body>
26
27<h2><a name="Chown">Chown</a></h2>
28<p><em>Since Ant 1.6.</em></p>
29<h3>Description</h3>
30
31<p>Changes the owner of a file or all files inside specified
32directories. Right now it has effect only under Unix. The owner
33attribute is equivalent to the corresponding argument for the chown
34command.</p>
35
36<p><a href="../CoreTypes/fileset.html">FileSet</a>s,
37<a href="../CoreTypes/dirset.html">DirSet</a>s or <a
38href="../CoreTypes/filelist.html">FileList</a>s can be specified using
39nested <code>&lt;fileset&gt;</code>, <code>&lt;dirset&gt;</code> and
40<code>&lt;filelist&gt;</code> elements.</p>
41
42<p>Starting with Ant 1.7, this task supports arbitrary <a
43href="../CoreTypes/resources.html#collection">Resource Collection</a>s
44as nested elements.</p>
45
46<p>By default this task will use a single invocation of the underlying
47chown command. If you are working on a large number of files this may
48result in a command line that is too long for your operating system.
49If you encounter such problems, you should set the maxparallel
50attribute of this task to a non-zero value. The number to use highly
51depends on the length of your file names (the depth of your directory
52tree) and your operating system, so you'll have to experiment a
53little. POSIX recommends command line length limits of at least 4096
54characters, this may give you an approximation for the number you
55could use as initial value for these experiments.</p>
56
57<h3>Parameters</h3>
58<table border="1" cellpadding="2" cellspacing="0">
59 <tr>
60 <td valign="top"><b>Attribute</b></td>
61 <td valign="top"><b>Description</b></td>
62 <td align="center" valign="top"><b>Required</b></td>
63 </tr>
64 <tr>
65 <td valign="top">file</td>
66 <td valign="top">the file or directory of which the owner must be
67 changed.</td>
68 <td valign="top" valign="middle">Yes or nested
69 <code>&lt;fileset/list&gt;</code> elements.</td>
70 </tr>
71 <tr>
72 <td valign="top">owner</td>
73 <td valign="top">the new owner.</td>
74 <td valign="top" align="center">Yes</td>
75 </tr>
76 <tr>
77 <td valign="top">parallel</td>
78 <td valign="top">process all specified files using a single
79 <code>chown</code> command. Defaults to true.</td>
80 <td valign="top" align="center">No</td>
81 </tr>
82 <tr>
83 <td valign="top">type</td>
84 <td valign="top">One of <i>file</i>, <i>dir</i> or
85 <i>both</i>. If set to <i>file</i>, only the owner of
86 plain files are going to be changed. If set to <i>dir</i>, only
87 the directories are considered.<br>
88 <strong>Note:</strong> The type attribute does not apply to
89 nested <i>dirset</i>s - <i>dirset</i>s always implicitly
90 assume type to be <i>dir</i>.</td>
91 <td align="center" valign="top">No, default is <i>file</i></td>
92 </tr>
93 <tr>
94 <td valign="top">maxparallel</td>
95 <td valign="top">Limit the amount of parallelism by passing at
96 most this many sourcefiles at once. Set it to &lt;= 0 for
97 unlimited. Defaults to unlimited.</td>
98 <td align="center" valign="top">No</td>
99
100 </tr>
101 <tr>
102 <td valign="top">verbose</td>
103 <td valign="top">Whether to print a summary after execution or not.
104 Defaults to <code>false</code>.</td>
105 <td align="center" valign="top">No</td>
106 </tr>
107
108</table>
109<h3>Examples</h3>
110<blockquote><pre>
111&lt;chown file="${dist}/start.sh" owner="coderjoe"/&gt;
112</pre>
113</blockquote>
114<p>makes the "start.sh" file belong to coderjoe on a
115UNIX system.</p>
116<blockquote>
117<pre>
118 &lt;chown owner="coderjoe"&gt;
119 &lt;fileset dir="${dist}/bin" includes="**/*.sh"/&gt;
120 &lt;/chown&gt;
121</pre>
122</blockquote>
123<p>makes all ".sh" files below <code>${dist}/bin</code>
124belong to coderjoe on a UNIX system.</p>
125<blockquote>
126<pre>
127&lt;chown owner="coderjoe"&gt;
128 &lt;fileset dir="shared/sources1"&gt;
129 &lt;exclude name="**/trial/**"/&gt;
130 &lt;/fileset&gt;
131 &lt;fileset refid="other.shared.sources"/&gt;
132&lt;/chown&gt;
133</pre>
134</blockquote>
135<p>makes all files below <code>shared/sources1</code> (except those
136below any directory named trial) belong to coderjoe on a UNIX
137system. In addition all files belonging to a FileSet
138with <code>id</code> <code>other.shared.sources</code> get the same
139owner.</p>
140
141<blockquote>
142<pre>
143&lt;chown owner="webadmin" type="file"&gt;
144 &lt;fileset dir="/web"&gt;
145 &lt;include name="**/*.cgi"/&gt;
146 &lt;include name="**/*.old"/&gt;
147 &lt;/fileset&gt;
148 &lt;dirset dir="/web"&gt;
149 &lt;include name="**/private_*"/&gt;
150 &lt;/dirset&gt;
151&lt;/chmod&gt;
152</pre>
153</blockquote>
154
155<p>makes cgi scripts, files with a <code>.old</code> extension or
156directories beginning with <code>private_</code> belong to the user named
157webadmin. A directory ending in <code>.old</code> or a file beginning with
158<code>private_</code> would remain unaffected.</p>
159
160
161
162</body>
163</html>
164
Note: See TracBrowser for help on using the repository browser.