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:
Pig Monkey 2016-04-08 20:47:32 -07:00
parent 5177a67809
commit 033ba2fbd0
4 changed files with 21 additions and 10 deletions

View 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

View file

@ -1,6 +0,0 @@
#!/bin/bash
# {{ ansible_managed }}
if [ "$1" = "post" ]; then
/usr/local/bin/lock
fi

View file

@ -1,4 +1,3 @@
---
dependencies:
- { role: base }
- { role: x }
- { role: systemd }

View file

@ -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