commit:     3eff40a18e315d09bcae43de2d9edb93c6c76aa4
Author:     Florian Schmaus <flow <AT> gentoo <DOT> org>
AuthorDate: Mon Jan  1 18:57:09 2024 +0000
Commit:     Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Mon Jan  1 18:58:01 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3eff40a1

app-shells/atuin: install systemd service and shell inits

Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>

 ...{atuin-17.1.0.ebuild => atuin-17.1.0-r1.ebuild} | 26 ++++++++++++++++++++--
 app-shells/atuin/files/atuin.service               | 10 +++++++++
 2 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/app-shells/atuin/atuin-17.1.0.ebuild 
b/app-shells/atuin/atuin-17.1.0-r1.ebuild
similarity index 92%
rename from app-shells/atuin/atuin-17.1.0.ebuild
rename to app-shells/atuin/atuin-17.1.0-r1.ebuild
index b4c1180a83f9..73e7165fe160 100644
--- a/app-shells/atuin/atuin-17.1.0.ebuild
+++ b/app-shells/atuin/atuin-17.1.0-r1.ebuild
@@ -423,7 +423,7 @@ CRATES="
        [email protected]
 "
 
-inherit cargo shell-completion
+inherit cargo shell-completion systemd readme.gentoo-r1
 
 DESCRIPTION="Shell history manager supporting encrypted synchronisation"
 HOMEPAGE="https://atuin.sh https://github.com/atuinsh/atuin";
@@ -444,6 +444,7 @@ REQUIRED_USE="
        sync? ( client )
        test? ( client server sync )
 "
+RDEPEND="server? ( acct-user/atuin )"
 BDEPEND=">=virtual/rust-1.71.0"
 
 QA_FLAGS_IGNORED="usr/bin/${PN}"
@@ -484,13 +485,20 @@ src_compile() {
                                         -o completions \
                        || die
        done
+
+       mkdir shell-init || die
+       for shell in bash fish zsh; do
+               "${ATUIN_BIN}" init ${shell} > shell-init/${shell} || die
+       done
 }
 
 src_install() {
        exeinto "/usr/bin"
        doexe "${ATUIN_BIN}"
 
-       if ! use server; then
+       if use server; then
+               systemd_dounit "${FILESDIR}/atuin.service"
+       else
                rm -r "docs/docs/self-hosting" || die
        fi
 
@@ -499,4 +507,18 @@ src_install() {
        newbashcomp "completions/${PN}.bash" "${PN}"
        dozshcomp "completions/_${PN}"
        dofishcomp "completions/${PN}.fish"
+
+       insinto "/usr/share/${PN}"
+       doins -r shell-init
+
+       local DOC_CONTENTS="Gentoo installs atuin's shell-init code under
+                 /usr/share/atuin/shell-init/.
+                 Therefore, instead of using, e.g., 'eval \"\$(atuin init 
zsh)\"' in
+                 your .zshrc you can simply put \"source 
/usr/share/atuin/shell-init/zsh\"
+                 there, which avoids the cost of forking a process."
+       readme.gentoo_create_doc
+}
+
+pkg_postinst() {
+       readme.gentoo_print_elog
 }

diff --git a/app-shells/atuin/files/atuin.service 
b/app-shells/atuin/files/atuin.service
new file mode 100644
index 000000000000..6408e142b1a5
--- /dev/null
+++ b/app-shells/atuin/files/atuin.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Atuin (shell history manager) server
+After=network.target
+
+[Service]
+ExecStart=/usr/bin/atuin server start
+User=atuin
+
+[Install]
+WantedBy=default.target

Reply via email to