summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO37
-rw-r--r--PKGBUILD98
-rw-r--r--aegir-hostmaster.install35
-rw-r--r--aegir-provision.install215
-rw-r--r--aegir.install35
-rw-r--r--aegir.target8
-rw-r--r--hosting-queued.service12
-rw-r--r--stop-when-unneeded.conf2
8 files changed, 39 insertions, 403 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 075de35ebaad..f9e7c4da14ed 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,35 +1,16 @@
pkgbase = aegir
- pkgver = 2.1
+ pkgdesc = Aegir systemd target for a dedicated Aegir VPS.
+ pkgver = 0.1
pkgrel = 1
- url = http://aegirproject.org/
+ url = http://aegirproject.org
arch = any
license = GPL
- options = !strip
+ depends = systemd
+ depends = aegir-hostmaster
+ source = aegir.target
+ source = stop-when-unneeded.conf
+ md5sums = 80773e4278e09b14cc6843e346540a9d
+ md5sums = 7e34786351f538d2db0bd2d3e64db43f
pkgname = aegir
- pkgdesc = Meta-Drupal hosting system
- install = aegir.install
- depends = aegir-hostmaster>=2.1
-
-pkgname = aegir-hostmaster
- pkgdesc = Meta-Drupal hosting system - front end
- install = aegir-hostmaster.install
- depends = aegir-provision>=2.1
-
-pkgname = aegir-provision
- pkgdesc = Meta-Drupal hosting system - back end
- install = aegir-provision.install
- depends = apache
- depends = drush>=5.10
- depends = git
- depends = php
- depends = php-gd
- depends = php-pear
- depends = mysql-clients
- depends = rsync
- depends = sudo
- depends = smtp-forwarder
- depends = unzip
- optdepends = apache: asdf
- optdepends = php-apache:
diff --git a/PKGBUILD b/PKGBUILD
index a608766c0eb2..44cad380352e 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,83 +1,25 @@
# Maintainer: James An <james@jamesan.ca>
-pkgbase=aegir
-pkgname=('aegir' 'aegir-hostmaster' 'aegir-provision')
-pkgver=2.1
+
+pkgname=aegir
+pkgver=0.1
pkgrel=1
+pkgdesc="Aegir systemd target for a dedicated Aegir VPS."
arch=('any')
-url="http://aegirproject.org/"
+url='http://aegirproject.org'
license=('GPL')
-options=(!strip)
-
-#source=($pkgbase-$pkgver.tar.gz)
-sha256sums=() #autofill using updpkgsums
-
-build() {
- cd "$pkgbase-$pkgver"
-
- ./configure --prefix=/usr
- make
-}
-
-package_aegir() {
- pkgdesc="Meta-Drupal hosting system"
- install=aegir.install
- depends=('aegir-hostmaster>=2.1')
-
- cd "$pkgbase-$pkgver"
-
- make DESTDIR="$pkgdir/" install
-}
-
-package_aegir-hostmaster() {
- pkgdesc="Meta-Drupal hosting system - front end"
- install=aegir-hostmaster.install
- depends=('aegir-provision>=2.1')
-
- cd "$pkgbase-$pkgver"
-
- make DESTDIR="$pkgdir/" i
- install
-}
-
-package_aegir-provision() {
- pkgdesc="Meta-Drupal hosting system - back end"
- install=aegir-provision.install
- depends=('apache' 'drush>=5.10' 'git' 'php' 'php-gd' 'php-pear' 'mysql-clients' 'rsync' 'sudo' 'smtp-forwarder' 'unzip')
- optdepends=(
- 'apache: asdf'
- 'php-apache: '
- )
-
- # Sserver config
- # Make sure service units for httpd and mysqld are enabled.
- echo "Include /var/aegir/config/apache.conf" >> /etc/httpd/conf/httpd.conf
- sed -i 's/^open_basedir.*$/open_basedir =/' /etc/php/php.ini
- sed -i 's/^;date.timezone.*$/date.timezone = Etc\/UTC/' /etc/php/php.ini
- sed -i 's/^memory_limit = 1.*$/memory_limit = 192M/' /etc/php/php.ini
- sed -i 's/^;extension=posix.so$/;extension=posix.so/' /etc/php/php.ini
- sed -i 's/^;extension=mysqli.so$/extension=mysqli.so/' /etc/php/php.ini
- sed -i 's/^;extension=pdo_mysql.so$/extension=pdo_mysql.so/' /etc/php/php.ini
- #sed -i 's/^;$//' /etc/php/php.ini
-
- sed -i 's/^LoadModule.*mpm_event.*$/#LoadModule mpm_event_module modules\/mod_mpm_event.so/' /etc/httpd/conf/httpd.conf
- sed -i '/^LoadModule.*mpm_event.*$/a LoadModule mpm_prefork_module modules\/mod_mpm_prefork.so' /etc/httpd/conf/httpd.conf
- sed -i '/^LoadModule.*mod_dir.*$/a LoadModule php5_module modules/libphp5.so' /etc/httpd/conf/httpd.conf
- echo 'Include conf/extra/php5_module.conf' >> /etc/httpd/conf/httpd.conf
-
- # `hostname` and `uname -n` must resolve to an IP address of this server (loopback with 127.0.0.1 is sufficient).
- mysql_secure_installation
- # Install hosting-queued.service.
-
- # Aegir user creation.
-
- su -s /bin/bash - aegir
- (
- drush dl --destination=/var/aegir/.drush provision-6.x-2.0
- drush cache-clear drush
- drush hostmaster-install --web_group=http
- )
-
- cd "$pkgbase-$pkgver"
-
- make DESTDIR="$pkgdir/" install
+depends=('systemd' 'aegir-hostmaster')
+source=(
+ aegir.target
+ stop-when-unneeded.conf
+)
+md5sums=(
+ 80773e4278e09b14cc6843e346540a9d
+ 7e34786351f538d2db0bd2d3e64db43f
+)
+
+package() {
+ install -Dm755 aegir.target "${pkgdir}/usr/lib/systemd/system/aegir.target"
+ for service in aegir mysqld nginx php-fpm; do
+ install -Dm755 stop-when-unneeded.conf "${pkgdir}/usr/lib/systemd/system/${service}.service.d/stop-when-unneeded.conf"
+ done
}
diff --git a/aegir-hostmaster.install b/aegir-hostmaster.install
deleted file mode 100644
index f7f593f6ed0f..000000000000
--- a/aegir-hostmaster.install
+++ /dev/null
@@ -1,35 +0,0 @@
-# This is a default template for a post-install scriptlet.
-# Uncomment only required functions and remove any functions
-# you don't need (and this header).
-
-## arg 1: the new package version
-#pre_install() {
- # do something here
-#}
-
-## arg 1: the new package version
-#post_install() {
- # do something here
-#}
-
-## arg 1: the new package version
-## arg 2: the old package version
-#pre_upgrade() {
- # do something here
-#}
-
-## arg 1: the new package version
-## arg 2: the old package version
-#post_upgrade() {
- # do something here
-#}
-
-## arg 1: the old package version
-#pre_remove() {
- # do something here
-#}
-
-## arg 1: the old package version
-#post_remove() {
- # do something here
-#}
diff --git a/aegir-provision.install b/aegir-provision.install
deleted file mode 100644
index 7afbd4798c52..000000000000
--- a/aegir-provision.install
+++ /dev/null
@@ -1,215 +0,0 @@
-set -e
-
-VARLIB=/var/aegir
-
-pre_install() {
- if [ -d $VARLIB/.drush/drush_make ]; then
- echo "existing drush_make install in $VARLIB/.drush/drush_make detected"
- echo "this needs to be removed or moved away for the install to be completed"
- echo "try: rm -rf $VARLIB/.drush/drush_make"
- exit 1
- fi
- if [ -d $VARLIB/.drush/provision ]; then
- echo "existing provision install in $VARLIB/.drush/provision detected"
- echo "this needs to be removed or moved away for the install to be completed"
- echo "try: rm -rf $VARLIB/.drush/provision"
- exit 1
- fi
-
-}
-
-post_install() {
- if ! getent passwd aegir >/dev/null ; then
- useradd --system --groups http --no-create-home --no-user-group \
- --home-dir "${VARLIB}" aegir
- chmod -R 755 /var/aegir
- fi
-
- mkdir /var/aegir/.drush
- cp /etc/php/php.ini /var/aegir/.drush/
-
- echo -e "Defaults:aegir !requiretty\naegir ALL=NOPASSWD: /usr/bin/apachectl" > /etc/sudoers.d/aegir
- chmod 0440 /etc/sudoers.d/aegir
-
- # HOSTMASTER POST-INSTALL
- AEGIRHOME="$(su aegir -s /bin/sh -c 'echo $HOME')"
-
- case "$1" in
- configure)
- # fetch the version number from provision. the line we're looking for looks like this
- # version=6.x-1.9
- # this obviously doesn't work for git releases
- VERSION=`sed -n '/^version/{s/^.*= *//;p}' /usr/share/drush/commands/provision/provision.info`
-
- FLAGS="--yes"
- if [ "$DPKG_DEBUG" = "developer" ]; then
- FLAGS="$FLAGS --debug"
- fi
- db_get "aegir/makefile"
- if [ ! -z "$RET" ]; then
- FLAGS="$FLAGS --makefile='$RET'"
- fi
- db_get "aegir/webserver"
- if [ ! -z "$RET" ]; then
- if [ "$RET" = 'apache2' ]; then
- RET='apache' # convert argument to something aegir can understand
- fi
- FLAGS="$FLAGS --http_service_type='$RET'"
- WEBSERVER="$RET"
- fi
-
- # make sure the configuration file exists before symlinking it in place (below)
- touch $AEGIRHOME/config/$WEBSERVER.conf
- # fix permissions on installed directories
- chown aegir:aegir "$AEGIRHOME" "$AEGIRHOME/config" "$AEGIRHOME/config/$WEBSERVER.conf"
-
- # flush the drush cache to find new commands
- su -s /bin/sh aegir -c 'drush cc drush'
- TEMPFILE=`tempfile`
- su -s /bin/sh aegir -c 'drush --pipe @hostmaster status 2>/dev/null | egrep "site_uri|drupal_root"' >> $TEMPFILE || true
- if grep -q 'site_uri' $TEMPFILE; then
- # upgrade
- db_stop
- . $TEMPFILE
- echo "Aegir frontend (@hostmaster) site detected in $drupal_root"
- # make those paths canonical to make sure we can compare correctly
- NEW_PLATFORM=`readlink -f "$AEGIRHOME/hostmaster-$VERSION"`
- drupal_root=`readlink -f $drupal_root`
- # we upgrade only if the target platform doesn't exit *OR*
- # if it's not the current platform
- if [ -d "$NEW_PLATFORM" ] && [ "$drupal_root" = "$NEW_PLATFORM" ]; then
- echo "it seems to be the same version as the one we're trying to install, not upgrading"
- else
- echo "upgrading the frontend from $drupal_root to $NEW_PLATFORM"
- if su -s /bin/sh aegir -c 'drush @hostmaster pm-list --status=enabled --pipe' | grep -q hosting_queued; then
- service hosting-queued stop
- fi
- cd "$drupal_root"
- su -s /bin/sh aegir -c "drush hostmaster-migrate $FLAGS '$site_uri' '$NEW_PLATFORM'"
- echo "upgrade finished, old platform left in $drupal_root"
- # restart daemon if enabled
- if su -s /bin/sh aegir -c 'drush @hostmaster pm-list --status=enabled --pipe' | grep -q hosting_queued; then
- service hosting-queued start
- fi
- fi
- else
- # fresh install
- db_get "aegir/site"
- if [ ! -z "$RET" ]; then
- site_uri="$RET"
- fi
- db_get "aegir/db_host"
- AEGIR_DB_HOST="$RET"
- db_get "aegir/db_user"
- AEGIR_DB_USER="$RET"
- db_get "aegir/db_password"
- AEGIR_DB_PASS="$RET"
- db_get "aegir/email"
- EMAIL="$RET"
-
- db_go
-
- # forget the DB password in debconf storage
- db_reset aegir/db_password || true
- db_fset aegir/db_password "seen" "true" || true
- db_stop
-
- if [ -d $AEGIRHOME/.drush/provision ]; then
- echo "existing provision in $AEGIRHOME/.drush/provision detected, move away and try again"
- exit 1
- fi
- echo "installing the Aegir frontend (Drupal with the hostmaster profile), please wait..."
- if [ "$DPKG_DEBUG" = "developer" ]; then
- DEBUG="--debug"
- fi
-
- # pass data through JSON for extra security
- su -s /bin/sh aegir -c "cd $AEGIRHOME && drush hostmaster-install $FLAGS --backend $site_uri 2>&1 | drush backend-parse $DEBUG" <<EOF
- { "yes": 1,
- "version": "$VERSION",
- "aegir_db_host": "$AEGIR_DB_HOST",
- "aegir_db_user": "$AEGIR_DB_USER",
- "aegir_db_pass": "$AEGIR_DB_PASS",
- "client_email": "$EMAIL"
- }
- EOF
- # on new installs, we default to having the daemon enabled
- echo 'Enabling hosting-queued daemon'
- su -s /bin/sh aegir -c 'drush @hostmaster pm-enable -y hosting_queued'
- service hosting-queued start
- fi
- rm -f $TEMPFILE
-
- case $WEBSERVER in
- apache)
- # apache 2.2 || 2.4
- ln -sf $AEGIRHOME/config/$WEBSERVER.conf /etc/apache2/conf.d/aegir.conf \
- || ln -sf $VARLIB/config/$WEBSERVER.conf /etc/apache2/conf-enabled/aegir.conf
- a2enmod ssl rewrite
- apache2ctl graceful
- ;;
- nginx)
- ln -sf $AEGIRHOME/config/$WEBSERVER.conf /etc/nginx/conf.d/aegir.conf
- service nginx reload
- ;;
- esac
-
- # this will ensure that this script aborts if the site can't be bootstrapped
- if su -s /bin/sh aegir -c 'drush @hostmaster status' 2>&1 | grep -q 'Drupal bootstrap.*Successful'; then
- echo 'Aegir frontend bootstrap correctly, operation was a success!'
- echo 'Use this URL to login on your new site:'
- su -s /bin/sh aegir -c 'drush @hostmaster uli'
- else
- echo 'Aegir frontend failed to bootstrap, something went wrong!'
- echo 'Look at the log above for clues or run with DPKG_DEBUG=developer'
- exit 1
- 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.
-
- # Automatically added by dh_installinit
- if [ -x "/etc/init.d/hosting-queued" ]; then
- update-rc.d hosting-queued defaults >/dev/null
- invoke-rc.d hosting-queued start || exit $?
- fi
- # End automatically added section
-
-
- exit 0
-
-
-
-}
-
-pre_upgrade() {
- pre_install
-}
-
-## arg 1: the new package version
-## arg 2: the old package version
-#post_upgrade() {
- # do something here
-#}
-
-pre_remove() {
- systemctl --system stop hosting-queued >/dev/null
-}
-
-post_remove() {
- userdel aegir
- rm -f /etc/sudoers.d/aegir
-
- systemctl --system disable hosting-queued >/dev/null
- systemctl --system daemon-reload >/dev/null
-}
diff --git a/aegir.install b/aegir.install
deleted file mode 100644
index f7f593f6ed0f..000000000000
--- a/aegir.install
+++ /dev/null
@@ -1,35 +0,0 @@
-# This is a default template for a post-install scriptlet.
-# Uncomment only required functions and remove any functions
-# you don't need (and this header).
-
-## arg 1: the new package version
-#pre_install() {
- # do something here
-#}
-
-## arg 1: the new package version
-#post_install() {
- # do something here
-#}
-
-## arg 1: the new package version
-## arg 2: the old package version
-#pre_upgrade() {
- # do something here
-#}
-
-## arg 1: the new package version
-## arg 2: the old package version
-#post_upgrade() {
- # do something here
-#}
-
-## arg 1: the old package version
-#pre_remove() {
- # do something here
-#}
-
-## arg 1: the old package version
-#post_remove() {
- # do something here
-#}
diff --git a/aegir.target b/aegir.target
new file mode 100644
index 000000000000..27cf23c8aec2
--- /dev/null
+++ b/aegir.target
@@ -0,0 +1,8 @@
+[Unit]
+Description=Aegir Hosting System
+Requires=aegir.service mysqld.service nginx.service php-fpm.service
+After=aegir.service mysqld.service nginx.service php-fpm.service
+PropagatesReloadTo=aegir.service mysqld.service nginx.service php-fpm.service
+
+[Install]
+WantedBy=multi-user.target
diff --git a/hosting-queued.service b/hosting-queued.service
deleted file mode 100644
index 77ca546c34d2..000000000000
--- a/hosting-queued.service
+++ /dev/null
@@ -1,12 +0,0 @@
-[Unit]
-Description=Aegir queue daemon
-After=local-fs.target network.target mysqld.service php-fpm.service
-
-[Service]
-Type=simple
-ExecStart=/usr/bin/drush --quiet @hostmaster hosting-queued
-User=aegir
-Restart=always
-
-[Install]
-WantedBy=multi-user.target
diff --git a/stop-when-unneeded.conf b/stop-when-unneeded.conf
new file mode 100644
index 000000000000..4c73820ed0fe
--- /dev/null
+++ b/stop-when-unneeded.conf
@@ -0,0 +1,2 @@
+[Unit]
+StopWhenUnneeded=true