summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: dc32e733ba9234f09f0aded335bd1c8a7d0ae173 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Maintainer: James An <james@jamesan.ca>

pkgname=aegir-hostmaster
_pkgname=${pkgname#aegir-}
pkgver=7.x_3.10
pkgrel=1
pkgdesc="mass Drupal hosting system - frontend"
arch=('any')
url='http://aegirproject.org'
license=('GPL')
depends=('drush>=7')
makedepends=('git')
optdepends=('dehydrated')
source=("https://ftp.drupal.org/files/projects/$_pkgname-${pkgver//_/-}-no-core.tar.gz"
        'https://ftp.drupal.org/files/projects/devel_debug_log-7.x-1.2.tar.gz'
        'https://ftp.drupal.org/files/projects/devel-7.x-1.5.tar.gz'
        'https://ftp.drupal.org/files/projects/drupal-7.54.tar.gz'
        'hosting_https'::'git+https://gitlab.com/aegir/hosting_https.git'
        hosting_https-pkg-info.patch
        hosting-hook_hosting_TASK_OBJECT_context_options-2846897-2.patch)
md5sums=('f2c4bbde18c7b7d04d74a5c4f6615502'
         '19561aa1a0f2e549acf5c44a8cad8e14'
         'f06c912eb4edbd48fbcc2867516726a3'
         '3068cbe488075ae166e23ea6cd29cf0f'
         'SKIP'
         'da16dba10759dfa59c7d760419f3f042'
         'faa872c26a49c62d841574ae10a43a20')

prepare() {
  patch --directory=hosting_https --strip=1 < hosting_https-pkg-info.patch

  local -A expr=(
    [nginx_stub]='/\/etc\/init.d\/nginx/c \    return "sudo /usr/bin/systemctl try-reload-or-restart httpd.service";''/\/etc\/init.d\/nginx/c \    return "sudo /usr/bin/systemctl try-reload-or-restart httpd.service";'
    [apache_apachectl]='/\/usr\/sbin\/apachectl/,/return/c \    return "sudo /usr/bin/systemctl try-reload-or-restart httpd.service";'
    [apache_apache2ctl]='/\/usr\/sbin\/apache2ctl/,/return/c \    return "sudo /usr/bin/systemctl try-reload-or-restart httpd.service";'
  )
  local -A path=(
    [nginx_stub]="$_pkgname/modules/aegir/hosting/web_server/nginx/hosting_nginx.service.inc $_pkgname/modules/aegir/hosting/web_server/nginx/ssl/hosting_nginx_ssl.service.inc hosting_https/submodules/nginx_https/hosting_nginx_https.service.inc"
    [apache_apachectl]="$_pkgname/modules/aegir/hosting/web_server/ssl/hosting_ssl.service.inc hosting_https/submodules/apache_https/hosting_apache_https.service.inc"
    [apache_apache2ctl]="$_pkgname/modules/aegir/hosting/web_server/hosting_web_server.service.inc"
  )

  for index in "${!expr[@]}"; do
    # Apply word splitting to path string as its a space-separated list of files.
    sed --in-place "${expr[$index]}" ${path[$index]}
  done
}

package() {
  install -d $pkgdir/{var/lib,usr/share/webapps}/$_pkgname
  install -d "$pkgdir/var/lib/$_pkgname/sites/all/modules"
  install -d "$pkgdir/var/lib/$_pkgname/sites/all/modules/hosting_https/submodules/letsencrypt/drush/bin/letsencrypt/$_pkgname"

  cp -a drupal-7.54/* "$pkgdir/usr/share/webapps/$_pkgname"
  cp -a $_pkgname "$pkgdir/usr/share/webapps/$_pkgname/profiles/$_pkgname"
  [ -d "$pkgdir/var/lib/$_pkgname" ] && rm --recursive "$pkgdir/var/lib/$_pkgname/sites"
  mv "$pkgdir/usr/share/webapps/$_pkgname/sites" "$pkgdir/var/lib/$_pkgname"
  ln -s "/var/lib/$_pkgname/sites" "$pkgdir/usr/share/webapps/$_pkgname"
  cp -a devel devel_debug_log hosting_https "$pkgdir/var/lib/$_pkgname/sites/all/modules"
  ln -s /usr/bin/dehydrated "$pkgdir/var/lib/$_pkgname/sites/all/modules/hosting_https/submodules/letsencrypt/drush/bin/letsencrypt"

  install -D <( ) "$pkgdir/var/lib/$_pkgname/sites/all/drush/drushrc.php"
  install -D <( ) "$pkgdir/var/lib/$_pkgname/sites/sites.php"

  find $pkgdir/{var/lib,usr/share/webapps}/$_pkgname -type d -exec chmod 775 {} +
  find $pkgdir/{var/lib,usr/share/webapps}/$_pkgname -type f -exec chmod 664 {} +
  chown -R http:http $pkgdir/{var/lib,usr/share/webapps}/$_pkgname

  #~ # correct file permissions (disabling file execution)
  #~ find "$pkgdir/var/lib/aegir     " -type f -exec chmod 0644 {} +
  #~ find "$pkgdir" -type d -exec chmod 0755 {} +
}