Skip to content

Prep Only and Unprivileged installs

RedBearAK edited this page Jun 3, 2024 · 2 revisions

How to use the "prep-only" setup command

The setup script will now have an option to do a prep-only install. Unlike the install command, does not actually set up all of Toshy's components and services for the user running the setup script. The purpose of this is to allow an "admin" user with the ability to use sudo commands to "prep" the system by performing the supporting actions that require sudo, such as native package installs that support building the user's Python virtual environment folder from which the keymapper runs. The object is to leave the system in a state where an unprivileged user will be able to install Toshy without needing to use sudo commands.

This special command is completely unnecessary if you also want the "admin" user to have Toshy installed, in which case you can just run the usual install command as the admin user, and any unprivileged user on the system will also be able to install Toshy, even if they can't use sudo. But this must be done in a full graphical session (currently). If that is not practical or convenient, the prep-only command can be used as a replacement for install and invoked from a su --login adminuser shell, without needing to log out of the current (possibly unprivileged) user session and log into the admin user's desktop session.

One little catch with the su --login adminuser scenario is that you'll need to find a way to get the Toshy folder into the admin user's home folder, because when doing su --login the shell won't see the local files of the user calling the su --login. One option is just downloading the file into the admin user's Downloads with wget, another is using sudo from the admin user to copy the zip file from the unprivileged user's Downloads folder. It's probably simplest to just use wget to make a second download of the zip file in the admin user's account.

If you use su without --login, you'll end up with a permission error as the setup script tries to access the temporary files location of the wrong user. Won't work.

Here's is how the prep-only sequence would work.

su --login adminuser
wget https://github.com/RedBearAK/toshy/archive/refs/heads/main.zip
unzip main.zip
rm main.zip
cd toshy-main
./setup_toshy.py prep-only

Once that completes, exit the admin user's shell.

exit

Now we're back in the original user's shell, and we can run the regular Toshy install command, and respond with "n" when asked if the user is an admin user. This will start the "unprivileged" install sequence.

./setup_toshy.py install

Once the install is finished, if Toshy doesn't work right away then most likely you will need to get the admin user to run a command like this to put the unprivileged user in the input group:

sudo usermod -aG input nonadminuser

Then either log out of the nonadminuser account, or restart the system.

For a Wayland+GNOME session, each user still needs a compatible shell extension installed.

See Requirements in the README.

How to do an "unprivileged" install of Toshy

The setup script will now ask if the user is an admin (a user that can run sudo commands), and if your response is negative, the script will communicate that it is possible to do an unprivileged install. This unprivileged install will work as long as some "admin" user has done the preparatory steps such as (A) a full install of Toshy in their own graphical session, or (B) used the prep-only command sequence described in the above section (which can be done if desired via su --login adminuser).

To invoke the unprivileged install just answer "n" when asked if your user is an admin user, and then enter the code that confirms you've actually read and understood some of the text displayed in the terminal. (Hopefully this means you've already undertaken the "admin" install steps described in the section above.)

That's it. Or, it will be if you are on a distro where uaccess tags in the udev rules file will work. Otherwise, you may need to still find a way to add your unprivileged user to the input group, or the keymapper won't have access to the necessary devices.