Simplified creation of the MIME DB. We create it in a directory first
and then copy it in one go instead of copying individual files. Also use a single temp file instead of one for every entry. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24968 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -141,44 +141,42 @@ if [ ! $updateOnly ]; then
|
|||||||
$mkdir -p $mimeDBDest
|
$mkdir -p $mimeDBDest
|
||||||
mkdir -p $tmpDir
|
mkdir -p $tmpDir
|
||||||
mimeTmpDir=$tmpDir/mime
|
mimeTmpDir=$tmpDir/mime
|
||||||
|
mimeDBTmpDir=$tmpDir/mime/db
|
||||||
mimeTmpIndex=0
|
mimeTmpIndex=0
|
||||||
|
mimeTmpFile=$mimeTmpDir/mimedb$$.rsrc
|
||||||
|
|
||||||
# create tmp dir for the MIME conversion stuff
|
# create tmp dir for the MIME conversion stuff
|
||||||
mkdir -p $mimeTmpDir
|
mkdir -p $mimeDBTmpDir
|
||||||
|
|
||||||
echo "Installing MIME database ..."
|
echo "Installing MIME database ..."
|
||||||
|
|
||||||
for inSuperFile in $mimeDBSource/*.super; do
|
for inSuperFile in $mimeDBSource/*.super; do
|
||||||
superType=$(basename $inSuperFile .super)
|
superType=$(basename $inSuperFile .super)
|
||||||
outSuperDir=$mimeDBDest/$superType
|
tmpSuperDir=$mimeDBTmpDir/$superType
|
||||||
|
|
||||||
# compile rdef to rsrc file and the rsrc file to attributes
|
# compile rdef to rsrc file and the rsrc file to attributes
|
||||||
mimeTmpIndex=$(($mimeTmpIndex + 1))
|
$rc -o $mimeTmpFile $inSuperFile
|
||||||
tmpFile=$mimeTmpDir/mimedb$$_${mimeTmpIndex}.rsrc
|
mkdir -p $tmpSuperDir
|
||||||
tmpFile2=$mimeTmpDir/mimedb$$_${mimeTmpIndex}.mime
|
$resattr -O -o $tmpSuperDir $mimeTmpFile
|
||||||
$rc -o $tmpFile $inSuperFile
|
$rmAttrs $mimeTmpFile
|
||||||
mkdir -p $tmpFile2
|
|
||||||
$resattr -O -o $tmpFile2 $tmpFile
|
|
||||||
$cp -r ${sPrefix}$tmpFile2 $outSuperDir
|
|
||||||
|
|
||||||
# iterate through the sub types
|
# iterate through the sub types
|
||||||
for inSubFile in $mimeDBSource/$superType/*; do
|
for inSubFile in $mimeDBSource/$superType/*; do
|
||||||
# check, if the type exists
|
# check, if the type exists
|
||||||
if test -f $inSubFile && grep META:TYPE $inSubFile > /dev/null 2>&1 ; then
|
if test -f $inSubFile && grep META:TYPE $inSubFile > /dev/null 2>&1 ; then
|
||||||
subType=$(basename $inSubFile)
|
subType=$(basename $inSubFile)
|
||||||
outSubFile=$outSuperDir/$subType
|
tmpSubFile=$mimeDBTmpDir/$superType/$subType
|
||||||
|
|
||||||
# compile rdef to rsrc file and the rsrc file to attributes
|
# compile rdef to rsrc file and the rsrc file to attributes
|
||||||
mimeTmpIndex=$(($mimeTmpIndex + 1))
|
$rc -o $mimeTmpFile $inSubFile
|
||||||
tmpFile=$mimeTmpDir/mimedb$$_${mimeTmpIndex}.rsrc
|
$resattr -O -o $tmpSubFile $mimeTmpFile
|
||||||
tmpFile2=$mimeTmpDir/mimedb$$_${mimeTmpIndex}.mime
|
$rmAttrs $mimeTmpFile
|
||||||
$rc -o $tmpFile $inSubFile
|
|
||||||
$resattr -O -o $tmpFile2 $tmpFile
|
|
||||||
$cp ${sPrefix}$tmpFile2 $outSubFile
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
|
$cp -r ${sPrefix}$mimeDBTmpDir/. $mimeDBDest
|
||||||
|
|
||||||
# cleanup tmp dir
|
# cleanup tmp dir
|
||||||
$rmAttrs -rf $mimeTmpDir
|
$rmAttrs -rf $mimeTmpDir
|
||||||
fi # ! updateOnly
|
fi # ! updateOnly
|
||||||
|
|||||||
Reference in New Issue
Block a user