Allow pkgusrs to update system mandb via sudo
authorSteve Youngs <steve@steveyoungs.com>
Sun, 16 May 2021 10:28:40 +0000 (20:28 +1000)
committerSteve Youngs <steve@steveyoungs.com>
Sun, 16 May 2021 10:28:40 +0000 (20:28 +1000)
Signed-off-by: Steve Youngs <steve@steveyoungs.com>
etc/sudoers.d/99-pkgusr
usr/lib/pkgusr/mandb [new file with mode: 0755]

index 7e88f25..0dd3f0c 100644 (file)
@@ -1,12 +1,13 @@
 ####
 #
-#  To allow pkgusr users to run ldconfig as root.
+#  To allow pkgusr users to run ldconfig and mandb as root.
 #
 ####
 
 Cmnd_Alias        LDCONFIG = /usr/sbin/ldconfig *
+Cmnd_Alias        MANDB = /usr/bin/mandb
 User_Alias        PKGUSRS = %install
 Defaults:PKGUSRS  !lecture, !authenticate
 
-PKGUSRS           ALL = LDCONFIG
+PKGUSRS           ALL = LDCONFIG, MANDB
 
diff --git a/usr/lib/pkgusr/mandb b/usr/lib/pkgusr/mandb
new file mode 100755 (executable)
index 0000000..266fa57
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/bash
+# Copyright © 2021 Steve Youngs All rights reserved.
+# SPDX-License-Identifer: BSD-3-Clause
+
+####
+#
+#  Call mandb with sudo to update the system db
+#
+####
+
+[[ -x $(type -p sudo) ]] && sudo /usr/bin/mandb -q
+
+# Local variables:
+# sh-basic-offset: 4
+# End: