summarylogtreecommitdiffstats
path: root/aegir.install
diff options
context:
space:
mode:
authorJames An2015-02-20 13:07:51 -0500
committerJames An2015-06-30 07:27:49 -0400
commita2fe1bd219e5378df61adfd9d7004d36124e0a54 (patch)
treea256ba43f5f4f818e4a4382710df81fa9185ef38 /aegir.install
parentc4c2ecc7a9ee7b4e294a1457ecb3bce7c445fa69 (diff)
downloadaur-a2fe1bd219e5378df61adfd9d7004d36124e0a54.tar.gz
Added to aegir post-install check for outgoing mail functionality and post-update commands to rearrange passwd and group database so aegir takes precedence over http, which it shares both gid and uid.
Diffstat (limited to 'aegir.install')
-rw-r--r--aegir.install36
1 files changed, 28 insertions, 8 deletions
diff --git a/aegir.install b/aegir.install
index 996fb8b16b9..68955a0e5d0 100644
--- a/aegir.install
+++ b/aegir.install
@@ -6,7 +6,9 @@ post_install() {
echo " grep --quiet $(resolveip $(hostname) | cut --fields=6 --delimiter=' ') && echo Success!"
echo ">>> 2. Ensure the http user and group exist (i.e. uid=gid=33):"
echo " $ test \$(id --user http) -eq 33 -a \$(id --group http) -eq 33 && echo Success!"
- echo ">>> 3. Setup the MySQL instance (by running mysql_secure_installation, or the following shell commands):"
+ echo ">>> 3. Ensure PHP can successfully send outgoing emails:"
+ echo " $ php -R 'mail("example@example.com", "Test email from PHP", "Test email body.");
+ echo ">>> 4. Setup the MySQL instance (by running mysql_secure_installation, or the following shell commands):"
echo " # systemctl start mysqld"
echo " $ mysql --user=root --execute=\""
echo " DELETE FROM mysql.user WHERE User='';"
@@ -14,23 +16,41 @@ post_install() {
echo " DROP DATABASE IF EXISTS test;"
echo " DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%';"
echo " FLUSH PRIVILEGES;\""
- echo ">>> 4. (opt) Create a aegir MySQL user:"
+ echo ">>> 5. (opt) Create a aegir MySQL user:"
echo " $ mysql --user=root \\"
echo " --execute=\"GRANT ALL PRIVILEGES ON *.* TO 'aegir'@'%' IDENTIFIED BY 'passwd' WITH GRANT OPTION;\""
- echo ">>> 5. Install hostmaster as the aegir user through its drush provision command:"
+ echo ">>> 6. Install hostmaster as the aegir user through its drush provision command:"
echo " # su aegir -c \\"
echo " \"drush hostmaster-install --yes --web_group=http --http_service_type=nginx \\"
echo " --root=/var/lib/aegir/hostmaster --aegir_db_user=aegir --aegir_db_pass=passwd \\"
echo " --aegir_host=\$(hostname) --client_email=aegir@\$(hostname) \$(hostname)\""
- echo ">>> 6. Connect nginx to the Unix socket used by php-fpm:"
+ echo ">>> 7. Connect nginx to the Unix socket used by php-fpm:"
echo " # su aegir -c \"sed -i 's/127.0.0.1:9000/unix:\\/run\\/php-fpm\\/php-fpm.sock/' /var/lib/aegir/config/includes/nginx_vhost_common.conf\""
- echo ">>> 7. Start the entire web stack:"
+ echo ">>> 8. Start the entire web stack:"
echo " # systemctl start mysqld nginx php-fpm"
- echo ">>> 8. (opt) Enable and start the hosting queue daemon:"
+ echo ">>> 9. (opt) Enable and start the hosting queue daemon:"
echo " # su aegir -c \"drush @hostmaster pm-enable hosting_queued\" && systemctl start aegir"
}
post_upgrade() {
- getent group aegir || groupadd --non-unique --gid $(id --group http) aegir
- getent passwd aegir || useradd --non-unique --uid $(id --user http) --gid $(id --group http) --home-dir /var/lib/aegir aegir
+ if ! getent group aegir &>/dev/null; then
+ groupadd --non-unique --gid $(id --group http) aegir
+ # Rearrange group database so aegir group name comes before http
+ cat \
+ <(sed -n '/http:/q;p' /etc/group) \
+ <(tail -n1 /etc/group) \
+ <(sed -n '/http:/{p;q}' /etc/group) \
+ <(head -n-1 /etc/group | sed '1,/http:/d')
+ grpconv
+ fi
+ if ! getent passwd aegir &>/dev/null; then
+ useradd --non-unique --uid $(id --user http) --gid $(id --group http) --home-dir /var/lib/aegir aegir
+ # Rearrange user database so aegir user name comes before http
+ cat \
+ <(sed -n '/http:/q;p' /etc/passwd) \
+ <(tail -n1 /etc/passwd) \
+ <(sed -n '/http:/{p;q}' /etc/passwd) \
+ <(head -n-1 /etc/passwd | sed '1,/http:/d')
+ pwconv
+ fi
}