summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorflorianmw2019-03-16 17:19:27 +0100
committerflorianmw2019-03-16 17:19:27 +0100
commite74a584a5f659051094e88887a0ccaa3789f86cd (patch)
treec63f13d3c7d22c5d34bf6fe4de3a9dc8af9f5b76
parent226ce5b58d6cabf98800e1739668941eb9b10f55 (diff)
downloadaur-e74a584a5f659051094e88887a0ccaa3789f86cd.tar.gz
add missing timer and autostart
-rw-r--r--.SRCINFO9
-rw-r--r--PKGBUILD15
-rw-r--r--automathemely.install40
-rw-r--r--automathemely.service8
-rw-r--r--automathemely.timer9
5 files changed, 77 insertions, 4 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 7f314ec1f516..f144921d62f8 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,14 +1,21 @@
pkgbase = automathemely
pkgdesc = Simple, set-and-forget python application for changing between GNOME themes according to light and dark hours.
pkgver = 1.3
- pkgrel = 1
+ pkgrel = 2
url = https://github.com/C2N14/AutomaThemely
+ install = automathemely.install
arch = any
license = GPL-3.0
makedepends = python-setuptools
depends = python
source = https://github.com/C2N14/AutomaThemely/archive/v1.3.tar.gz
+ source = automathemely.install
+ source = automathemely.service
+ source = automathemely.timer
sha256sums = 14e5100eb911ab8e5667a3358e1e7ed6540fd1a294ba4d451d4db480b08c3555
+ sha256sums = d89733856d5d93f93ca29ea769c6ae3e2841378c89b88fe1acd239fa7dd5026f
+ sha256sums = 6c0e4e6076f2cce0cef8c5aec79f9ea6106240051b1d556eabea4c391fe0d834
+ sha256sums = 0b39fc8abf200b1438b01deb48133817e4dc1cd6e7e41cebe7e82118ed96999e
pkgname = automathemely
depends = python
diff --git a/PKGBUILD b/PKGBUILD
index 28693473f238..51009f3592e4 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,15 +3,23 @@
pkgname=('automathemely')
_name='AutomaThemely'
pkgver='1.3'
-pkgrel=1
+pkgrel=2
pkgdesc="Simple, set-and-forget python application for changing between GNOME themes according to light and dark hours."
url="https://github.com/C2N14/AutomaThemely"
depends=('python')
makedepends=('python-setuptools')
license=('GPL-3.0')
arch=('any')
-source=("https://github.com/C2N14/${_name}/archive/v${pkgver}.tar.gz")
-sha256sums=('14e5100eb911ab8e5667a3358e1e7ed6540fd1a294ba4d451d4db480b08c3555')
+install=${pkgname}.install
+source=("https://github.com/C2N14/${_name}/archive/v${pkgver}.tar.gz"
+ ${pkgname}.install
+ ${pkgname}.service
+ ${pkgname}.timer
+)
+sha256sums=('14e5100eb911ab8e5667a3358e1e7ed6540fd1a294ba4d451d4db480b08c3555'
+ 'd89733856d5d93f93ca29ea769c6ae3e2841378c89b88fe1acd239fa7dd5026f'
+ '6c0e4e6076f2cce0cef8c5aec79f9ea6106240051b1d556eabea4c391fe0d834'
+ '0b39fc8abf200b1438b01deb48133817e4dc1cd6e7e41cebe7e82118ed96999e')
build() {
cd "${srcdir}/${_name}-${pkgver}"
@@ -22,4 +30,5 @@ package() {
depends+=('python-astral' 'python-tzlocal' 'python-schedule')
cd "${srcdir}/${_name}-${pkgver}"
python setup.py install --root="${pkgdir}" --optimize=1 --skip-build
+ install -Dm644 -t ${pkgdir}/usr/lib/systemd/user ${srcdir}/${pkgname}.service ${srcdir}/${pkgname}.timer
}
diff --git a/automathemely.install b/automathemely.install
new file mode 100644
index 000000000000..738daec35565
--- /dev/null
+++ b/automathemely.install
@@ -0,0 +1,40 @@
+post_install() {
+ # start timer for all users automatically after install
+ if systemctl --global enable automathemely.timer
+ then
+ cat <<EOM
+
+ Timer to update automathemely sun times enabled.
+ Please note that the timer only starts on a new user session.
+ To disable the timer run "systemctl disable --user automathemely.timer" as user
+
+EOM
+ else
+ cat <<EOM
+
+ Failed to enable timer to update automathemely sun times
+ To enable the timer for your user run "systemctl enable --user automathemely.timer"
+
+EOM
+ fi
+
+ # install to autostart; remove '--manage' from command
+ sed 's/\(Exec=automathemely\)\ \-\-manage/\1/'\
+ /usr/share/applications/automathemely.desktop >|\
+ /etc/xdg/autostart/automathemely.desktop
+}
+
+post_upgrade() {
+ # start timer for upgrade from less than 1.3-2
+ if [ $(vercmp $2 1.3-2) -lt 0 ]
+ then
+ post_install
+ fi
+}
+
+pre_remove() {
+ # disable the timer before remove
+ systemctl --global disable automathemely.timer
+ rm -v /etc/xdg/autostart/automathemely.desktop
+}
+
diff --git a/automathemely.service b/automathemely.service
new file mode 100644
index 000000000000..5d4b08d981b4
--- /dev/null
+++ b/automathemely.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=Update automathemely sun times daily
+After=network-online.target
+Wants=network-online.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/automathemely -u
diff --git a/automathemely.timer b/automathemely.timer
new file mode 100644
index 000000000000..89fcafc46caf
--- /dev/null
+++ b/automathemely.timer
@@ -0,0 +1,9 @@
+[Unit]
+Description=Update automathemely sun times daily
+
+[Timer]
+OnCalendar=daily
+Persistent=true
+
+[Install]
+WantedBy=timers.target