rhysd / go-github-selfupdate

Binary self-update mechanism for Go commands using GitHub
https://godoc.org/github.com/rhysd/go-github-selfupdate/selfupdate
MIT License
593 stars 75 forks source link

Root privileges required #54

Open FrenchGithubUser opened 1 year ago

FrenchGithubUser commented 1 year ago

This package works pretty well, thanks for developing it !

But whenthe binary is in a folder that requires admin/root rights to write in like /usr/bin/ or in windows' programs folder, the update fails. Here is the error I get on linux : Error occurred while updating binary: open /usr/bin/.hatt.new: permission denied (the name of my program is hatt)

I was wondering how this issue should be addressed (ask the user for admin rights ? if so, how ? something else ?

servusdei2018 commented 1 year ago

You could invoke the program with sudo to grant it the required privileges. For example, if you have a update subcommand to invoke the self updating behavior, you could run sudo hatt update.