# ============= Deinstallation of a package for an origin =============
deinstall_exec ()
{
- local origin origin_regexp currentpkg backup_pkgdir backup_pkg
+ local origin origin_regexp currentpkg backup_pkgdir backup_pkg pkg
origin=$1
origin_regexp=`str_escape_regexp "$origin"`
grep -v -E "^${origin_regexp}[[:space:]]" "${DBDIR}/deleted_conflicts" > ${DBDIR}/deleted_conflicts.tmp || :
mv "${DBDIR}/deleted_conflicts.tmp" "${DBDIR}/deleted_conflicts"
- currentpkg=`pkg_info_qO "$origin" 2> /dev/null`
+ currentpkg=`pkg_info_qO "$origin" 2> /dev/null | tr '\n' ' '`
[ -n "$currentpkg" ] || return 0
temp_set_msg_current_stage "a ${_MSG_CURRENT_STAGE_general} process for $origin ($currentpkg) $PROGRAM_STEP_COUNTER"
database_query_get_target_attributes currentorigin "$origin"
backup_pkgdir=${PKGREPOSITORY}
fi
[ -d "$backup_pkgdir" ] || mkdir -p "$backup_pkgdir"
- backup_pkg=`pkgsys_create_backup_pkg "$currentpkg" "$backup_pkgdir"` || :
+ pkg=`echo "$currentpkg" | tr ' ' '\n' | grep -v '^$' | tail -n 1`
+ backup_pkg=`pkgsys_create_backup_pkg "$pkg" "$backup_pkgdir"` || :
if [ -n "$backup_pkg" ]
then
message_echo "INFO: The backup is saved at $backup_pkg."
fi
fi
message_echo "-- (Deleting package for $origin as $currentpkg)"
- if ! pkg_delete_f "$currentpkg"
- then
- message_echo "*** Continuating forcibly by hoping success..."
- message_echo
- temp_set_msg_current_stage "${_MSG_CURRENT_STAGE_general}"
- return
- fi
+ echo "$REINSTALL_CURRENTPKG" | tr ' ' '\n' | grep -v '^$' | while read pkg
+ do
+ if ! pkg_delete_f "$currentpkg"
+ then
+ message_echo "*** Continuating forcibly by hoping success..."
+ fi
+ done
temp_set_msg_current_stage "${_MSG_CURRENT_STAGE_general}"
message_echo
}