summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.todo2
-rwxr-xr-xbin/pkg19
2 files changed, 20 insertions, 1 deletions
diff --git a/.todo b/.todo
index 08478e6..8b6a429 100644
--- a/.todo
+++ b/.todo
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<todo version="0.1.20">
- <note priority="low" time="1213221704">
+ <note priority="low" time="1213221704" done="1213257550">
implement package conflicts
</note>
</todo>
diff --git a/bin/pkg b/bin/pkg
index 3619dc1..1638a25 100755
--- a/bin/pkg
+++ b/bin/pkg
@@ -150,6 +150,24 @@ check_deps () {
}
}
+check_conflicts () {
+ [ -r $PDIR/$1/conflicts ] || return 0
+ CONFLICTS=($(cat $PDIR/$1/conflicts))
+ REMOVE=()
+ for conflict in $CONFLICTS; {
+ if ([ -d $PDIR/$conflict ]) {
+ if (confirm_no "$1 conflicts with $conflict. Remove $conflict?") {
+ REMOVE+="$conflict"
+ }
+ }
+ }
+ if ([ -n "$REMOVE" ]) {
+ for pkg in $REMOVE; {
+ pkg_remove "$pkg"
+ }
+ }
+}
+
# Write a packages' files to .collected
# Currently, this is only documentation
populate_collected () {
@@ -224,6 +242,7 @@ pkg_add () {
. $PDIR/$1/hooks/post-add
}
check_deps "$1"
+ check_conflicts "$1"
cd $PDIR/$1
checklinks $CL_OPTIONS
populate_collected "$1"