The recommended and supported way for doing system upgrades is through HAM. HAM is not just a front-end to apt-get, it takes care of additional stuff(which I am not going to describe here).
However, I don't know why maemo-optify-runonce is not installed on your system, but both -generic-pr and -community-pr depend on it, so you should either find a way to install it or reflash. You may try to create "/targets/links/scratchbox.config" on your device and try to install maemo-optify-runonce. Didn't test that, just an idea. Don't forget to remove it afterwards.