source: release-kits/lirk3/bin/ant-installer/web/manual1.7.0/manual/CoreTasks/chmod.html@ 14982

Last change on this file since 14982 was 14982, checked in by oranfry, 16 years ago

initial import of LiRK3

File size: 7.2 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>Chmod Task</title>
23</head>
24
25<body>
26
27<h2><a name="chmod">Chmod</a></h2>
28<h3>Description</h3>
29<p>Changes the permissions of a file or all files inside specified
30directories. Right now it has effect only under Unix or NonStop Kernel (Tandem).
31The permissions are also UNIX style, like the argument for the chmod command.</p>
32<p>See the section on <a href="../dirtasks.html#directorybasedtasks">directory based
33tasks</a>, on how the inclusion/exclusion of files works, and how to
34write patterns.</p>
35
36<p>This task holds an implicit <a
37href="../CoreTypes/fileset.html">FileSet</a> and supports all of
38FileSet's attributes and nested elements directly. More sets can be
39specified using nested <code>&lt;fileset&gt;</code> or
40<code>&lt;dirset&gt;</code> (<em>since Ant 1.6</em>) elements. </p>
41
42<p>Starting with Ant 1.6, this task also supports nested <a
43href="../CoreTypes/filelist.html">filelist</a>s.</p>
44
45<p>Starting with Ant 1.7, this task supports arbitrary <a
46href="../CoreTypes/resources.html#collection">Resource Collection</a>s
47as nested elements.</p>
48
49<p>By default this task will use a single invocation of the underlying
50chmod command. If you are working on a large number of files this may
51result in a command line that is too long for your operating system.
52If you encounter such problems, you should set the maxparallel
53attribute of this task to a non-zero value. The number to use highly
54depends on the length of your file names (the depth of your directory
55tree) and your operating system, so you'll have to experiment a
56little. POSIX recommends command line length limits of at least 4096
57characters, this may give you an approximation for the number you
58could use as initial value for these experiments.</p>
59
60<h3>Parameters</h3>
61<table border="1" cellpadding="2" cellspacing="0">
62 <tr>
63 <td valign="top"><b>Attribute</b></td>
64 <td valign="top"><b>Description</b></td>
65 <td align="center" valign="top"><b>Required</b></td>
66 </tr>
67 <tr>
68 <td valign="top">file</td>
69 <td valign="top">the file or single directory of which the permissions
70 must be changed.</td>
71 <td valign="top" valign="middle" rowspan="2">exactly one of the two or nested <code>&lt;fileset/list&gt;</code> elements.</td>
72 </tr>
73 <tr>
74 <td valign="top">dir</td>
75 <td valign="top">the directory which holds the files whose permissions
76 must be changed.</td>
77 </tr>
78 <tr>
79 <td valign="top">perm</td>
80 <td valign="top">the new permissions.</td>
81 <td valign="top" align="center">Yes</td>
82 </tr>
83 <tr>
84 <td valign="top">includes</td>
85 <td valign="top">comma- or space-separated list of patterns of files that must be
86 included.</td>
87 <td valign="top" align="center">No</td>
88 </tr>
89 <tr>
90 <td valign="top">excludes</td>
91 <td valign="top">comma- or space-separated list of patterns of files that must be
92 excluded. No files (except default excludes) are excluded when omitted.</td>
93 <td valign="top" align="center">No</td>
94 </tr>
95 <tr>
96 <td valign="top">defaultexcludes</td>
97 <td valign="top">indicates whether default excludes should be used or not
98 (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
99 <td valign="top" align="center">No</td>
100 </tr>
101 <tr>
102 <td valign="top">parallel</td>
103 <td valign="top">process all specified files using a single
104 <code>chmod</code> command. Defaults to true.</td>
105 <td valign="top" align="center">No</td>
106 </tr>
107 <tr>
108 <td valign="top">type</td>
109 <td valign="top">One of <i>file</i>, <i>dir</i> or
110 <i>both</i>. If set to <i>file</i>, only the permissions of
111 plain files are going to be changed. If set to <i>dir</i>, only
112 the directories are considered.<br>
113 <strong>Note:</strong> The type attribute does not apply to
114 nested <i>dirset</i>s - <i>dirset</i>s always implicitly
115 assume type to be <i>dir</i>.</td>
116 <td align="center" valign="top">No, default is <i>file</i></td>
117 </tr>
118 <tr>
119 <td valign="top">maxparallel</td>
120 <td valign="top">Limit the amount of parallelism by passing at
121 most this many sourcefiles at once. Set it to &lt;= 0 for
122 unlimited. Defaults to unlimited. <em>Since Ant 1.6.</em></td>
123 <td align="center" valign="top">No</td>
124 </tr>
125 <tr>
126 <td valign="top">verbose</td>
127 <td valign="top">Whether to print a summary after execution or not.
128 Defaults to <code>false</code>. <em>Since Ant 1.6.</em></td>
129 <td align="center" valign="top">No</td>
130 </tr>
131</table>
132<h3>Examples</h3>
133 <blockquote><pre>
134&lt;chmod file=&quot;${dist}/start.sh&quot; perm=&quot;ugo+rx&quot;/&gt;
135</pre></blockquote>
136<p>makes the &quot;start.sh&quot; file readable and executable for anyone on a
137UNIX system.</p>
138<blockquote><pre>
139&lt;chmod file=&quot;${dist}/start.sh&quot; perm=&quot;700&quot;/&gt;
140</pre></blockquote>
141<p>makes the &quot;start.sh&quot; file readable, writable and executable only for the owner on a
142UNIX system.</p>
143<blockquote>
144<pre>
145&lt;chmod dir=&quot;${dist}/bin&quot; perm=&quot;ugo+rx&quot;
146 includes=&quot;**/*.sh&quot;/&gt;
147</pre>
148</blockquote>
149<p>makes all &quot;.sh&quot; files below <code>${dist}/bin</code>
150readable and executable for anyone on a UNIX system.</p>
151<blockquote>
152<pre>
153&lt;chmod perm=&quot;g+w&quot;&gt;
154 &lt;fileset dir=&quot;shared/sources1&quot;&gt;
155 &lt;exclude name=&quot;**/trial/**&quot;/&gt;
156 &lt;/fileset&gt;
157 &lt;fileset refid=&quot;other.shared.sources&quot;/&gt;
158&lt;/chmod&gt;
159</pre>
160</blockquote>
161<p>makes all files below <code>shared/sources1</code> (except those
162below any directory named trial) writable for members of the same
163group on a UNIX system. In addition all files belonging to a FileSet
164with <code>id</code> <code>other.shared.sources</code> get the same
165permissions.</p>
166
167<blockquote>
168<pre>
169&lt;chmod perm=&quot;go-rwx&quot; type=&quot;file&quot;&gt;
170 &lt;fileset dir=&quot;/web&quot;&gt;
171 &lt;include name=&quot;**/*.cgi&quot;/&gt;
172 &lt;include name=&quot;**/*.old&quot;/&gt;
173 &lt;/fileset&gt;
174 &lt;dirset dir=&quot;/web&quot;&gt;
175 &lt;include name=&quot;**/private_*&quot;/&gt;
176 &lt;/dirset&gt;
177&lt;/chmod&gt;
178</pre>
179</blockquote>
180
181<p>keeps non-owners from touching cgi scripts, files with a <code>.old</code>
182extension or directories beginning with <code>private_</code>. A directory
183ending in <code>.old</code> or a file beginning with private_ would remain
184unaffected.</p>
185
186
187
188</body>
189</html>
190
Note: See TracBrowser for help on using the repository browser.