Blob Blame History Raw
From beed0514166fa6736a53f38488663647ede1c238 Mon Sep 17 00:00:00 2001
From: Neal Gompa <ngompa13@gmail.com>
Date: Fri, 28 Oct 2016 08:56:57 -0400
Subject: [PATCH] dist: Add generic systemd units

Signed-off-by: Neal Gompa <ngompa13@gmail.com>

diff --git a/dist/snapd.autoimport.service b/dist/snapd.autoimport.service
new file mode 100644
index 0000000..2c75f15
--- /dev/null
+++ b/dist/snapd.autoimport.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Auto import assertions from block devices
+After=snapd.service snapd.socket
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/snap auto-import
+
+[Install]
+WantedBy=multi-user.target
diff --git a/dist/snapd.refresh.service b/dist/snapd.refresh.service
new file mode 100644
index 0000000..1e9325b
--- /dev/null
+++ b/dist/snapd.refresh.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Automatically refresh installed snaps
+After=network-online.target snapd.socket
+Requires=snapd.socket
+ConditionPathExistsGlob=/var/lib/snapd/snap/*/current
+Documentation=man:snap(1)
+
+# FIXME: add auto-reboot on devices
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/snap refresh
diff --git a/dist/snapd.refresh.timer b/dist/snapd.refresh.timer
new file mode 100644
index 0000000..fbc62a9
--- /dev/null
+++ b/dist/snapd.refresh.timer
@@ -0,0 +1,14 @@
+[Unit]
+Description=Timer to automatically refresh installed snaps
+
+[Timer]
+# spread the requests gently
+# https://bugs.launchpad.net/snappy/+bug/1537793
+OnCalendar=23,05,11,17:00
+RandomizedDelaySec=6h
+AccuracySec=10min
+Persistent=true
+OnStartupSec=15m
+
+[Install]
+WantedBy=timers.target
diff --git a/dist/snapd.service b/dist/snapd.service
new file mode 100644
index 0000000..9a22ba8
--- /dev/null
+++ b/dist/snapd.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Snappy daemon
+Requires=snapd.socket
+
+[Service]
+ExecStart=/usr/libexec/snapd/snapd
+EnvironmentFile=-/etc/sysconfig/snapd
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
diff --git a/dist/snapd.socket b/dist/snapd.socket
new file mode 100644
index 0000000..6460599
--- /dev/null
+++ b/dist/snapd.socket
@@ -0,0 +1,13 @@
+[Unit]
+Description=Socket activation for snappy daemon
+
+[Socket]
+ListenStream=/run/snapd.socket
+ListenStream=/run/snapd-snap.socket
+SocketMode=0666
+# these are the defaults, but can't hurt to specify them anyway:
+SocketUser=root
+SocketGroup=root
+
+[Install]
+WantedBy=sockets.target
-- 
2.8.4 (Apple Git-73)