Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1 | # This is a system unit for launching Weston with auto-login as the |
| 2 | # user configured here. |
| 3 | # |
| 4 | # Weston must be built with systemd support, and your weston.ini must load |
| 5 | # the plugin systemd-notify.so. |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 6 | [Unit] |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 7 | Description=Weston, a Wayland compositor, as a system service |
| 8 | Documentation=man:weston(1) man:weston.ini(5) |
| 9 | Documentation=http://wayland.freedesktop.org/ |
| 10 | |
| 11 | # Make sure we are started after logins are permitted. |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 12 | Requires=systemd-user-sessions.service |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 13 | After=systemd-user-sessions.service |
| 14 | |
| 15 | # If Plymouth is used, we want to start when it is on its way out. |
| 16 | After=plymouth-quit-wait.service |
| 17 | |
| 18 | # D-Bus is necessary for contacting logind. Logind is required. |
| 19 | Wants=dbus.socket |
| 20 | After=dbus.socket |
| 21 | |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 22 | # Ensure the socket is present |
| 23 | Requires=weston.socket |
| 24 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 25 | # Since we are part of the graphical session, make sure we are started before |
| 26 | # it is complete. |
| 27 | Before=graphical.target |
| 28 | |
| 29 | # Prevent starting on systems without virtual consoles, Weston requires one |
| 30 | # for now. |
| 31 | ConditionPathExists=/dev/tty0 |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 32 | |
| 33 | [Service] |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 34 | # Requires systemd-notify.so Weston plugin. |
| 35 | Type=notify |
Andrew Geissler | f034379 | 2020-11-18 10:42:21 -0600 | [diff] [blame] | 36 | EnvironmentFile=/etc/default/weston |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 37 | ExecStart=/usr/bin/weston --modules=systemd-notify.so |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 38 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 39 | # Optional watchdog setup |
| 40 | TimeoutStartSec=60 |
| 41 | WatchdogSec=20 |
| 42 | |
| 43 | # The user to run Weston as. |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 44 | User=weston |
| 45 | Group=weston |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 46 | |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 47 | # Make sure the working directory is the users home directory |
| 48 | WorkingDirectory=/home/weston |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 49 | |
| 50 | # Set up a full user session for the user, required by Weston. |
| 51 | PAMName=weston-autologin |
| 52 | |
| 53 | # A virtual terminal is needed. |
| 54 | TTYPath=/dev/tty7 |
| 55 | TTYReset=yes |
| 56 | TTYVHangup=yes |
| 57 | TTYVTDisallocate=yes |
| 58 | |
| 59 | # Fail to start if not controlling the tty. |
| 60 | StandardInput=tty-fail |
| 61 | StandardOutput=journal |
| 62 | StandardError=journal |
| 63 | |
| 64 | # Log this user with utmp, letting it show up with commands 'w' and 'who'. |
| 65 | UtmpIdentifier=tty7 |
| 66 | UtmpMode=user |
| 67 | |
| 68 | [Install] |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 69 | # Note: If you only want weston to start on-demand, remove this line with a |
| 70 | # service drop file |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 71 | WantedBy=graphical.target |