summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2019-04-06 23:32:50 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2019-04-07 00:22:06 -0400
commitbceda71815e5748814186e0b9edca329b67e678b (patch)
treea2c3dd636760c8eceba69652df155dba73acb718
parentedaf4dc4793daf8e50e18470409954fb20169a4c (diff)
parablaweb-update: Properly restart the service
-rw-r--r--.gitignore1
-rw-r--r--10-parabolaweb.sudoers.in2
-rw-r--r--Makefile14
-rw-r--r--depends_static.txt1
-rw-r--r--parabolaweb-update.in4
5 files changed, 18 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
index 69423a9..9236b74 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,7 @@ parabolaweb*
!parabolaweb.conf
!parabolaweb.ini
!parabolaweb*.timer
+10-parabolaweb.sudoers
.tmp.*
.var.*
diff --git a/10-parabolaweb.sudoers.in b/10-parabolaweb.sudoers.in
new file mode 100644
index 0000000..6e64069
--- /dev/null
+++ b/10-parabolaweb.sudoers.in
@@ -0,0 +1,2 @@
+# SUDO_USERS HOSTS=(AS_USER) TAGS COMMANDS
+@webuser@ ALL=(ALL) NOPASSWD: systemctl stop uwsgi@parabolaweb.service
diff --git a/Makefile b/Makefile
index 7e402c6..d1db389 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-# Copyright (c) 2012-2014, 2016-2018 Luke Shumaker <lukeshu@parabola.nu>
+# Copyright (c) 2012-2014, 2016-2019 Luke Shumaker <lukeshu@parabola.nu>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,6 +27,7 @@ systemddir = $(prefix)/lib/systemd/system
uwsgidir = /etc/uwsgi
pkglibexecdir = $(libexecdir)/parabolaweb-utils
pkgconffile = $(sysconfdir)/parabolaweb
+sudoersdir = /etc/sudoers.d
webuser = parabolaweb
@@ -46,9 +47,10 @@ targets = \
$(systemddir)/parabolaweb-reporead-inotify.service \
$(systemddir)/parabolaweb-reporead-rsync.service \
$(systemddir)/parabolaweb-reporead-rsync.timer \
- $(uwsgidir)/parabolaweb.ini
+ $(uwsgidir)/parabolaweb.ini \
+ $(sudoersdir)/10-parabolaweb
-files.out.all = depends.txt $(filter-out $(files.src.src),$(notdir $(targets)))
+files.out.all = depends.txt $(filter-out $(files.src.src),$(notdir $(patsubst $(sudoersdir)/%,%.sudoers,$(targets))))
files.sys.all = $(targets) $(pkgconffile)
# Pattern rules
@@ -74,6 +76,12 @@ $(DESTDIR)$(systemddir)/%.timer: %.timer
$(DESTDIR)$(uwsgidir)/%: %
install -Dm644 $< $@
+$(DESTDIR)$(sudoersdir)/%: %.sudoers | $(DESTDIR)$(sudoersdir)
+ install -Dm644 $< $@
+
+$(DESTDIR)$(sudoersdir):
+ install -dm750 $@
+
# Specific rules
depends.txt: list-depends depends_static.txt
diff --git a/depends_static.txt b/depends_static.txt
index a27e211..a2704a2 100644
--- a/depends_static.txt
+++ b/depends_static.txt
@@ -2,4 +2,5 @@ gitget # for parabolaweb-update
librelib # for libremessages, used in parabolaweb-update
postgresql # for database
python2 # duh
+sudo # for parabolaweb-changepassword, parabolaweb-update
uwsgi-plugin-python2 # for uwsgi
diff --git a/parabolaweb-update.in b/parabolaweb-update.in
index 3fad382..0937860 100644
--- a/parabolaweb-update.in
+++ b/parabolaweb-update.in
@@ -1,6 +1,6 @@
#!/bin/bash -e
-# Copyright (c) 2012-2013, 2015 Luke Shumaker <lukeshu@parabola.nu>
+# Copyright (c) 2012-2013, 2015, 2019 Luke Shumaker <lukeshu@parabola.nu>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -15,6 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+set -e
. @pkgconffile@
. libremessages
@@ -88,6 +89,7 @@ main() {
configure
update-database
update-filesystem
+ sudo systemctl stop uwsgi@parabolaweb.service
}
main "$@"