Automatic whitespace cleanup. No functional change.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36533 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Matt Madia
2010-04-29 15:50:22 +00:00
parent 73f4184b7b
commit ac8e7456e6
+88 -88
View File
@@ -6,10 +6,10 @@
# Authors: # Authors:
# Matt Madia, [email protected] # Matt Madia, [email protected]
# #
# Synopsis: # Synopsis:
# Provides a controlled mechanism for end-users to install certain pre-built # Provides a controlled mechanism for end-users to install certain pre-built
# OptionalPackages. The script will determine the host information: the # OptionalPackages. The script will determine the host information: the
# default GCC, availability of secondary GCC libs, and revision. Using this # default GCC, availability of secondary GCC libs, and revision. Using this
# information, the user will be limited to the appropriate OptionalPackages # information, the user will be limited to the appropriate OptionalPackages
# that were available for that specific revision. # that were available for that specific revision.
# #
@@ -66,7 +66,7 @@ function ParseFunctionArguments()
IN="\$@" IN="\$@"
OIFS=\$IFS OIFS=\$IFS
IFS=":" IFS=":"
local count=0 local count=0
functionArgs=( ) functionArgs=( )
for x in \$IN for x in \$IN
@@ -125,13 +125,13 @@ function InstallOptionalHaikuImagePackage()
# Wrapper for Jam rule # Wrapper for Jam rule
echo "Installing \$1 ..." echo "Installing \$1 ..."
cd \$tmpDir cd \$tmpDir
archiveFile=\`echo \$3 | sed -s "s/http.*\///"\` archiveFile=\`echo \$3 | sed -s "s/http.*\///"\`
if ! [ -f \$archiveFile ] ; then if ! [ -f \$archiveFile ] ; then
echo "Downloading \$3 ..." echo "Downloading \$3 ..."
wget -nv \$3 wget -nv \$3
fi fi
local dirTokens='/boot' local dirTokens='/boot'
local count=4 local count=4
local i=0 local i=0
@@ -140,7 +140,7 @@ function InstallOptionalHaikuImagePackage()
((i++)) ((i++))
else else
((i++)) ((i++))
if [ "\$possibleToken" != ':' ] ; then if [ "\$possibleToken" != ':' ] ; then
dirTokens=\${dirTokens}/\$possibleToken dirTokens=\${dirTokens}/\$possibleToken
else else
break break
@@ -149,7 +149,7 @@ function InstallOptionalHaikuImagePackage()
done done
echo "Extracting \$archiveFile ..." echo "Extracting \$archiveFile ..."
extractDir="\${dirTokens}" extractDir="\${dirTokens}"
case "\$archiveFile" in case "\$archiveFile" in
*.zip) *.zip)
unzip -q -o -d "\$extractDir" "\$archiveFile" unzip -q -o -d "\$extractDir" "\$archiveFile"
@@ -162,7 +162,7 @@ function InstallOptionalHaikuImagePackage()
exit 1 exit 1
;; ;;
esac esac
if [ -f '/boot/.OptionalPackageDescription' ] ; then if [ -f '/boot/.OptionalPackageDescription' ] ; then
rm '/boot/.OptionalPackageDescription' rm '/boot/.OptionalPackageDescription'
fi fi
@@ -172,25 +172,25 @@ function InstallOptionalHaikuImagePackage()
function AddSymlinkToHaikuImage() function AddSymlinkToHaikuImage()
{ {
# AddSymlinkToHaikuImage <dir tokens> : <link target> [ : <link name> ] # AddSymlinkToHaikuImage <dir tokens> : <link target> [ : <link name> ]
# Wrapper for Jam rule # Wrapper for Jam rule
ParseFunctionArguments "\$@" ParseFunctionArguments "\$@"
local dirTokens="/boot/\${functionArgs[0]}" local dirTokens="/boot/\${functionArgs[0]}"
TrimLeadingSpace dirTokens TrimLeadingSpace dirTokens
TrimEndingSpace dirTokens TrimEndingSpace dirTokens
dirTokens=\${dirTokens//' '/\/} dirTokens=\${dirTokens//' '/\/}
local linkTarget="\${functionArgs[1]}" local linkTarget="\${functionArgs[1]}"
TrimLeadingSpace linkTarget TrimLeadingSpace linkTarget
TrimEndingSpace linkTarget TrimEndingSpace linkTarget
local linkName="\${functionArgs[2]}" local linkName="\${functionArgs[2]}"
TrimLeadingSpace linkName TrimLeadingSpace linkName
TrimEndingSpace linkName TrimEndingSpace linkName
mkdir -p "\${dirTokens}" mkdir -p "\${dirTokens}"
if [ "\${linkName}" == '' ] ; then if [ "\${linkName}" == '' ] ; then
ln -sf "\${linkTarget}" -t "\${dirTokens}" ln -sf "\${linkTarget}" -t "\${dirTokens}"
else else
@@ -202,36 +202,36 @@ function AddSymlinkToHaikuImage()
function AddUserToHaikuImage() function AddUserToHaikuImage()
{ {
# AddUserToHaikuImage user : uid : gid : home : shell : realName # AddUserToHaikuImage user : uid : gid : home : shell : realName
# Wrapper for Jam rule # Wrapper for Jam rule
ParseFunctionArguments "\$@" ParseFunctionArguments "\$@"
local user=\${functionArgs[0]} local user=\${functionArgs[0]}
local uid=\${functionArgs[1]} local uid=\${functionArgs[1]}
local gid=\${functionArgs[2]} local gid=\${functionArgs[2]}
local home=\${functionArgs[3]} local home=\${functionArgs[3]}
local shell=\${functionArgs[4]} local shell=\${functionArgs[4]}
local realName=\${functionArgs[5]} local realName=\${functionArgs[5]}
passwdLine="\${user}:x:\${uid}:\${gid}:\${realName}:\${home}:\${shell}" passwdLine="\${user}:x:\${uid}:\${gid}:\${realName}:\${home}:\${shell}"
passwdLine=\${passwdLine//' :'/':'} passwdLine=\${passwdLine//' :'/':'}
passwdLine=\${passwdLine//': '/':'} passwdLine=\${passwdLine//': '/':'}
local length=\${#passwdLine} local length=\${#passwdLine}
((length--)) ((length--))
if [ "\${passwdLine:\$length}" == ' ' ] ; then if [ "\${passwdLine:\$length}" == ' ' ] ; then
passwdLine=\${passwdLine%' '} passwdLine=\${passwdLine%' '}
fi fi
passwdFile="\`finddir B_COMMON_ETC_DIRECTORY\`/passwd" passwdFile="\`finddir B_COMMON_ETC_DIRECTORY\`/passwd"
touch \${passwdFile} touch \${passwdFile}
local userExists=1 local userExists=1
while read line ; do while read line ; do
if [ "\${passwdLine}" == "\${line}" ] ; then if [ "\${passwdLine}" == "\${line}" ] ; then
userExists=0 userExists=0
fi fi
done < \${passwdFile} done < \${passwdFile}
if [ \$userExists -ge 1 ] ; then if [ \$userExists -ge 1 ] ; then
echo "\${passwdLine}" >> \${passwdFile} echo "\${passwdLine}" >> \${passwdFile}
fi fi
@@ -241,15 +241,15 @@ function AddUserToHaikuImage()
function AddExpanderRuleToHaikuImage() function AddExpanderRuleToHaikuImage()
{ {
# AddExpanderRuleToHaikuImage <mimetype> : <extension> : <list> : <extract> # AddExpanderRuleToHaikuImage <mimetype> : <extension> : <list> : <extract>
# Wrapper for Jam rule # Wrapper for Jam rule
ParseFunctionArguments "\$@" ParseFunctionArguments "\$@"
local mimetype=\${functionArgs[0]} local mimetype=\${functionArgs[0]}
local extension=\${functionArgs[1]} local extension=\${functionArgs[1]}
local list=\${functionArgs[2]} local list=\${functionArgs[2]}
local extract=\${functionArgs[3]} local extract=\${functionArgs[3]}
# clean up the variables # clean up the variables
TrimLeadingSpace mimetype TrimLeadingSpace mimetype
TrimEndingSpace mimetype TrimEndingSpace mimetype
TrimLeadingSpace extension TrimLeadingSpace extension
@@ -259,22 +259,22 @@ function AddExpanderRuleToHaikuImage()
TrimLeadingSpace extract TrimLeadingSpace extract
TrimEndingSpace extract TrimEndingSpace extract
local rule_raw="\${mimetype}\\t\${extension}\\t\${list}\\t\${extract}" local rule_raw="\${mimetype}\\t\${extension}\\t\${list}\\t\${extract}"
# reset this at every invocation # reset this at every invocation
ruleFound= ruleFound=
if [ \${expanderRulesFileExists} ] ; then if [ \${expanderRulesFileExists} ] ; then
# Check if a rule for the mimetype & extension exists. # Check if a rule for the mimetype & extension exists.
while read line ; do while read line ; do
existing_rule=`echo \$line | awk '{ print \$1\$2 }'` existing_rule=`echo \$line | awk '{ print \$1\$2 }'`
if [ "\${mimetype}\${extension}" == "\${existing_rule}" ] ; then if [ "\${mimetype}\${extension}" == "\${existing_rule}" ] ; then
ruleFound=1 ruleFound=1
break break
fi fi
done < "\${expanderRulesFile}" done < "\${expanderRulesFile}"
fi fi
if ! [ \${expanderRulesFileExists} ] || ! [ \${ruleFound} ] ; then if ! [ \${expanderRulesFileExists} ] || ! [ \${ruleFound} ] ; then
# Either expander.rules does not exist or a rule for mimetype & # Either expander.rules does not exist or a rule for mimetype &
# extension does not exist. Output the new rule directly to it. # extension does not exist. Output the new rule directly to it.
echo -e \${rule_raw} >> \${expanderRulesFile} echo -e \${rule_raw} >> \${expanderRulesFile}
fi fi
@@ -319,7 +319,7 @@ function Init()
# Make sure these files are empty. # Make sure these files are empty.
echo "" > ${tmpDir}/optpkg.jam echo "" > ${tmpDir}/optpkg.jam
echo "" > ${tmpDir}/optpkg.stage1 echo "" > ${tmpDir}/optpkg.stage1
if ! [ -d ${baseDir} ] ; then if ! [ -d ${baseDir} ] ; then
mkdir -p ${baseDir} mkdir -p ${baseDir}
fi fi
@@ -339,7 +339,7 @@ function DownloadAllBuildFiles()
for file in ${buildFiles} ; do for file in ${buildFiles} ; do
GetBuildFile ${file} GetBuildFile ${file}
done done
} }
@@ -355,7 +355,7 @@ function GetBuildFile()
local revision=`uname -v | awk '{print $1}' | sed -e 's/r//'` local revision=`uname -v | awk '{print $1}' | sed -e 's/r//'`
local url="${baseURL}${revision}/haiku/trunk/build/jam/${buildfile}" local url="${baseURL}${revision}/haiku/trunk/build/jam/${buildfile}"
wget -q ${url} || ErrorExit "...failed to download $buildfile" wget -q ${url} || ErrorExit "...failed to download $buildfile"
fi fi
} }
@@ -389,7 +389,7 @@ function ReadPackageNamesIntoMemory()
if ! [ -f ${file} ] ; then if ! [ -f ${file} ] ; then
GeneratePackageNames GeneratePackageNames
fi fi
# read list into associative array # read list into associative array
while read line ; do while read line ; do
local pkg=`echo ${line} | awk '{print $1}'` local pkg=`echo ${line} | awk '{print $1}'`
@@ -407,22 +407,22 @@ function GeneratePackageNames()
# Each line shows a pakage and all of its recrusive dependencies # Each line shows a pakage and all of its recrusive dependencies
# "<pkg> : <dep1> <dep2> ..." # "<pkg> : <dep1> <dep2> ..."
echo "Generating a list of Package Names ..." echo "Generating a list of Package Names ..."
local file="${baseDir}/OptionalPackageNames" local file="${baseDir}/OptionalPackageNames"
touch ${file} touch ${file}
local regExp='/^if\ \[\ IsOptionalHaikuImagePackageAdded/p' local regExp='/^if\ \[\ IsOptionalHaikuImagePackageAdded/p'
sed -n -e "$regExp" ${baseDir}/OptionalPackages > ${file}.temp sed -n -e "$regExp" ${baseDir}/OptionalPackages > ${file}.temp
while read line ; do while read line ; do
# in each non-filtered line, the 4th word is the optional package # in each non-filtered line, the 4th word is the optional package
local pkg=`echo ${line} | awk '{print $4}'` local pkg=`echo ${line} | awk '{print $4}'`
nonRepeatingDeps="" nonRepeatingDeps=""
GetPackageDependencies "$pkg" GetPackageDependencies "$pkg"
if IsPackageAndDepsOkToInstall ${pkg} ; then if IsPackageAndDepsOkToInstall ${pkg} ; then
echo "${pkg} : ${nonRepeatingDeps}" >> ${file} echo "${pkg} : ${nonRepeatingDeps}" >> ${file}
fi fi
done < ${file}.temp done < ${file}.temp
rm ${file}.temp rm ${file}.temp
} }
@@ -431,32 +431,32 @@ function GeneratePackageNames()
function GetPackageDependencies() function GetPackageDependencies()
{ {
# GetPackageDependencies <pkg> # GetPackageDependencies <pkg>
# parse OptionalPackageDependencies for the single line that defines # parse OptionalPackageDependencies for the single line that defines
# this optional package's dependencies. # this optional package's dependencies.
local regExp="^OptionalPackageDependencies\ ${1}\ \:" local regExp="^OptionalPackageDependencies\ ${1}\ \:"
local inputFile="${baseDir}/OptionalPackageDependencies" local inputFile="${baseDir}/OptionalPackageDependencies"
# print that single line # print that single line
sed -n -e "/${regExp}\ /p" ${inputFile} > ${tmpDir}/optpkg.temp sed -n -e "/${regExp}\ /p" ${inputFile} > ${tmpDir}/optpkg.temp
# strip out "OptionalPackageDependencies PackageName :" # strip out "OptionalPackageDependencies PackageName :"
# this leaves "<dep1> .... ;" # this leaves "<dep1> .... ;"
tempDeps=`sed -e "s/${regExp}\ //" ${tmpDir}/optpkg.temp` tempDeps=`sed -e "s/${regExp}\ //" ${tmpDir}/optpkg.temp`
for foo in ${tempDeps%' ;'} ; do for foo in ${tempDeps%' ;'} ; do
# Prevent duplicate entries of the same dependency package. # Prevent duplicate entries of the same dependency package.
if ! ContainsSubstring "${nonRepeatingDeps} " "${foo} " ; then if ! ContainsSubstring "${nonRepeatingDeps} " "${foo} " ; then
nonRepeatingDeps="$foo $nonRepeatingDeps " nonRepeatingDeps="$foo $nonRepeatingDeps "
nonRepeatingDeps="${nonRepeatingDeps// / }" nonRepeatingDeps="${nonRepeatingDeps// / }"
fi fi
done done
# Recursively get the dependencies of these dependencies. # Recursively get the dependencies of these dependencies.
for dep in ${tempDeps%' ;'} ; do for dep in ${tempDeps%' ;'} ; do
GetPackageDependencies "$dep" GetPackageDependencies "$dep"
done done
} }
@@ -492,17 +492,17 @@ function BuildListOfRequestedPackages()
function AddPackages() function AddPackages()
{ {
# AddPackages # AddPackages
# If one or more packages can be installed, do it. # If one or more packages can be installed, do it.
if BuildFinalListOfPackagesToInstall ; then if BuildFinalListOfPackagesToInstall ; then
for package in ${packagesToInstall} ; do for package in ${packagesToInstall} ; do
# output the "if [ IsOptionalHaikuImagePackageAdded..." code block # output the "if [ IsOptionalHaikuImagePackageAdded..." code block
local regExp="if\ \[\ IsOptionalHaikuImagePackageAdded\ ${package}" local regExp="if\ \[\ IsOptionalHaikuImagePackageAdded\ ${package}"
local inputFile="${baseDir}/OptionalPackages" local inputFile="${baseDir}/OptionalPackages"
sed -n "/^$regExp/,/^\}/p" ${inputFile} >> ${tmpDir}/optpkg.jam sed -n "/^$regExp/,/^\}/p" ${inputFile} >> ${tmpDir}/optpkg.jam
done done
ConvertJamToBash "${tmpDir}/optpkg.jam" ConvertJamToBash "${tmpDir}/optpkg.jam"
rm "${tmpDir}/optpkg.jam" rm "${tmpDir}/optpkg.jam"
CreateInstallerScript CreateInstallerScript
@@ -515,10 +515,10 @@ function AddPackages()
function BuildFinalListOfPackagesToInstall() function BuildFinalListOfPackagesToInstall()
{ {
# BuildFinalListOfPackagesToInstall # BuildFinalListOfPackagesToInstall
packagesToInstall="" packagesToInstall=""
proceedWithInstallation=false proceedWithInstallation=false
for desiredPackage in ${wantsToInstall}; do for desiredPackage in ${wantsToInstall}; do
if IsPackageNameValid $desiredPackage ; then if IsPackageNameValid $desiredPackage ; then
for item in ${availablePackages[${desiredPackage}]} ; do for item in ${availablePackages[${desiredPackage}]} ; do
@@ -557,69 +557,69 @@ function ConvertJamToBash()
local inputFile=$1 local inputFile=$1
declare -a generatedBash declare -a generatedBash
countGenBashLine=0 countGenBashLine=0
# Parse out some variable declarations # Parse out some variable declarations
local regExp='/^HAIKU_OPENSSL_PACKAGE/p' local regExp='/^HAIKU_OPENSSL_PACKAGE/p'
sslPkgLine=`sed -n -e "$regExp" ${baseDir}/OptionalBuildFeatures` sslPkgLine=`sed -n -e "$regExp" ${baseDir}/OptionalBuildFeatures`
ConvertVariableDeclarationLines "$regExp" 'sslPkgLine' ConvertVariableDeclarationLines "$regExp" 'sslPkgLine'
local regExp='/^HAIKU_OPENSSL_URL/p' local regExp='/^HAIKU_OPENSSL_URL/p'
sslUrlLine=`sed -n -e "$regExp" ${baseDir}/OptionalBuildFeatures` sslUrlLine=`sed -n -e "$regExp" ${baseDir}/OptionalBuildFeatures`
ConvertVariableDeclarationLines "$regExp" 'sslUrlLine' ConvertVariableDeclarationLines "$regExp" 'sslUrlLine'
local regExp='/^local\ baseURL/p' local regExp='/^local\ baseURL/p'
urlLine=`sed -n -e "$regExp" ${baseDir}/OptionalPackages` urlLine=`sed -n -e "$regExp" ${baseDir}/OptionalPackages`
urlLine=${urlLine/local\ /''} urlLine=${urlLine/local\ /''}
ConvertVariableDeclarationLines "$regExp" 'urlLine' ConvertVariableDeclarationLines "$regExp" 'urlLine'
# Convert the easy bits. # Convert the easy bits.
while read line ; do while read line ; do
line=${line/'Echo'/'echo'} line=${line/'Echo'/'echo'}
ConvertIfStatements "$line" ConvertIfStatements "$line"
ConvertVariables "$line" ConvertVariables "$line"
#ReplaceComparators "$line" #ReplaceComparators "$line"
line=${line/"IsOptionalHaikuImagePackageAdded"/'"SomeText" !='} line=${line/"IsOptionalHaikuImagePackageAdded"/'"SomeText" !='}
generatedBash[$countGenBashLine]=${line} generatedBash[$countGenBashLine]=${line}
((countGenBashLine++)) ((countGenBashLine++))
done < ${tmpDir}/optpkg.jam done < ${tmpDir}/optpkg.jam
# output stage 1 generated code # output stage 1 generated code
local i=0 local i=0
while [ $i -lt $countGenBashLine ] ; do while [ $i -lt $countGenBashLine ] ; do
echo ${generatedBash[$i]} >> ${tmpDir}/optpkg.stage1 echo ${generatedBash[$i]} >> ${tmpDir}/optpkg.stage1
((i++)) ((i++))
done done
# This converts multi-line jam statements into a single line. # This converts multi-line jam statements into a single line.
# --- Start awk --- # --- Start awk ---
awk ' awk '
/InstallOptionalHaikuImagePackage/,/\;/{ /InstallOptionalHaikuImagePackage/,/\;/{
isRule=1; isRule=1;
if($0~/\;/) ORS="\n"; if($0~/\;/) ORS="\n";
else ORS=" "; print else ORS=" "; print
} }
/AddSymlinkToHaikuImage/,/\;/{ /AddSymlinkToHaikuImage/,/\;/{
isRule=1; isRule=1;
if($0~/\;/) ORS="\n"; if($0~/\;/) ORS="\n";
else ORS=" "; print else ORS=" "; print
} }
/AddUserToHaikuImage/,/\;/{ /AddUserToHaikuImage/,/\;/{
isRule=1; isRule=1;
if($0~/\;/) ORS="\n"; if($0~/\;/) ORS="\n";
else ORS=" "; print else ORS=" "; print
} }
/AddExpanderRuleToHaikuImage/,/\;/{ /AddExpanderRuleToHaikuImage/,/\;/{
isRule=1; isRule=1;
if($0~/\;/) ORS="\n"; if($0~/\;/) ORS="\n";
else ORS=" "; print else ORS=" "; print
} }
/Exit/,/\;/{ /Exit/,/\;/{
isRule=1; isRule=1;
if($0~/\;/) ORS="\n"; if($0~/\;/) ORS="\n";
else ORS=" "; print else ORS=" "; print
} }
{ {
if($1!='InstallOptionalHaikuImagePackage' && isRule!=1 && $1!="\;") if($1!='InstallOptionalHaikuImagePackage' && isRule!=1 && $1!="\;")
print $0 print $0
@@ -639,19 +639,19 @@ function ConvertVariableDeclarationLines()
eval local input='$'"$2" eval local input='$'"$2"
local regex="$1" local regex="$1"
local _outvar="$2" local _outvar="$2"
input=${input/\ =\ /=} input=${input/\ =\ /=}
input=${input/\;/''} input=${input/\;/''}
input=${input//\(/'{'} input=${input//\(/'{'}
input=${input//\)/'}'} input=${input//\)/'}'}
eval $_outvar="'$input'" eval $_outvar="'$input'"
} }
function ConvertIfStatements() function ConvertIfStatements()
{ {
# ConvertIfStatements <line> # ConvertIfStatements <line>
# One of the Jam-to-Bash conversion functions. # One of the Jam-to-Bash conversion functions.
line=${line//'} else {'/'else '} line=${line//'} else {'/'else '}
line=${line//'} else if '/'elif '} line=${line//'} else if '/'elif '}
@@ -659,13 +659,13 @@ function ConvertIfStatements()
if ! ContainsSubstring "$line" "if [" ; then if ! ContainsSubstring "$line" "if [" ; then
line=${line/'if '/'if [ '} line=${line/'if '/'if [ '}
fi fi
if ContainsSubstring "$line" '] {' ; then if ContainsSubstring "$line" '] {' ; then
line=${line/'{'/' ; then'} line=${line/'{'/' ; then'}
elif ContainsSubstring "$line" '{' ; then elif ContainsSubstring "$line" '{' ; then
line=${line/'{'/' ] ; then'} line=${line/'{'/' ] ; then'}
fi fi
for compound in '&&' '||' ; do for compound in '&&' '||' ; do
if ContainsSubstring "$line" "$compound" ; then if ContainsSubstring "$line" "$compound" ; then
line=${line/"$compound"/"] $compound ["} line=${line/"$compound"/"] $compound ["}
@@ -682,7 +682,7 @@ function ConvertVariables()
{ {
# ConvertVariables # ConvertVariables
# One of the Jam-to-Bash conversion functions. # One of the Jam-to-Bash conversion functions.
# NOTE: jam's variables are normally '$(VARIABLE)'. \n # NOTE: jam's variables are normally '$(VARIABLE)'. \n
# The issue is with '(' and ')', so let's replace them globally. # The issue is with '(' and ')', so let's replace them globally.
if ContainsSubstring "$line" '$(' ; then if ContainsSubstring "$line" '$(' ; then
@@ -696,7 +696,7 @@ function ReplaceComparators()
{ {
# ReplaceComparators <line> # ReplaceComparators <line>
# One of the Jam-to-Bash conversion functions. # One of the Jam-to-Bash conversion functions.
# Preserve string comparators for TARGET_ARCH. # Preserve string comparators for TARGET_ARCH.
if ! ContainsSubstring "$line" 'TARGET_ARCH' ; then if ! ContainsSubstring "$line" 'TARGET_ARCH' ; then
line=${line//'>='/'-ge'} line=${line//'>='/'-ge'}
@@ -724,7 +724,7 @@ Usage: ./installoptionalpackage [<pkg> [<pkg> ...]]
or ./installoptionalpackage [-a|-s <pkg> [<pkg> ...]] or ./installoptionalpackage [-a|-s <pkg> [<pkg> ...]]
or ./installoptionalpackage [-f|-h|-l] or ./installoptionalpackage [-f|-h|-l]
Options: Options:
-a Add one or more packages and all dependencies -a Add one or more packages and all dependencies
-s Show the final list of packages that would be installed -s Show the final list of packages that would be installed
-f Remove cached data and list installable packages -f Remove cached data and list installable packages
@@ -742,11 +742,11 @@ function RemoveCachedFiles()
if [ -d ${baseDir} ]; then if [ -d ${baseDir} ]; then
rm -rf ${baseDir} rm -rf ${baseDir}
fi fi
# Unset variables, which prevents duplicate entries. # Unset variables, which prevents duplicate entries.
declare -A availablePackages declare -A availablePackages
declare availablePackagesKeys="" declare availablePackagesKeys=""
# Reinitialize # Reinitialize
Init Init
} }
@@ -758,10 +758,10 @@ function ListPackages()
echo "" echo ""
echo "" echo ""
echo "Available Optional Packages:" echo "Available Optional Packages:"
# single line: # single line:
echo ${availablePackagesKeys} echo ${availablePackagesKeys}
# one per line: # one per line:
#for package in ${availablePackagesKeys} ; do #for package in ${availablePackagesKeys} ; do
# echo ${package} # echo ${package}
@@ -783,7 +783,7 @@ if [ "$1" != '-f' ] && [ "$1" != '-l' ] && [ "$1" != '-h' ] \
BuildListOfRequestedPackages $@ BuildListOfRequestedPackages $@
AddPackages AddPackages
exit 0 exit 0
fi fi
# Parse the arguments given to the script. # Parse the arguments given to the script.
while getopts "as:fhl" opt; do while getopts "as:fhl" opt; do