Some enhancements.

* lists the installed packages, along with the ones that can be installed
 * once a package has been installed, remove it from the list of installables


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37267 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Matt Madia
2010-06-26 18:30:25 +00:00
parent 8154643efe
commit fb8e505190
+20 -7
View File
@@ -440,7 +440,9 @@ function GeneratePackageNames()
echo "Generating a list of Package Names ..." echo "Generating a list of Package Names ..."
local file="${baseDir}/OptionalPackageNames" local file="${baseDir}/OptionalPackageNames"
touch ${file} if [ -e "${file}" ]; then
rm "${file}"
fi
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
@@ -451,8 +453,10 @@ function GeneratePackageNames()
nonRepeatingDeps="" nonRepeatingDeps=""
GetPackageDependencies "$pkg" GetPackageDependencies "$pkg"
local lowerCasePkg=`echo ${pkg} | tr '[A-Z]' '[a-z]'` local lowerCasePkg=`echo ${pkg} | tr '[A-Z]' '[a-z]'`
if IsPackageAndDepsOkToInstall ${pkg} ; then if ! ContainsSubstring "${alreadyInstalled} " "${pkg} " ; then
echo "${lowerCasePkg} : ${pkg} ${nonRepeatingDeps}" >> ${file} if IsPackageAndDepsOkToInstall ${pkg} ; then
echo "${lowerCasePkg} : ${pkg} ${nonRepeatingDeps}" >> ${file}
fi
fi fi
done < ${file}.temp done < ${file}.temp
@@ -496,12 +500,12 @@ function IsPackageAndDepsOkToInstall()
{ {
# IsPackageAndDepsOkToInstall <pkg> # IsPackageAndDepsOkToInstall <pkg>
if ContainsSubstring "${packageIgnoreList}" "${1}"; then if ContainsSubstring "${packageIgnoreList}" "${1}"; then
echo "...warning: ${1} cannot be installed" #echo "...warning: ${1} cannot be installed"
return 1 return 1
fi fi
for foo in ${nonRepeatingDeps} ; do for foo in ${nonRepeatingDeps} ; do
if ContainsSubstring "${packageIgnoreList}" "${foo}"; then if ContainsSubstring "${packageIgnoreList}" "${foo}"; then
echo "...warning: ${1} cannot be installed because of ${foo}" #echo "...warning: ${1} cannot be installed because of ${foo}"
return 1 return 1
fi fi
done done
@@ -541,7 +545,12 @@ function AddPackages()
CreateInstallerScript CreateInstallerScript
sh ${tmpDir}/install-optpkg.sh sh ${tmpDir}/install-optpkg.sh
rm ${tmpDir}/install-optpkg.sh rm ${tmpDir}/install-optpkg.sh
# update files to account for the newly installed packages
alreadyInstalled="${alreadyInstalled} ${packagesToInstall} "
RecordInstalledPackages RecordInstalledPackages
GeneratePackageNames
echo "... done."
fi fi
} }
@@ -600,7 +609,7 @@ function IsPackageNameValid()
function RecordInstalledPackages() function RecordInstalledPackages()
{ {
echo -e ${packagesToInstall} | tr '\ ' '\n' >> ${installedPackagesFile} echo -e ${alreadyInstalled} | tr '\ ' '\n' | sort > ${installedPackagesFile}
} }
@@ -791,8 +800,12 @@ function ListPackages()
{ {
# ListPackages # ListPackages
echo "" echo ""
echo "Optional Packages that have been installed:"
echo ${alreadyInstalled}
echo "" echo ""
echo "Available Optional Packages:" echo ""
echo "Installable Optional Packages:"
# single line: # single line:
echo ${availablePackagesKeys} echo ${availablePackagesKeys}