# HG changeset patch # User Paul Boddie # Date 1438518220 -7200 # Node ID 5871195dd9f83381e4c4643f8d086633502e7495 # Parent 4fa33cbc0e1f77f0a4865c1174e597ad2d574884 Moved initialisation and administration commands into separate scripts. diff -r 4fa33cbc0e1f -r 5871195dd9f8 README.txt --- a/README.txt Sun Aug 02 01:04:59 2015 +0200 +++ b/README.txt Sun Aug 02 14:23:40 2015 +0200 @@ -36,30 +36,14 @@ adduser www-data lmtp -Stored and published data is then initialised as follows: - - mkdir /var/lib/imip-agent/store /var/lib/imip-agent/preferences - mkdir /var/www/imip-agent/static - chown imip-agent /var/lib/imip-agent/store /var/lib/imip-agent/preferences - chown imip-agent /var/www/imip-agent/static - chgrp lmtp /var/lib/imip-agent/store /var/lib/imip-agent/preferences - chgrp lmtp /var/www/imip-agent/static - chmod g+ws /var/lib/imip-agent/store /var/lib/imip-agent/preferences - chmod g+ws /var/www/imip-agent/static +Stored and published data is then initialised using the tools/init.sh script. +The script employs the setgid flag on the directories initialised for stored +and published data so that new files and directories have the appropriate +group associated with them. -Here, the setgid flag should ensure that new files and directories have the -appropriate group associated with them. - -Fixing ownership can be done as follows: - - chown -R imip-agent /var/lib/imip-agent - chgrp -R imip-agent /var/lib/imip-agent - chown -R imip-agent /var/lib/imip-agent/store /var/lib/imip-agent/preferences - chown -R imip-agent /var/www/imip-agent/static - chgrp -R lmtp /var/lib/imip-agent/store /var/lib/imip-agent/preferences - chgrp -R lmtp /var/www/imip-agent/static - chmod -R g+w /var/lib/imip-agent/store /var/lib/imip-agent/preferences - chmod -R g+w /var/www/imip-agent/static +Fixing ownership can be done using the tools/fix.sh script, in case some form +of modification has altered the ownership or membership of the created files +and directories. Installing the Software ----------------------- diff -r 4fa33cbc0e1f -r 5871195dd9f8 tools/fix.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/fix.sh Sun Aug 02 14:23:40 2015 +0200 @@ -0,0 +1,15 @@ +#!/bin/sh + +USER=imip-agent +GROUP=lmtp +INSTALL_DIR=/var/lib/imip-agent +WEB_INSTALL_DIR=/var/www/imip-agent + +chown -R "$USER" "$INSTALL_DIR" +chgrp -R "$GROUP" "$INSTALL_DIR" + +for DIR in "$INSTALL_DIR"/store "$INSTALL_DIR"/preferences "$WEB_INSTALL_DIR"/static ; do + chown -R "$USER" "$DIR" + chgrp -R "$GROUP" "$DIR" + chmod -R g+w "$DIR" +done diff -r 4fa33cbc0e1f -r 5871195dd9f8 tools/init.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/init.sh Sun Aug 02 14:23:40 2015 +0200 @@ -0,0 +1,13 @@ +#!/bin/sh + +USER=imip-agent +GROUP=lmtp +INSTALL_DIR=/var/lib/imip-agent +WEB_INSTALL_DIR=/var/www/imip-agent + +for DIR in "$INSTALL_DIR"/store "$INSTALL_DIR"/preferences "$WEB_INSTALL_DIR"/static ; do + mkdir -p "$DIR" + chown "$USER" "$DIR" + chgrp "$GROUP" "$DIR" + chmod g+ws "$DIR" +done