From 463c3aff0fa586aa5ff203af8b76d8a05148840d Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 20 Aug 2008 18:27:49 +0200 Subject: bin/pkg: Check whether a package is tracked in the same VCS local and remote --- bin/pkg | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/bin/pkg b/bin/pkg index ed52e78..4f2cb40 100755 --- a/bin/pkg +++ b/bin/pkg @@ -203,6 +203,10 @@ list_type () { grep ^"$1 " $PDIR/.list-remote | cut -d ' ' -f 2 } +list_type_local () { + grep ^"$1 " $PDIR/.list | cut -d ' ' -f 2 +} + list_update_remote () { if [[ "$PKG_PROTO" = 'ssh' ]] { scp -q $PKG_HOST:$(echo $PKG_ROOT | cut -d / -f 4- | sed 's!~/!!')/.list .list-remote @@ -465,8 +469,12 @@ pkg_upgrade () { check_installed $1 check_valid $1 cd $PDIR/$1 - list_incoming $1 - if [[ $? = 0 ]] { + if [[ $(list_type $1) != $(list_type_local $1) ]] { + clear_line + warn "Incompatible systems. Please reinstall: $1\n" + return 9 + } + if {list_incoming $1} { clear_line info "Updating $1 to $(list_remote_version $1)\n" vcs_upgrade -- cgit v1.2.3