From 98d65f56274af75c20bfa0da2235258e8d71ae13 Mon Sep 17 00:00:00 2001 From: Matt Madia Date: Wed, 23 Jun 2010 21:28:41 +0000 Subject: [PATCH] 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 --- data/bin/installoptionalpackage | 52 +++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 9 deletions(-) diff --git a/data/bin/installoptionalpackage b/data/bin/installoptionalpackage index 9519c90bfb..eb9adf91cb 100755 --- a/data/bin/installoptionalpackage +++ b/data/bin/installoptionalpackage @@ -38,10 +38,12 @@ Options:\n\ declare -A availablePackages declare availablePackagesKeys="" declare wantsToInstall="" +declare alreadyInstalled="" # Some Packages cannot be installed, # as they require either the source code or compiled binaries -declare packageIgnoreList='Bluetooth Development DevelopmentMin \ -DevelopmentBase MandatoryPackages UserlandFS Welcome WifiFirmwareScriptData' +declare packageIgnoreList="Bluetooth Development DevelopmentMin \ +DevelopmentBase MandatoryPackages UserlandFS Welcome WifiFirmwareScriptData " +installedPackagesFile="`finddir B_COMMON_DATA_DIRECTORY`/InstalledPackages" function CreateInstallerScript() @@ -345,6 +347,7 @@ function Init() DetectSystemConfiguration DownloadAllBuildFiles + ReadInstalledPackagesIntoMemory ReadPackageNamesIntoMemory } @@ -402,6 +405,15 @@ function DetectSystemConfiguration() } +function ReadInstalledPackagesIntoMemory() +{ + while read line ; do + alreadyInstalled="${alreadyInstalled} $line" + packageIgnoreList=${packageIgnoreList/"${line} "/' '} + done < ${installedPackagesFile} +} + + function ReadPackageNamesIntoMemory() { local file="${baseDir}/OptionalPackageNames" @@ -526,9 +538,10 @@ function AddPackages() ConvertJamToBash "${tmpDir}/optpkg.jam" rm "${tmpDir}/optpkg.jam" - CreateInstallerScript - sh ${tmpDir}/install-optpkg.sh - rm ${tmpDir}/install-optpkg.sh + CreateInstallerScript + sh ${tmpDir}/install-optpkg.sh + rm ${tmpDir}/install-optpkg.sh + RecordInstalledPackages fi } @@ -550,12 +563,27 @@ function BuildFinalListOfPackagesToInstall() proceedWithInstallation=true fi done - if [ $proceedWithInstallation ] ; then - echo "To be installed: ${packagesToInstall}" - return 0 - else + # pad the variable + packagesToInstall="${packagesToInstall} " + # remove entries that are already installed + 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 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() { # ConvertJamToBash