fix bugs: old dirs not removed when pkgdel and upgrade package

This commit is contained in:
emmett1
2019-05-26 14:55:52 +08:00
parent 176457e9cc
commit 8aef7115c6
2 changed files with 2 additions and 2 deletions

2
pkgadd
View File

@@ -286,7 +286,7 @@ if [ "$UPGRADE_PKG" ] || [ "$REINSTALL_PKG" ]; then
rm "$ROOT_DIR/$line" &>/dev/null
done
grep '/$' $TMP_PKGADD_RMLIST | tac | while read line; do
if [ ! "$(grep -R --exclude-dir="$name" -w "$line" "$INDEX_DIR"/*/.files)" ]; then
if [ ! "$(grep -Rx "$line" "$INDEX_DIR"/*/.files | grep -v "$INDEX_DIR"/$name)" ]; then
[ "$VERBOSE_INSTALL" = yes ] && echo "- $line"
rmdir "$ROOT_DIR/$line" &>/dev/null
fi

2
pkgdel
View File

@@ -175,7 +175,7 @@ while read -r line; do
done < <(tac $INDEX_DIR/$name/.files | grep -v '/$')
while read -r line; do
if [ ! "$(grep -R --exclude-dir="$name" -w "$line" "$INDEX_DIR"/*/.files)" ]; then
if [ ! "$(grep -Rx "$line" "$INDEX_DIR"/*/.files | grep -v "$INDEX_DIR"/$name)" ]; then
if [ -d "$ROOT_DIR/$line" ]; then
[ "$VERBOSE_REMOVE" = yes ] && echo "- $line"
rmdir "$ROOT_DIR/$line"