When run with sudo ... the resulting AppImage has root as its owner
When AppImageUpdate is run with sudo (as I need to do in order to update things in /isodevice (the device Ubuntu mounts the medium on which the Live ISO resides to), then the resulting "new" AppImage has root as its owner, which is not what we want.
Hence, we should run sudo -R $USER $New.AppImage at the end.
$USER == root if sudo is used.
No:
me@host:~$ sudo echo $USER
me
Try on Debian, and you'll see what I mean.
I have tried on Ubuntu. Here sudo chown $USER $New.AppImage would help and on Debian it would not make things worse. So let's just do it
Please research a bit more on the topic. IIRC there's a variable sudo exports that shows the original user. But this seems quite implicit...
Did you mean to write chown -R ...? (That -R is by the way not necessary)
Sure, I meant sudo chown "${USER}" ..., corrected above.
Shouldn't we just add a flag to copy the old owner and their permissions? Like -p or so? Changing owner would only work properly when you call it with sudo, and it's less implicit than using $SUDO_USER.
Or maybe we should just do that by default? Not a fan, but perhaps this is desirable for some people.
Copy the old owner and their permissions Or maybe we should just do that by default?
Yes, absolutely. Copy over owner and permissions from the old to the new file.
But only if a flag is passed, at least for zsync2, for AppImageUpdate I'd consider adding a pre-checked checkbox to create an opt-out.
Yes :+1:
@TheAssassin
$USER == rootifsudois used.
@probonopd No:
me@host:~$ sudo echo $USER me
Variable substitution is performed by the shell (which is not root) before arguments are passed to the sudo command. Try this instead:
me@host:~$ sudo bash -c 'echo $USER'
root
Note the ' single quotes, which escape the contents.
Indeed, it would not work with " double quotes. (It would return "me" instead of "root".)