I often use the following construct for building and installing a tarball:
sudo -v && make && sudo make install
which will allow me to enter my password immediately and have everything done unattended. This works well except in the rare case that building takes longer than the
sudo timeout, which may happen on my rather slow machine with large projects (even when using
But when the build takes a long time, that's exactly when doing things unattended has a great advantage. Can anyone think of a shell construct that allows me to input my password immediately, and which has
make executing under normal permissions and
make install under elevated permissions?
For security reasons, I don't want to configure my user to use
sudo without password.
A viable option is to set the timeout to very long, but I'm hoping for something more elegant.