Do sudo stuff in one go. Open/close pkg db less.

Should save time and user hassle.