How can a plugin find where it is itself located?
You need to expand() <sfile>. Assuming your code resides in myplug/plugin/<somefile.vim>:
# the first :h is to skip the script name;
# the second is to skip "plugin/" part
let s:mydefaultdir = expand("<sfile>:h:h") . "/mydefaultdir"
let g:scriptdir = get(g:, 'scriptdir', s:mydefaultdir)...
how to load vim8 optional packages in vimrc?
The way to load vim8 optional packages in your vimrc is to use the :packadd! command, which will add them to your 'runtimepath', which will make the opt plugins load together with the ones in start.
In your particular case:
The examples you give hint that what you're actually trying to ...
Pathogen will not manage (update, install, etc.) your plugins for you. You have to do that yourself.
And a good way to do that yourself is to install plugins simply by cloning their Git repos to the ~/.vim/bundle folder. Then you can update them with one-line loops. For example in Bash you could do this:
for i in ~/.vim/bundle/*; do git -C $i pull; done