upgrade-from: Setting dir before calling common_setup

common_setup rely on dir variable. It was setup too late and generates
weird behaviours.