[haiku-commits] r37267 - haiku/trunk/data/bin

  • From: mattmadia@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 26 Jun 2010 20:30:25 +0200 (CEST)

Author: mmadia
Date: 2010-06-26 20:30:25 +0200 (Sat, 26 Jun 2010)
New Revision: 37267
Changeset: http://dev.haiku-os.org/changeset/37267/haiku

Modified:
   haiku/trunk/data/bin/installoptionalpackage
Log:
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


Modified: haiku/trunk/data/bin/installoptionalpackage
===================================================================
--- haiku/trunk/data/bin/installoptionalpackage 2010-06-26 17:50:14 UTC (rev 
37266)
+++ haiku/trunk/data/bin/installoptionalpackage 2010-06-26 18:30:25 UTC (rev 
37267)
@@ -440,7 +440,9 @@
        echo "Generating a list of Package Names ..."
 
        local file="${baseDir}/OptionalPackageNames"
-       touch ${file}
+       if [ -e "${file}" ]; then
+               rm "${file}"
+       fi
 
        local regExp='/^if\ \[\ IsOptionalHaikuImagePackageAdded/p'
        sed -n -e "$regExp" ${baseDir}/OptionalPackages > ${file}.temp
@@ -451,8 +453,10 @@
                nonRepeatingDeps=""
                GetPackageDependencies "$pkg"
                local lowerCasePkg=`echo ${pkg} | tr '[A-Z]' '[a-z]'`
-               if IsPackageAndDepsOkToInstall ${pkg} ; then
-                       echo "${lowerCasePkg} : ${pkg} ${nonRepeatingDeps}"  >> 
${file}
+               if ! ContainsSubstring "${alreadyInstalled} " "${pkg} " ; then
+                       if IsPackageAndDepsOkToInstall ${pkg} ; then
+                               echo "${lowerCasePkg} : ${pkg} 
${nonRepeatingDeps}"  >> ${file}
+                       fi
                fi
 
        done < ${file}.temp
@@ -496,12 +500,12 @@
 {
        # IsPackageAndDepsOkToInstall <pkg>
        if ContainsSubstring "${packageIgnoreList}" "${1}"; then
-               echo "...warning: ${1} cannot be installed"
+               #echo "...warning: ${1} cannot be installed"
                return 1
        fi
        for foo in ${nonRepeatingDeps} ; do
                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
                fi
        done
@@ -541,7 +545,12 @@
                CreateInstallerScript
                sh ${tmpDir}/install-optpkg.sh
                rm ${tmpDir}/install-optpkg.sh
+
+               # update files to account for the newly installed packages
+               alreadyInstalled="${alreadyInstalled} ${packagesToInstall} "
                RecordInstalledPackages
+               GeneratePackageNames
+               echo "... done."
        fi
 }
 
@@ -600,7 +609,7 @@
 
 function RecordInstalledPackages()
 {
-       echo -e ${packagesToInstall} | tr '\ ' '\n'  >> ${installedPackagesFile}
+       echo -e ${alreadyInstalled} | tr '\ ' '\n' | sort > 
${installedPackagesFile}
 }
 
 
@@ -791,8 +800,12 @@
 {
        # ListPackages
        echo ""
+       echo "Optional Packages that have been installed:"
+       echo ${alreadyInstalled}
+
        echo ""
-       echo "Available Optional Packages:"
+       echo ""
+       echo "Installable Optional Packages:"
 
        # single line:
        echo ${availablePackagesKeys}


Other related posts:

  • » [haiku-commits] r37267 - haiku/trunk/data/bin - mattmadia