Browse Source

barrier unlock lockscreen service

pull/1/head
parent
commit
caf27f2974
3 changed files with 25 additions and 4 deletions
  1. +6
    -0
      tasks/barrier.yaml
  2. +2
    -4
      templates/barrier/barrier-ssh-connection@.service.j2
  3. +17
    -0
      templates/barrier/barrier-unlock-lockscreen.service.j2

+ 6
- 0
tasks/barrier.yaml View File

@@ -63,6 +63,12 @@
dest: ~/.config/systemd/user/barrierc@.service
notify: systemd daemon-reload

- name: barrier unlock lockscreen service
template:
src: barrier/barrier-unlock-lockscreen.service.j2
dest: ~/.config/systemd/user/barrier-unlock-lockscreen.service
notify: systemd daemon-reload

- name: barrier ssh conection user service
template:
src: barrier/barrier-ssh-connection@.service.j2


+ 2
- 4
templates/barrier/barrier-ssh-connection@.service.j2 View File

@@ -7,10 +7,8 @@ PartOf=graphical-session.target
[Service]
Type=simple
ExecStart=sh -c "sleep infinity | ssh $@" ssh -R 24800:localhost:24800 %i\
systemctl --user stop lockscreen.service;\
systemctl --user start barrierc@localhost.service;\
systemd-run --user -u lockscreen-barrier-unlock sh -c "\"cat < lock > /dev/null; systemctl --user start lockscreen.service; systemctl --user stop barrierc@localhost.service;\"";\
exec cat > lock
systemctl --user --wait restart barrier-unlock-lockscreen.service;\
exec cat > .barrier-unlock-lockscreen.fifo

[Install]
WantedBy=graphical-session.target

+ 17
- 0
templates/barrier/barrier-unlock-lockscreen.service.j2 View File

@@ -0,0 +1,17 @@
{{ ansible_managed | comment }}

[Unit]
Description=barrier unlock lockscreen until pipe is closed
PartOf=graphical-session.target

[Service]
Type=simple
ExecStartPre=fish -c "not test -p .barrier-unlock-lockscreen.fifo && mkfifo .barrier-unlock-lockscreen.fifo; test -p .barrier-unlock-lockscreen.fifo"
ExecStartPost=systemctl --user stop lockscreen.service
ExecStartPost=systemctl --user start barrierc@localhost.service
ExecStart=sh -c "cat < .barrier-unlock-lockscreen.fifo"
ExecStopPost=systemctl --user start lockscreen.service
ExecStopPost=systemctl --user stop barrierc@localhost.service

[Install]
WantedBy=graphical-session.target