Skip to content

Yay should ask for password at start of install not end #2621

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
htx80nerd opened this issue May 9, 2025 · 3 comments
Open

Yay should ask for password at start of install not end #2621

htx80nerd opened this issue May 9, 2025 · 3 comments

Comments

@htx80nerd
Copy link

Asking for the password should be one of the first steps during an install not one of the last.

Just now I install mullvad vpn, which is a very long install process. Naturally I step away from the PC or go to another window. Then when I come back install has 'failed' because I did not enter the password. It would be a lot better if yay asked for password when you start an install not the end.

@AlanDavison
Copy link

AlanDavison commented May 12, 2025

I might be incorrect here, but isn't it Pacman which is asking for the password? If that's true, it would mean Yay would need to keep the password somewhere (probably just in-memory) and find a way to feed it into Pacman when it calls for it, right?

I can't imagine there's going to be a nice way around that, at least with my understanding.

@YashRajCodes
Copy link

@AlanDavison A better way would probably be to increase the sudo timeout before it asks for the password again
you can add the following to the sudoers file to increase the timeout for just pacman

Defaults!/usr/bin/pacman timestamp_timeout=60

@elig0n
Copy link

elig0n commented May 20, 2025

Personally I insert the path to a custom shell script under "sudobin" key in ~/.config/yay/config.json with something like the following:

# check if credentials are needed and prompt the user to continue
function check_sudo() {
    if
        sudo -n -i : &> /dev/null;
    then
        return 0 # sudo is not needed, installation will proceed normally
    else
        abeep -f 400 -l 250 & # sound a beep
        notify_user & # raise a notification message

        echo "Press enter to continue to sudo"
        builtin read -r
    fi
}

function main() {
    check_sudo
}

main "$@"

When the shell script then determines that sudo is needed it beeps, X notifies the user & show a prompt that require hitting Enter before actually running sudo thus allowing for a finished build to wait infinitely until the user gets back to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants