make upgrade run in context of current shell, fix #1527