mirror of
https://github.com/pigmonkey/spark.git
synced 2026-01-23 02:24:09 +00:00
replace sleep lock script with a systemd unit
Existing users should delete the old script.
# rm /usr/lib/systemd/system-sleep/lock.sh
This commit is contained in:
parent
5177a67809
commit
033ba2fbd0
4 changed files with 21 additions and 10 deletions
13
roles/screensaver/files/screenlock.service
Normal file
13
roles/screensaver/files/screenlock.service
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
[Unit]
|
||||
Description=Screen lock
|
||||
Before=sleep.target
|
||||
|
||||
[Service]
|
||||
User=%I
|
||||
Type=forking
|
||||
Environment=DISPLAY=:0
|
||||
ExecStart=/usr/local/bin/lock
|
||||
ExecStartPost=/usr/bin/sleep 1
|
||||
|
||||
[Install]
|
||||
WantedBy=sleep.target
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
#!/bin/bash
|
||||
# {{ ansible_managed }}
|
||||
|
||||
if [ "$1" = "post" ]; then
|
||||
/usr/local/bin/lock
|
||||
fi
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- { role: base }
|
||||
- { role: x }
|
||||
- { role: systemd }
|
||||
|
|
|
|||
|
|
@ -10,5 +10,10 @@
|
|||
- name: Push lock script
|
||||
copy: src=lock.sh dest=/usr/local/bin/lock mode=0755
|
||||
|
||||
- name: Push sleep lock script
|
||||
copy: src=sleeplock.sh dest=/usr/lib/systemd/system-sleep/lock.sh mode=0755
|
||||
- name: Push screen lock service file
|
||||
copy: src=screenlock.service dest=/etc/systemd/system/screenlock@.service
|
||||
notify:
|
||||
- reload systemd config
|
||||
|
||||
- name: Enable screen lock service
|
||||
service: name="screenlock@{{ user.name }}.service" enabled=yes
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue