summaryrefslogtreecommitdiff
path: root/scripts/mkipkg
Unidiff
Diffstat (limited to 'scripts/mkipkg') (more/less context) (ignore whitespace changes)
-rwxr-xr-xscripts/mkipkg10
1 files changed, 7 insertions, 3 deletions
diff --git a/scripts/mkipkg b/scripts/mkipkg
index a336371..2f020f4 100755
--- a/scripts/mkipkg
+++ b/scripts/mkipkg
@@ -199,129 +199,133 @@ createFileList()
199 excludeMaskArray=( $excludeMask ) 199 excludeMaskArray=( $excludeMask )
200 excludeMaskArray=( "${excludeMaskArray[@]}" "CONTROL/*" "usr/share/*" ) 200 excludeMaskArray=( "${excludeMaskArray[@]}" "CONTROL/*" "usr/share/*" )
201 201
202 if [ $includemaskpresent != 1 ]; then 202 if [ $includemaskpresent != 1 ]; then
203 includeMask="." 203 includeMask="."
204 fi 204 fi
205 205
206 if [ -z "$includeMask" ]; then 206 if [ -z "$includeMask" ]; then
207 setVar $2 "" 207 setVar $2 ""
208 _popd 208 _popd
209 return 0 209 return 0
210 fi 210 fi
211 211
212 expandMaskToList "$includeMask" _fileList 212 expandMaskToList "$includeMask" _fileList
213 213
214 excludeMaskArray=( "${excludeMaskArray[@]}" "*/CVS*" "*/SCCS*" ) 214 excludeMaskArray=( "${excludeMaskArray[@]}" "*/CVS*" "*/SCCS*" )
215 215
216 local realFileList= 216 local realFileList=
217 local missing=0 217 local missing=0
218 for file in $_fileList; do 218 for file in $_fileList; do
219 local containedInList=0 219 local containedInList=0
220 for i in "${excludeMaskArray[@]}"; do 220 for i in "${excludeMaskArray[@]}"; do
221 if [[ $file == $i ]]; then 221 if [[ $file == $i ]]; then
222 containedInList=1 222 containedInList=1
223 break; 223 break;
224 fi 224 fi
225 done 225 done
226 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
245stripFile() 245stripFile()
246{ 246{
247 if [ -f $1 -a -x $1 ]; then 247 if [ ! -h $1 -a -f $1 -a -x $1 ]; then
248 $strip --strip-all $1 248 $strip -p --strip-all $1
249 fi 249 fi
250} 250}
251 251
252substFile() 252substFile()
253{ 253{
254 local oldfile=$1 254 local oldfile=$1
255 255
256 if [ ! -e $2 ]; then return 1; fi 256 if [ ! -e $2 ]; then return 1; fi
257 257
258 if [ -e $oldfile -o -L $oldfile ]; then 258 if [ -e $oldfile -o -L $oldfile ]; then
259 newfile=`echo $oldfile|sed -f $2|sed -e's,^/,,g'` 259 newfile=`echo $oldfile|sed -f $2|sed -e's,^/,,g'`
260 olddir=`dirname $oldfile` 260 olddir=`dirname $oldfile`
261 base=`basename $oldfile` 261 base=`basename $oldfile`
262 newdir=`dirname $newfile` 262 newdir=`dirname $newfile`
263 263
264# echo >&2 moving $oldfile to $newfile 264# echo >&2 moving $oldfile to $newfile
265 265
266 if [ "$newdir" = "$olddir" ]; then 266 if [ "$newdir" = "$olddir" ]; then
267 return 0 267 return 0
268 fi 268 fi
269 269
270 mkdir -p $newdir 270 mkdir -p $newdir
271 mv $olddir/$base $newfile 271 mv $olddir/$base $newfile
272 rmdir -p $olddir 2>/dev/null 272 rmdir -p $olddir 2>/dev/null
273 fi 273 fi
274} 274}
275 275
276stripFiles() 276stripFiles()
277{ 277{
278 for f in $1; do 278 for f in $1; do
279 stripFile ./$f 279 # do not strip links
280 if [ ! -h ./$f ]
281 then
282 stripFile ./$f
283 fi
280 done 284 done
281} 285}
282 286
283substFiles() 287substFiles()
284{ 288{
285 for f in $1; do 289 for f in $1; do
286 substFile ./$f 290 substFile ./$f
287 done 291 done
288} 292}
289 293
290substAndStripFiles() 294substAndStripFiles()
291{ 295{
292 for f in $1; do 296 for f in $1; do
293 stripFile ./$f 297 stripFile ./$f
294 substFile ./$f $2 298 substFile ./$f $2
295 done 299 done
296} 300}
297 301
298installScript() 302installScript()
299{ 303{
300 if [ -n "$1" -a -f "$1" ]; then 304 if [ -n "$1" -a -f "$1" ]; then
301 destfile=`basename $1` 305 destfile=`basename $1`
302 filetype=`echo $destfile|cut -d. -f2` 306 filetype=`echo $destfile|cut -d. -f2`
303 if [ -n "$filetype" ]; then destfile=$filetype; fi 307 if [ -n "$filetype" ]; then destfile=$filetype; fi
304 if [ -n "$subst" ]; then 308 if [ -n "$subst" ]; then
305 sed -f $subst < $1 > $ctrldir/$destfile 309 sed -f $subst < $1 > $ctrldir/$destfile
306 else 310 else
307 cat $1 > $ctrldir/$destfile 311 cat $1 > $ctrldir/$destfile
308 fi 312 fi
309 chmod +x $ctrldir/$destfile 313 chmod +x $ctrldir/$destfile
310 fi 314 fi
311} 315}
312 316
313tempDir=/tmp/`basename $self`.$$ 317tempDir=/tmp/`basename $self`.$$
314mkdir -p $tempDir 318mkdir -p $tempDir
315if [ $? != 0 ]; then 319if [ $? != 0 ]; then
316 echo "$self: cannot create $tempDir, exiting..." 320 echo "$self: cannot create $tempDir, exiting..."
317 rm -rf $tempDir 321 rm -rf $tempDir
318 exit 1 322 exit 1
319fi 323fi
320 324
321ctrldir=$tempDir/CONTROL 325ctrldir=$tempDir/CONTROL
322 326
323mkdir -p $ctrldir 327mkdir -p $ctrldir
324 328
325if [ ! -e $subst ] || [ -z "$subst" ]; then 329if [ ! -e $subst ] || [ -z "$subst" ]; then
326 cat $control > $ctrldir/control.new 330 cat $control > $ctrldir/control.new
327else 331else