I started a little project. I want to have a different default desktop environment selected in GDM (log-in screen) depending on whether I am running it on a hypervisor or simply baremetal. I have already created a script that has the basic logic to detect how it's being run, then changes the default entry appropriately. What I am concerned with is automatically running this script on startup, which swaps the value of XSession in /var/lib/AccountsService/users/jeremy to either gnome or gnome-classic (refer to this for more info). I have several questions regarding this:
How should I properly create the
.servicefile to make sure my script (located at/opt/DetectENV/switcher.sh) gets executed before theAccountsServiceloads during startup? (I am using Fedora 30 Workstation if that helps)Where is the best place to put this
.servicefile? Not sure if it should be/etc/systemd/system/or/etc/systemd/user.