mrworf / plexupdate

Plex Update script to simplify the life of Linux Plex Media Server users.
GNU General Public License v2.0
1.77k stars 146 forks source link

install.sh script has a small logic bug #288

Closed PabluskiNC closed 3 years ago

PabluskiNC commented 3 years ago

Line 322: Currently: elif [ ! -z "$SUDO_USER" ]; then

Should be: elif [ -z "$SUDO_USER" ]; then

demonbane commented 3 years ago

That is correct as it is. It could be rewritten with a -n instead of ! -z but the logic is correct. It's testing to see if you launched the script as sudo (which you should not do). If SUDO_USER is not empty, that means that you are running as sudo so we throw an error and abort.

PabluskiNC commented 3 years ago

I see.

I did a “sudo bash” to get the root prompt, since in ubuntu it is customary to not login to root directly…

I tweaked it work in my environment – and it did a the job.

Thanks for responding.

Thanks for the code, as well.

-PabluskiNC

From: Alex Malinovich @. Sent: Tuesday, June 15, 2021 9:30 PM To: mrworf/plexupdate @.> Cc: PabluskiNC @.>; Author @.> Subject: Re: [mrworf/plexupdate] install.sh script has a small logic bug (#288)

That is correct as it is. It could be rewritten with a -n instead of ! -z but the logic is correct. It's testing to see if you launched the script as sudo (which you should not do). If SUDO_USER is not empty, that means that you are running as sudo so we throw an error and abort.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mrworf/plexupdate/issues/288#issuecomment-861940498 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7NHRT2RPUFID7EQICFBVDTS75A3ANCNFSM46YK3WGA . https://github.com/notifications/beacon/AA7NHRTXS4DJTHBPNBVE7KDTS75A3A5CNFSM46YK3WGKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOGNQCWEQ.gif

demonbane commented 3 years ago

Did you try running it without sudo? If you just run it from a regular user shell (not sudo bash) it will automatically ask you for sudo permissions when it needs it and everything should work fine. If you were having a problem with that not happening, that could be a separate issue. If not, and you modified the line as you described above, you've probably ended up installing as root which isn't strictly a problem, but not the way it's intended to be installed.