My goal is to successfully link a folder to /opt/ directory- which needs to be run with sudo.
I have tried this:
system(sudo ln -s $$OUT_PWD/xampp /opt/lampp):message("You should manually link LAMPP")
But building from qt-creator it does not prompt for sudo password, therefore I couldn't get it to link the folder. I got the "wrong password attempts..." error in the Compiler Output. Then I tried these with build steps:
make
sudo make install
to see if it would prompt me there, but it failed on make install
step with the same error, which is this in detail:
00:31:20: Starting: "/usr/bin/sudo" make install
sudo: no tty present and no askpass program specified
sudo: no tty present and no askpass program specified
Sorry, try again.
sudo: no tty present and no askpass program specified
sudo: no tty present and no askpass program specified
Sorry, try again.
sudo: no tty present and no askpass program specified
sudo: no tty present and no askpass program specified
Sorry, try again.
sudo: 3 incorrect password attempts
00:31:20: The process "/usr/bin/sudo" exited with code 1.
The system()
function in the qmake script works fine when I use qmake && make && make install
from terminal since it prompts me before sudo ln...
command; but for fast testing purposes I feel that building with CTRL-B inside Qt Creator should also work with sudo commands...
Is there a way to be prompted from Qt Creator, or a way around this? Like storing the sudo pass within the Qt Creator (although it is risky)... Or maybe making it run build steps on a terminal where it would prompt me? Would prompt()
function in qmake work with gathering sudo passwords?
Any suggestions are welcome...