Added support for installoptionalpackage [<pkg> [<pkg> ...]]. Updated Usage.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36397 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
declare -A availablePackages
|
declare -A availablePackages
|
||||||
declare availablePackagesKeys=""
|
declare availablePackagesKeys=""
|
||||||
|
declare wantsToInstall=""
|
||||||
# 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 \
|
||||||
@@ -476,13 +477,26 @@ function IsPackageAndDepsOkToInstall()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function AddPackage()
|
function BuildListOfRequestedPackages()
|
||||||
{
|
{
|
||||||
# AddPackage <name>
|
if [ "$1" = '-a' ]; then
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
while [ $# -gt 0 ]; do
|
||||||
|
wantsToInstall="${wantsToInstall} $1"
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
echo "wantsToInstall: ${wantsToInstall}"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function AddPackages()
|
||||||
|
{
|
||||||
|
# AddPackages
|
||||||
packagesToInstall=""
|
packagesToInstall=""
|
||||||
proceedWithInstallation=false
|
proceedWithInstallation=false
|
||||||
|
|
||||||
for desiredPackage in ${1}; 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
|
||||||
if ! ContainsSubstring "${packagesToInstall}" "${item}" ; then
|
if ! ContainsSubstring "${packagesToInstall}" "${item}" ; then
|
||||||
@@ -695,11 +709,15 @@ Disclaimer:
|
|||||||
http://dev.haiku-os.org/wiki/PackageManagerIdeas
|
http://dev.haiku-os.org/wiki/PackageManagerIdeas
|
||||||
http://dev.haiku-os.org/wiki/PackageFormat
|
http://dev.haiku-os.org/wiki/PackageFormat
|
||||||
|
|
||||||
Usage: ./installoptionalpackage [-f] [-h] [-l] [-a "<pkg> [<pkg> ...]"]
|
Usage: ./installoptionalpackage [<pkg> [<pkg> ...]]
|
||||||
-a Add one or more packages and all dependencies
|
or ./installoptionalpackage [-a <pkg> [<pkg> ...]]
|
||||||
-f Remove cached data and list installable packages
|
or ./installoptionalpackage [-f|-h|-l]
|
||||||
-h Print this help.
|
|
||||||
-l List installable packages
|
Options:
|
||||||
|
-a Add one or more packages and all dependencies
|
||||||
|
-f Remove cached data and list installable packages
|
||||||
|
-h Print this help.
|
||||||
|
-l List installable packages
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
@@ -747,11 +765,19 @@ else
|
|||||||
Init
|
Init
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Support `installoptionalpackage <pkg> <pkg> ...`
|
||||||
|
if [ "$1" != '-f' ] && [ "$1" != '-l' ] && [ "$1" != '-h' ]; then
|
||||||
|
BuildListOfRequestedPackages $@
|
||||||
|
AddPackages
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
# Parse the arguments given to the script.
|
# Parse the arguments given to the script.
|
||||||
while getopts "a:fhl" opt; do
|
while getopts "a:fhl" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
a)
|
a)
|
||||||
AddPackage "$OPTARG"
|
BuildListOfRequestedPackages $@
|
||||||
|
AddPackages
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
f)
|
f)
|
||||||
|
|||||||
Reference in New Issue
Block a user