From 74de61fda587817fd00c5d3d77f6ec0d440f0fca Mon Sep 17 00:00:00 2001 From: Matt Madia Date: Thu, 18 Mar 2010 17:14:19 +0000 Subject: [PATCH] Implemented support for AddExpanderRuleToHaikuImage. Now P7zip and XZ-Utils can be installed properly. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35906 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- data/bin/installoptionalpackage | 54 ++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/data/bin/installoptionalpackage b/data/bin/installoptionalpackage index 646713714c..409e46cb3e 100755 --- a/data/bin/installoptionalpackage +++ b/data/bin/installoptionalpackage @@ -30,7 +30,7 @@ declare availablePackagesKeys="" # Some Packages cannot be installed, # as they require either the source code or compiled binaries declare packageIgnoreList='Bluetooth Development DevelopmentMin \ -DevelopmentBase P7zip UserlandFS Welcome Wifi-ipw2100+fw Wifi-iprowifi2200+fw \ +DevelopmentBase UserlandFS Welcome Wifi-ipw2100+fw Wifi-iprowifi2200+fw \ WifiFirmwareScriptData' @@ -52,6 +52,10 @@ $urlLine $sslPkgLine $sslUrlLine declare -a functionArgs +expanderRulesFile=`finddir B_COMMON_DATA_DIRECTORY`/expander.rules +if [ -f \${expanderRulesFile} ] ; then + expanderRulesFileExists=1 +fi function ParseFunctionArguments() @@ -233,6 +237,49 @@ function AddUserToHaikuImage() } +function AddExpanderRuleToHaikuImage() +{ + # AddExpanderRuleToHaikuImage : : : + # Wrapper for Jam rule + ParseFunctionArguments "\$@" + + local mimetype=\${functionArgs[0]} + local extension=\${functionArgs[1]} + local list=\${functionArgs[2]} + local extract=\${functionArgs[3]} + + # clean up the variables + TrimLeadingSpace mimetype + TrimEndingSpace mimetype + TrimLeadingSpace extension + TrimEndingSpace extension + TrimLeadingSpace list + TrimEndingSpace list + TrimLeadingSpace extract + TrimEndingSpace extract + local rule_raw="\${mimetype}\\t\${extension}\\t\${list}\\t\${extract}" + + # reset this at every invocation + ruleFound= + + if [ \${expanderRulesFileExists} ] ; then + # Check if a rule for the mimetype & extension exists. + while read line ; do + existing_rule=`echo \$line | awk '{ print \$1\$2 }'` + if [ "\${mimetype}\${extension}" == "\${existing_rule}" ] ; then + ruleFound=1 + break + fi + done < "\${expanderRulesFile}" + fi + if ! [ \${expanderRulesFileExists} ] || ! [ \${ruleFound} ] ; then + # Either expander.rules does not exist or a rule for mimetype & + # extension does not exist. Output the new rule directly to it. + echo -e \${rule_raw} >> \${expanderRulesFile} + fi +} + + EOF #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cat ${tmpDir}/optpkg.stage2 >> ${tmpDir}/install-optpkg.sh @@ -531,6 +578,11 @@ function ConvertJamToBash() if($0~/\;/) ORS="\n"; else ORS=" "; print } + /AddExpanderRuleToHaikuImage/,/\;/{ + isRule=1; + if($0~/\;/) ORS="\n"; + else ORS=" "; print + } /Exit/,/\;/{ isRule=1; if($0~/\;/) ORS="\n";