[pinto] 01/02: Added pinto user.

Oleg Gashev oleg at gashev.net
Fri Sep 20 15:30:54 UTC 2013


This is an automated email from the git hooks/post-receive script.

gashev-guest pushed a commit to branch master
in repository pinto.

commit 391bd5b33acf096dd011e570fc00ab4238bebf26
Author: Oleg Gashev <oleg at gashev.net>
Date:   Fri Sep 20 15:28:15 2013 +0000

    Added pinto user.
---
 debian/pinto.init      |    4 ++--
 debian/pinto.logrotate |    2 +-
 debian/pinto.postinst  |   16 +++++++++++++---
 debian/pinto.postrm    |    9 ++++++++-
 4 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/debian/pinto.init b/debian/pinto.init
index 5d41a7a..2c7c674 100644
--- a/debian/pinto.init
+++ b/debian/pinto.init
@@ -13,7 +13,7 @@
 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
 DAEMON=/usr/bin/pintod
 NAME=pintod
-PIDFILE=/var/run/$NAME.pid
+PIDFILE=/var/run/pinto/$NAME.pid
 DEFAULTS_FILE=/etc/default/pinto
 DESC="pinto perl module repository"
 
@@ -40,7 +40,7 @@ check_started() {
 start() {
     if ! check_started; then
         log_daemon_msg "Starting $DESC" "$NAME"
-        if ! START_ERROR=`start-stop-daemon --start --pidfile $PIDFILE --exec $DAEMON -- $PINTOD_OPTS --pid $PIDFILE 2>&1`; then
+        if ! START_ERROR=`start-stop-daemon ---chuid pinto -u pinto -start --pidfile $PIDFILE --exec $DAEMON -- $PINTOD_OPTS --pid $PIDFILE 2>&1`; then
             echo -n " "
             log_action_end_msg 1 "$START_ERROR"
             exit 0
diff --git a/debian/pinto.logrotate b/debian/pinto.logrotate
index 4049f4c..af3b75b 100644
--- a/debian/pinto.logrotate
+++ b/debian/pinto.logrotate
@@ -5,6 +5,6 @@
     compress
     delaycompress
     notifempty
-    create 640 root adm
+    create 640 pinto adm
     sharedscripts
 }
diff --git a/debian/pinto.postinst b/debian/pinto.postinst
index d5b3125..afdec79 100644
--- a/debian/pinto.postinst
+++ b/debian/pinto.postinst
@@ -7,6 +7,10 @@ set -e
 defaultRepositoryPath='/var/lib/pinto/repository/default'
 
 if [ "$1" = configure ]; then
+	getent group pinto >/dev/null 2>&1 || addgroup --system pinto
+	getent passwd pinto >/dev/null 2>&1 ||
+	adduser --system --no-create-home --disabled-password --ingroup pinto pinto
+
     if [ ! -e "$defaultRepositoryPath" ] ; then
         pinto -r $defaultRepositoryPath init
     else
@@ -16,21 +20,27 @@ if [ "$1" = configure ]; then
         echo "and exec /usr/bin/pinto -r $defaultRepositoryPath init."
     fi
 
+	if [ ! -e /var/run/pinto ] ; then
+		mkdir -p /var/run/pinto
+		chown root:pinto /var/run/pinto
+		chmod 0775 /var/run/pinto
+	fi
+
     if [ ! -e /var/log/pinto ] ; then
         mkdir -p /var/log/pinto
-        chown root:adm /var/log/pinto
+        chown pinto:adm /var/log/pinto
         chmod 0750 /var/log/pinto
     fi
 
     if [ ! -e /var/log/pinto/access.log ] ; then
         touch /var/log/pinto/access.log
-        chown root:adm /var/log/pinto/access.log
+        chown pinto:adm /var/log/pinto/access.log
         chmod 0640 /var/log/pinto/access.log
     fi
 
     if [ ! -e /var/log/pinto/error.log ] ; then
         touch /var/log/pinto/error.log
-        chown root:adm /var/log/pinto/error.log
+        chown pinto:adm /var/log/pinto/error.log
         chmod 0640 /var/log/pinto/error.log
     fi
 
diff --git a/debian/pinto.postrm b/debian/pinto.postrm
index f0b4a63..113de1b 100644
--- a/debian/pinto.postrm
+++ b/debian/pinto.postrm
@@ -6,9 +6,16 @@ case "$1" in
     purge)
         for d in /etc/pinto \
             /var/log/pinto \
-            /var/lib/pinto ; do
+            /var/lib/pinto \
+            /var/run/pinto ; do
             rm -rf $d 2> /dev/null || true;
         done;
+
+        # Delete pinto daemon user, if it exists
+        if getent passwd pinto > /dev/null ; then
+            echo "Deleting pinto user."
+            deluser --quiet pinto > /dev/null || true
+        fi
         ;;
     remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
         ;;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/pinto.git



More information about the Pkg-perl-cvs-commits mailing list