-rwxr-xr-x | scripts/mkipkg | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/scripts/mkipkg b/scripts/mkipkg index 43bd3a3..a336371 100755 --- a/scripts/mkipkg +++ b/scripts/mkipkg | |||
@@ -158,93 +158,93 @@ setVar() | |||
158 | { | 158 | { |
159 | eval "$1='$2'" | 159 | eval "$1='$2'" |
160 | } | 160 | } |
161 | 161 | ||
162 | expandMaskToList() | 162 | expandMaskToList() |
163 | { | 163 | { |
164 | local _list=`echo $1` | 164 | local _list=`echo $1` |
165 | local _tmpFileList= | 165 | local _tmpFileList= |
166 | for f in $_list; do | 166 | for f in $_list; do |
167 | if [ -d $f ]; then | 167 | if [ -d $f ]; then |
168 | f="`findFile $f`" | 168 | f="`findFile $f`" |
169 | fi | 169 | fi |
170 | _tmpFileList="`eval echo $f` $_tmpFileList" | 170 | _tmpFileList="`eval echo $f` $_tmpFileList" |
171 | done | 171 | done |
172 | setVar $2 "$_tmpFileList" | 172 | setVar $2 "$_tmpFileList" |
173 | } | 173 | } |
174 | 174 | ||
175 | createFileList() | 175 | createFileList() |
176 | { | 176 | { |
177 | local excludeMask | 177 | local excludeMask |
178 | local includeMask | 178 | local includeMask |
179 | local includemaskpresent=0 | 179 | local includemaskpresent=0 |
180 | local excludemaskpresent=0 | 180 | local excludemaskpresent=0 |
181 | 181 | ||
182 | if (cat $1|grep -q ^FileExcludeMask); then | 182 | if (grep -q ^FileExcludeMask $1); then |
183 | excludemaskpresent=1 | 183 | excludemaskpresent=1 |
184 | excludeMask=$(eval echo '"'$(sed -n -e "s,^FileExcludeMask: *,,p" $1)'"') | 184 | excludeMask=$(eval echo '"'$(sed -n -e "s,^FileExcludeMask: *,,p" $1)'"') |
185 | fi | 185 | fi |
186 | if (cat $1|grep -q ^FileIncludeMask); then | 186 | if (grep -q ^FileIncludeMask $1); then |
187 | includemaskpresent=1 | 187 | includemaskpresent=1 |
188 | includeMask=$(eval echo '"'$(sed -n -e "s,^FileIncludeMask: *,,p" $1)'"') | 188 | includeMask=$(eval echo '"'$(sed -n -e "s,^FileIncludeMask: *,,p" $1)'"') |
189 | else | 189 | else |
190 | if (cat $1|grep -q ^Files:); then | 190 | if (grep -q ^Files: $1); then |
191 | includemaskpresent=1 | 191 | includemaskpresent=1 |
192 | includeMask=$(eval echo '"'$(sed -n -e "s,^Files: *,,p" $1)'"') | 192 | includeMask=$(eval echo '"'$(sed -n -e "s,^Files: *,,p" $1)'"') |
193 | fi | 193 | fi |
194 | fi | 194 | fi |
195 | 195 | ||
196 | _pushd $destdir | 196 | _pushd $destdir |
197 | 197 | ||
198 | excludeMask="$excludeMask CONTROL/* usr/share/*" | 198 | declare -a excludeMaskArray |
199 | excludeMaskArray=( $excludeMask ) | ||
200 | excludeMaskArray=( "${excludeMaskArray[@]}" "CONTROL/*" "usr/share/*" ) | ||
199 | 201 | ||
200 | if [ $includemaskpresent != 1 ]; then | 202 | if [ $includemaskpresent != 1 ]; then |
201 | includeMask="." | 203 | includeMask="." |
202 | fi | 204 | fi |
203 | 205 | ||
204 | if [ -z "$includeMask" ]; then | 206 | if [ -z "$includeMask" ]; then |
205 | setVar $2 "" | 207 | setVar $2 "" |
206 | _popd | 208 | _popd |
207 | return 0 | 209 | return 0 |
208 | fi | 210 | fi |
209 | 211 | ||
210 | expandMaskToList "$includeMask" _fileList | 212 | expandMaskToList "$includeMask" _fileList |
211 | 213 | ||
212 | _excludeList= | 214 | excludeMaskArray=( "${excludeMaskArray[@]}" "*/CVS*" "*/SCCS*" ) |
213 | if [ -n "$excludeMask" ]; then | ||
214 | expandMaskToList "$excludeMask" _excludeList | ||
215 | _excludeList="$_excludeList `find -name \*CVS\* -o -name \*SCCS\*`" | ||
216 | fi | ||
217 | 215 | ||
218 | local realFileList= | 216 | local realFileList= |
219 | local missing=0 | 217 | local missing=0 |
220 | for file in $_fileList; do | 218 | for file in $_fileList; do |
221 | local containedInList=0 | 219 | local containedInList=0 |
222 | for i in $_excludeList; do | 220 | for i in "${excludeMaskArray[@]}"; do |
223 | if [ $file = $i ]; then | 221 | if [[ $file == $i ]]; then |
224 | containedInList=1 | 222 | containedInList=1 |
223 | break; | ||
225 | fi | 224 | fi |
226 | done | 225 | done |
226 | |||
227 | if [ $containedInList = 0 ]; then | 227 | if [ $containedInList = 0 ]; then |
228 | if ! [ -e $file -o -L $file ]; then | 228 | if ! [ -e $file -o -L $file ]; then |
229 | echo "$self: $file not found" | 229 | echo "$self: $file not found" |
230 | missing=1 | 230 | missing=1 |
231 | fi | 231 | fi |
232 | realFileList=$file" $realFileList" | 232 | realFileList=$file" $realFileList" |
233 | fi | 233 | fi |
234 | done | 234 | done |
235 | 235 | ||
236 | _popd | 236 | _popd |
237 | 237 | ||
238 | if [ $missing = 1 ]; then | 238 | if [ $missing = 1 ]; then |
239 | return 1 | 239 | return 1 |
240 | fi | 240 | fi |
241 | 241 | ||
242 | setVar $2 "$realFileList" | 242 | setVar $2 "$realFileList" |
243 | } | 243 | } |
244 | 244 | ||
245 | stripFile() | 245 | stripFile() |
246 | { | 246 | { |
247 | if [ -f $1 -a -x $1 ]; then | 247 | if [ -f $1 -a -x $1 ]; then |
248 | $strip --strip-all $1 | 248 | $strip --strip-all $1 |
249 | fi | 249 | fi |
250 | } | 250 | } |