Filter / add_action to upgrade.php page

Well, the first lines of that file, not counting comments/headers, are…

/** Include user install customize script. */
if ( file_exists(WP_CONTENT_DIR . '/install.php') )
   require (WP_CONTENT_DIR . '/install.php');

You could include a custom install script with the rest of your code. That seems the most straightforward approach to me. It is hard to say a lot more as you haven’t said what you want to do in much detail.