Updated installoptionalpackage to make use of common/data/InstalledPackages.

It will also record the packages installed by the user.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37240 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Matt Madia
2010-06-23 21:28:41 +00:00
parent 4676058003
commit 98d65f5627
+43 -9
View File
@@ -38,10 +38,12 @@ Options:\n\
declare -A availablePackages declare -A availablePackages
declare availablePackagesKeys="" declare availablePackagesKeys=""
declare wantsToInstall="" declare wantsToInstall=""
declare alreadyInstalled=""
# Some Packages cannot be installed, # Some Packages cannot be installed,
# as they require either the source code or compiled binaries # as they require either the source code or compiled binaries
declare packageIgnoreList='Bluetooth Development DevelopmentMin \ declare packageIgnoreList="Bluetooth Development DevelopmentMin \
DevelopmentBase MandatoryPackages UserlandFS Welcome WifiFirmwareScriptData' DevelopmentBase MandatoryPackages UserlandFS Welcome WifiFirmwareScriptData "
installedPackagesFile="`finddir B_COMMON_DATA_DIRECTORY`/InstalledPackages"
function CreateInstallerScript() function CreateInstallerScript()
@@ -345,6 +347,7 @@ function Init()
DetectSystemConfiguration DetectSystemConfiguration
DownloadAllBuildFiles DownloadAllBuildFiles
ReadInstalledPackagesIntoMemory
ReadPackageNamesIntoMemory ReadPackageNamesIntoMemory
} }
@@ -402,6 +405,15 @@ function DetectSystemConfiguration()
} }
function ReadInstalledPackagesIntoMemory()
{
while read line ; do
alreadyInstalled="${alreadyInstalled} $line"
packageIgnoreList=${packageIgnoreList/"${line} "/' '}
done < ${installedPackagesFile}
}
function ReadPackageNamesIntoMemory() function ReadPackageNamesIntoMemory()
{ {
local file="${baseDir}/OptionalPackageNames" local file="${baseDir}/OptionalPackageNames"
@@ -526,9 +538,10 @@ function AddPackages()
ConvertJamToBash "${tmpDir}/optpkg.jam" ConvertJamToBash "${tmpDir}/optpkg.jam"
rm "${tmpDir}/optpkg.jam" rm "${tmpDir}/optpkg.jam"
CreateInstallerScript CreateInstallerScript
sh ${tmpDir}/install-optpkg.sh sh ${tmpDir}/install-optpkg.sh
rm ${tmpDir}/install-optpkg.sh rm ${tmpDir}/install-optpkg.sh
RecordInstalledPackages
fi fi
} }
@@ -550,12 +563,27 @@ function BuildFinalListOfPackagesToInstall()
proceedWithInstallation=true proceedWithInstallation=true
fi fi
done done
if [ $proceedWithInstallation ] ; then # pad the variable
echo "To be installed: ${packagesToInstall}" packagesToInstall="${packagesToInstall} "
return 0 # remove entries that are already installed
else for skip in ${alreadyInstalled}; do
packagesToInstall=${packagesToInstall/"${skip} "/}
done
# strip double spaces
packagesToInstall=${packagesToInstall/" "/" "}
if ! [ ${#string} -gt 1 ]; then
echo "... no packages need to be installed."
echo "If you wish to re-install a package, edit $installedPackagesFile"
proceedWithInstallation=false
fi
if ! $proceedWithInstallation ; then
echo 'Not proceeding with installation.'
return 1 return 1
fi fi
exit
echo "To be installed: ${packagesToInstall}"
return 0
} }
@@ -571,6 +599,12 @@ function IsPackageNameValid()
} }
function RecordInstalledPackages()
{
echo -e ${packagesToInstall} | tr '\ ' '\n' >> ${installedPackagesFile}
}
function ConvertJamToBash() function ConvertJamToBash()
{ {
# ConvertJamToBash <input file> # ConvertJamToBash <input file>