[packages/tmux] add systemd unit for autostarting tmux session

atler atler at pld-linux.org
Wed May 6 11:22:30 CEST 2020


commit 095bed5248926aa136dbd54cfff3762abe953089
Author: Jan Palus <atler at pld-linux.org>
Date:   Wed May 6 11:20:56 2020 +0200

    add systemd unit for autostarting tmux session
    
    inspired by arch's wiki page

 tmux.spec     |  4 ++++
 tmux at .service | 11 +++++++++++
 2 files changed, 15 insertions(+)
---
diff --git a/tmux.spec b/tmux.spec
index 43bbee1..a83903d 100644
--- a/tmux.spec
+++ b/tmux.spec
@@ -16,6 +16,7 @@ Source2:	https://raw.githubusercontent.com/keith/tmux.vim/master/syntax/tmux.vim
 # Source2-md5:	cd1169a1757b515b5c57816d339c6f72
 Source3:	https://raw.githubusercontent.com/imomaliev/tmux-bash-completion/master/completions/tmux
 # Source3-md5:	6d65c0f42c74f61602a399d7bb04a85c
+Source4:	tmux at .service
 URL:		http://tmux.github.io/
 BuildRequires:	libevent-devel
 BuildRequires:	libutempter-devel
@@ -91,6 +92,8 @@ install %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/vim/vimfiles/ftdetect/tmux.vim
 install %{SOURCE2} $RPM_BUILD_ROOT%{_datadir}/vim/vimfiles/syntax
 install -d $RPM_BUILD_ROOT%{bash_compdir}
 sed -e '1s,#!/usr/bin/env bash,#!/bin/bash,' %{SOURCE3} > $RPM_BUILD_ROOT%{bash_compdir}/%{name}
+install -d $RPM_BUILD_ROOT%{systemdunitdir}
+install %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -100,6 +103,7 @@ rm -rf $RPM_BUILD_ROOT
 %doc CHANGES COPYING README
 %attr(755,root,root) %{_bindir}/tmux
 %{_mandir}/man1/tmux.1*
+%{systemdunitdir}/tmux at .service
 
 %files -n vim-syntax-tmux
 %defattr(644,root,root,755)
diff --git a/tmux at .service b/tmux at .service
new file mode 100644
index 0000000..0234a2d
--- /dev/null
+++ b/tmux at .service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Start tmux in detached session
+
+[Service]
+Type=forking
+User=%I
+ExecStart=/usr/bin/tmux new-session -s %u -d
+ExecStop=/usr/bin/tmux kill-session -t %u
+
+[Install]
+WantedBy=multi-user.target
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/tmux.git/commitdiff/095bed5248926aa136dbd54cfff3762abe953089



More information about the pld-cvs-commit mailing list