summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c4a81759fb9a3da0fa60fffb12006a7f41666c16 (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# Maintainer: hashworks<mail@hashworks.net>
# Contributor: Simon Hanna<simon DOT Hanna AT serve-me DOT info>
pkgname=filebin
pkgver=3.4.5
pkgrel=2
pkgdesc="A pastebin service written in PHP"
arch=('any')
url="https://wiki.server-speed.net/projects/filebin"
license=('AGPL' 'MIT')
makedepends=('nodejs' 'git')
depends=('php'
         'pygmentize'
         'python-ansi2html'
         'php-gd'
         'imagemagick'
)
backup=('etc/webapps/filebin/config-local.php'
        'etc/webapps/filebin/contact-info.php'
        'etc/webapps/filebin/database.php'
        'etc/webapps/filebin/memcached.php'
)
install=filebin.install
options=('!strip' 'emptydirs')
source=("git+https://github.com/Bluewind/filebin.git#tag=${pkgver}?signed"
        "git+https://github.com/padraic/mockery.git"
        "git+https://github.com/endroid/QrCode.git"
        "git+https://github.com/erusev/parsedown.git"
        "git+https://github.com/recurser/exif-orientation-examples.git"
        'filebin-nginx.conf'
        'filebin-php-fpm.conf'
        'filebin-file-cron.service'
        'filebin-file-cron.timer'
        'filebin-user-cron.service'
        'filebin-user-cron.timer'
)
sha256sums=('SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            '6ed404a3fbc28c6ab35bf1eba67ddcf46cfd48893237155e38d297a13020180c'
            '034442098d1608807bec2a03028a7c8bb9ae9d286c378e2f668b4aca3cc9d4e1'
            '78dd850467d89ac3d1b57fa72fe9ce8d736ce29a89abe624d9c4d2e168e59d19'
            '116b1e5031c22ad251c486b18ff203813f7227197ef853927ddc2de00e85cbe1'
            '36c82c506a058edc50b882200332c6a540aa68a5749919eb62dc6c633c47deb3'
            'd73e4b984ab95954bd18e08237c6aa8bec32ccc5699531727362e2c75ba9c25e')

validpgpkeys=('CFA6AF15E5C74149FC1D8C086D1655C14CE1C13E') # Florian Pritz <bluewind@archlinux.org>

prepare() {
  cd "${srcdir}/${pkgname}"
  git submodule init
  git config submodule."application/third_party/mockery".url "${srcdir}/mockery"
  git config submodule."application/third_party/QrCode".url "${srcdir}/QrCode"
  git config submodule."application/third_party/parsedown".url "${srcdir}/parsedown"
  git config submodule."data/tests/exif-orientation-examples".url "${srcdir}/exif-orientation-examples"
  git submodule update --recursive
}

build () {
  bash "${srcdir}/${pkgname}/scripts/optimize_js.sh"
}

package() {
  install -D -d -m755 "${pkgdir}/usr/lib/systemd/system"
  install -D -d -m755 -g 33 "${pkgdir}/usr/share/webapps/filebin" "${pkgdir}/etc/webapps/filebin"
  install -D -d -m755 -o 33 -g 33 "${pkgdir}/usr/share/webapps/filebin/data/uploads"
  install -m640 -g 33 "${srcdir}/${pkgname}/data/local/examples/contact-info.php" "${pkgdir}/etc/webapps/filebin"
  install -m640 -g 33 "${srcdir}/${pkgname}/application/config/example/config-local.php" "${pkgdir}/etc/webapps/filebin"
  install -m640 -g 33 "${srcdir}/${pkgname}/application/config/example/database.php" "${pkgdir}/etc/webapps/filebin"
  install -m640 -g 33 "${srcdir}/${pkgname}/application/config/example/memcached.php" "${pkgdir}/etc/webapps/filebin"
  install -m644 filebin-file-cron.service filebin-file-cron.timer filebin-user-cron.service filebin-user-cron.timer "${pkgdir}/usr/lib/systemd/system"
  cp -r "${srcdir}/${pkgname}"/* "${pkgdir}/usr/share/webapps/filebin/"
  rm "${pkgdir}/usr/share/webapps/filebin/application/config/memcached.php"
  ln -s /etc/webapps/filebin/{config-local,database,memcached}.php "${pkgdir}/usr/share/webapps/filebin/application/config"
  ln -s /etc/webapps/filebin/contact-info.php "${pkgdir}/usr/share/webapps/filebin/data/local"

  install -Dm644 "${srcdir}/${pkgname}/COPYING" "${pkgdir}/usr/share/licenses/${pkgname}/COPYING"
  install -Dm644 "${srcdir}/${pkgname}/license.txt" "${pkgdir}/usr/share/licenses/${pkgname}/framework-license.txt"

  install -Dm644 filebin-nginx.conf "$pkgdir/usr/share/doc/$pkgname/examples/nginx.conf"
  install -Dm644 filebin-php-fpm.conf "$pkgdir/usr/share/doc/$pkgname/examples/php-fpm.conf"
  install -Dm644 "${srcdir}/${pkgname}/NEWS" "$pkgdir/usr/share/doc/$pkgname/NEWS"
  install -Dm644 "${srcdir}/${pkgname}/README.md" "$pkgdir/usr/share/doc/$pkgname/README.md"
  install -Dm644 "${srcdir}/${pkgname}/contributing.md" "$pkgdir/usr/share/doc/$pkgname/contributing.md"
  install -Dm644 "${srcdir}/${pkgname}/INSTALL" "$pkgdir/usr/share/doc/$pkgname/INSTALL"
  install -Dm644 "${srcdir}/${pkgname}/doc/api.md" "$pkgdir/usr/share/doc/$pkgname/api.md"
  install -Dm644 "${srcdir}/${pkgname}/doc/api/file.md" "$pkgdir/usr/share/doc/$pkgname/api/file.md"
  install -Dm644 "${srcdir}/${pkgname}/doc/api/user.md" "$pkgdir/usr/share/doc/$pkgname/api/user.md"
  rm -Rf "${pkgdir}/usr/share/webapps/filebin/"{COPYING,license.txt,NEWS,README.md,contributing.md,INSTALL,doc}

  # removing unnecessary data for a production environment
  rm -Rf "${pkgdir}/usr/share/webapps/filebin/"{Dockerfile,docker,composer.json,composer.lock,git-hooks,run-tests.sh,data/tests,application/third_party/test-more-php,application/third_party/mockery,application/tests,scripts/optimize_js.sh,scripts/install-git-hooks.sh,scripts/hooks-wrapper.sh}
  find "${pkgdir}/usr/share/webapps/filebin" -name ".git*" -type f -delete
}