summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2008-08-03 11:47:30 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2008-08-03 11:47:30 +0200
commit91b26c3f5e55db39eb2afce52453f47fd3c7f360 (patch)
treea88b696d0df1182c5ba06cc0b8adbf59560b4d94
parent374453b5cf26dca7d78b3415916b1843acc9405c (diff)
bin/pkg: Added support for dependencies on files in $PATH
-rwxr-xr-xbin/pkg40
1 files changed, 31 insertions, 9 deletions
diff --git a/bin/pkg b/bin/pkg
index c79c45d..600be8b 100755
--- a/bin/pkg
+++ b/bin/pkg
@@ -268,24 +268,45 @@ exec_hook () {
}
# Check dependencies and offer to install them
+check_path_dep () {
+ which $1 > /dev/null
+}
+
check_deps () {
[[ -r $PDIR/$1/dependencies ]] || return 0
- DEPS=($(cat $PDIR/$1/dependencies))
- INSTALL=()
- for dep in $DEPS; {
- if [[ ! -d $PDIR/$dep ]] {
- INSTALL+="$dep"
+ dependencies=($(cat $PDIR/$1/dependencies))
+ install=()
+ path_install=()
+
+ for dep in $dependencies; {
+ pathdep=${dep#=}
+ if [[ $dep != $pathdep ]] {
+ if (! check_path_dep $pathdep) {
+ path_install+=$pathdep
+ }
+ } else {
+ if [[ ! -d $PDIR/$dep ]] {
+ install+=$dep
+ }
}
}
- if [[ -n "$INSTALL" ]] {
+
+ if [[ -n $install ]] {
+ clear_line
info "$1 has unmet dependencies: "
- echo $INSTALL
+ echo $install
if (confirm_yes "Install dependencies?") {
- for pkg in $INSTALL; {
+ for pkg in $install; {
pkg_add $pkg
}
}
}
+ if [[ -n $path_install ]] {
+ clear_line
+ info "$1 has unmet dependencies: "
+ echo $path_install
+ echo 'Please make sure these files are within $PATH'
+ }
}
check_conflicts () {
@@ -298,6 +319,7 @@ check_conflicts () {
}
}
if [[ -n $REMOVE ]] {
+ clear_line
info "$1 conflicts with the following packages: "
echo $REMOVE
if (confirm_no "Remove conflicting packages and proceed with installation?") {
@@ -305,7 +327,7 @@ check_conflicts () {
pkg_remove $pkg
}
} else {
- die "Installation aborted"
+ die "Installation aborted\n"
}
}
}