cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eev...@apache.org
Subject svn commit: r981326 - in /cassandra/trunk/debian: TODO cassandra.postinst init
Date Sun, 01 Aug 2010 21:51:50 GMT
Author: eevans
Date: Sun Aug  1 21:51:50 2010
New Revision: 981326

URL: http://svn.apache.org/viewvc?rev=981326&view=rev
Log:
run as dedicated user on debian

Patch by eevans for CASSANDRA-1004

Added:
    cassandra/trunk/debian/cassandra.postinst
Modified:
    cassandra/trunk/debian/TODO
    cassandra/trunk/debian/init

Modified: cassandra/trunk/debian/TODO
URL: http://svn.apache.org/viewvc/cassandra/trunk/debian/TODO?rev=981326&r1=981325&r2=981326&view=diff
==============================================================================
--- cassandra/trunk/debian/TODO (original)
+++ cassandra/trunk/debian/TODO Sun Aug  1 21:51:50 2010
@@ -1,4 +1,2 @@
 
- * run as non-privileged user
- * cassandra-cli requires root for access to log files (and shouldn't)
  * don't embed jars for which debian packages exist

Added: cassandra/trunk/debian/cassandra.postinst
URL: http://svn.apache.org/viewvc/cassandra/trunk/debian/cassandra.postinst?rev=981326&view=auto
==============================================================================
--- cassandra/trunk/debian/cassandra.postinst (added)
+++ cassandra/trunk/debian/cassandra.postinst Sun Aug  1 21:51:50 2010
@@ -0,0 +1,55 @@
+#!/bin/sh
+# postinst script for cassandra
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <postinst> `abort-remove'
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+case "$1" in
+    configure)
+        if ! getent group cassandra >/dev/null; then
+            addgroup --system cassandra
+        fi
+
+        if ! getent passwd cassandra >/dev/null; then
+            adduser --quiet \
+                --system \
+                --ingroup cassandra \
+                --quiet \
+                --disabled-login \
+                --disabled-password \
+                --home /var/lib/cassandra \
+                --no-create-home \
+                -gecos "Cassandra database" \
+                cassandra
+        fi
+
+        if [ -n $2 ] && dpkg --compare-versions "$2" le 0.6.4-2; then
+            chown -R cassandra: /var/lib/cassandra
+            chown -R cassandra: /var/log/cassandra
+        fi
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#

Modified: cassandra/trunk/debian/init
URL: http://svn.apache.org/viewvc/cassandra/trunk/debian/init?rev=981326&r1=981325&r2=981326&view=diff
==============================================================================
--- cassandra/trunk/debian/init (original)
+++ cassandra/trunk/debian/init Sun Aug  1 21:51:50 2010
@@ -85,6 +85,7 @@ do_start()
     is_running && return 1
 
     $JSVC \
+        -user cassandra \
         -home $JAVA_HOME \
         -pidfile $PIDFILE \
         -errfile "&1" \



Mime
View raw message