summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
authorhashworks2020-06-06 18:45:00 +0200
committerhashworks2020-06-06 18:45:00 +0200
commit5f0039a5d96369b403c4132b288e39ef154c4a7b (patch)
tree1153e90c4428f4d31c609e68582e8e76e1cdba92 /PKGBUILD
parent99c117a841690404329f0d6378f61ee0ae79d625 (diff)
downloadaur-5f0039a5d96369b403c4132b288e39ef154c4a7b.tar.gz
PKGBUILD improvements
- the git checkout and submodule init stuff should be happening in prepare() - use install -D -d -m<mode> -o $owner-uid -g $owner-gid "${pkgdir}/........." for creating directories - use install -d -m<mode> ... (same as above) for copying files - even though not strictly needed, missing quotes around $pkgdir in package() - is that "cd ..." into the $pkgdir really needed? - try to use absolute path referencing "${pkgdir}/..." for all these rm/find calls - quote the -name argument of the find call, avoid escaping where possible
Diffstat (limited to 'PKGBUILD')
-rwxr-xr-xPKGBUILD42
1 files changed, 20 insertions, 22 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 4b54655aea89..b10a39552a43 100755
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -37,34 +37,32 @@ sha256sums=('SKIP'
'36c82c506a058edc50b882200332c6a540aa68a5749919eb62dc6c633c47deb3'
'd73e4b984ab95954bd18e08237c6aa8bec32ccc5699531727362e2c75ba9c25e')
-build () {
+prepare() {
cd ${srcdir}/filebin
git checkout ${pkgver}
git submodule update --init --recursive
- scripts/optimize_js.sh
}
-package() {
- mkdir -p ${pkgdir}/usr/share/webapps
- mkdir -p ${pkgdir}/etc/webapps/filebin
- mkdir -p ${pkgdir}/usr/lib/systemd/system
- cp -ra ${srcdir}/filebin/ ${pkgdir}/usr/share/webapps/filebin/
- cp filebin-file-cron.service filebin-file-cron.timer filebin-user-cron.service filebin-user-cron.timer ${pkgdir}/usr/lib/systemd/system
- cp filebin-nginx.conf filebin-php-fpm.conf ${pkgdir}/usr/share/webapps/filebin
- cd ${pkgdir}/usr/share/webapps/filebin
- cp application/config/example/{config-local,database,memcached}.php ${pkgdir}/etc/webapps/filebin
- rm application/config/memcached.php
- ln -s /etc/webapps/filebin/{config-local,database,memcached}.php application/config
- cp data/local/examples/contact-info.php ${pkgdir}/etc/webapps/filebin
- ln -s /etc/webapps/filebin/contact-info.php data/local
+build () {
+ bash "${srcdir}/filebin/scripts/optimize_js.sh"
+}
- # http
- chown 33:33 ${pkgdir}/usr/share/webapps/filebin/data/uploads
+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}/filebin/data/local/examples/contact-info.php" "${pkgdir}/etc/webapps/filebin"
+ install -m640 -g 33 "${srcdir}/filebin/application/config/example/config-local.php" "${pkgdir}/etc/webapps/filebin"
+ install -m640 -g 33 "${srcdir}/filebin/application/config/example/database.php" "${pkgdir}/etc/webapps/filebin"
+ install -m640 -g 33 "${srcdir}/filebin/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"
+ install -m644 filebin-nginx.conf filebin-php-fpm.conf ${pkgdir}/usr/share/webapps/filebin
+ cp -r "${srcdir}/filebin/"* "${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"
# removing unnecessary data for a production environment
- rm -rf .git
- rm -rf git-hooks
- rm -rf application/third_party/{test-more-php,mockery}
- rm -rf application/tests
- find . -name \*.gitignore -type f -delete
+ rm -rf "${pkgdir}/usr/share/webapps/filebin/"{git-hooks,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
}