The Linux .deb package contains the rstudio binary in a non-standard location, namely /usr/lib/rstudio/rstudio. This is problematic for packaging RStudio, because package maintainers need to copy (or symlink) the binary to a standard location like /usr/bin or /usr/local/bin.
Arch Linux is currently hitting this issue. RStudio is available in the AUR, and the package maintainer basically takes the .deb package without any further modifications. This means that users cannot start RStudio: there is no desktop launcher (so RStudio is not added to the start menu – although this might have changed recently, I need to double-check), and the rstudio binary is not in the standard location, so starting from a terminal doesn't work either. The comments section is basically filled with this issue.
Is there a particular reason why the binary is located in /usr/lib/rstudio/rstudio as opposed to /usr/bin or /usr/local/bin?
For RStudio Desktop the postinstall scripts alreadycreate a symbolic link into /usr/bin that make the binary discoverable. Rstudio Desktop also contains /usr/share/applications/rstudio.desktop which should make it discoverable by any desktop launcher.
For RStudio Server there is no need to have any binary accessible to a normal user as RStudio Server is directly launched by init.d/ systemctl and the like.
Can you maybe be a bit more specific of what exactly you think is missing or not working ?
Thanks @michaelmayer! I'm asking because there has been an ongoing discussion why the Arch Linux package for RStudio Desktop does not include the /usr/bin/rstudio binary or symbolic link. The package maintainer is unresponsive, unfortunately, and an AUR maintainer told me that the problem is upstream. I see that /usr/share/applications/rstudio.desktop is included in data.tar.xz and the symlink /usr/bin/rstudio is created in the post-install script (control.tar.xz). Together with your response, this confirms that everything is fine with your package. The problem is with the AUR package, which does not create the symlink.
Indeed @cbrnr - I also now just checked and the AUR package seems to download the package unchanged, extract the tar ball and post scripts but then repackage the same with different post scripts where the symlink is missing. Our scripts can be found at https://github.com/rstudio/rstudio/tree/main/package/linux/debian-control (they are templated but it should be straightforward to deduce the intent of the variables etc...).
@michaelmayer AFAIK everything created by a post-install script is not tracked by the package manager, which can lead to orphaned files. Would you consider adding the symlink to the package data, i.e. data.tar.xz directly instead?
@cbrnr adding a link to dta.tar.xz would work but maybe it would be better to add the symlink to the postinst
script and remove it again via the postrm script, that's at least how "we" as in Posit do it.
root@9de103742078:/# dpkg -e rstudio-2023.12.0-369-amd64.deb
root@9de103742078:/# cd DEBIAN/
root@9de103742078:/DEBIAN# ls
control md5sums postinst postrm
root@9de103742078:/DEBIAN# cat postinst
#!/bin/sh
# errors shouldn't cause script to exit
set +e
# create softlink to rstudio /usr/bin
ln -f -s /usr/lib/rstudio/rstudio /usr/bin/rstudio
# clear error termination state
set -e
root@9de103742078:/DEBIAN# cat postrm
#!/bin/sh
# errors shouldn't cause script to exit
set +e
# remove softlink to rstudio
rm -f /usr/bin/rstudio
# clear error termination state
set -e
root@9de103742078:/DEBIAN#