I am on Linux Mint 19.3 and would like to make the TeamViewer systemd service only run when I launch the GUI app (/opt/teamviewer/tv_bin/script/teamviewer). On Windows, this is fairly easy to do from the Services dialog by selecting the TeamViewer and changing its "Startup Type" from "Automatic" to "Manual".
In Linux, I have TeamViewer 15 (installed via deb file from official site). I am seeing that the systemd service file has:
$ cat /etc/systemd/system/teamviewerd.service
[Unit]
Description = TeamViewer remote control daemon
After = network.target network-online.target dbus.service
Wants = network-online.target
Requires = dbus.service
[Service]
Type = forking
PIDFile = /var/run/teamviewerd.pid
ExecStart = /opt/teamviewer/tv_bin/teamviewerd -d
Restart = on-abort
StartLimitInterval = 60
StartLimitBurst = 10
[Install]
WantedBy = multi-user.target
and the service autostarts during login which I don't want. I don't mind hacking out a new bash script to start the service just before launching the gui but I'm not great with editing systemd services and had a concern about new versions overwriting my changes.
Questions:
I could probably just remove the service file and use a bash wrapper script just before/after the gui process starts/ends vs just launching its 'ExecStart' args directly. BUT... seems like this could be bad if the gui process were to interface with the service process using systemd calls... If I were going to keep the systemd service file around for better compat, is there a way to configure the service file to still have the service enabled but NOT to run on startup but still allow it to be manually controlled via
sudo systemctl [start|stop] teamviewerd?Is there a way in
aptto specify a post-install script for a particular package. (e.g. whenaptetc installs a new version of teamviewer which presumably reinstalls the systemd service and *.desktop files, I would like to have it automatically run a script to "fix" those things). I saw this and this and get that I would need something like/etc/apt/apt.conf.d/custom-hookswith a path to a script but not seeing how to: a) pass a list of last installed packages or b) find out which packages were just installed by apt. Is there a more elegant way to do things than capturing a list in the PRE hook and then recapturing and checking for changes in the POST hook?Is there a more elegant approach that I have not considered?