apkbuilds @ 400ba1808f11f8e4814df6bdb17861d856efb107

feat: Finish firefly APKBUILD

Add dependencies and subpackages' dependencies.
diff --git a/apks/firefly3/APKBUILD b/apks/firefly3/APKBUILD
index a1b4f5e90efeaa8452f11696cbcaa5ca7513df77..37721339986d463a3e363bdafcab996079816436 100644
--- a/apks/firefly3/APKBUILD
+++ b/apks/firefly3/APKBUILD
@@ -7,12 +7,39 @@ url="https://firefly-iii.org"
 arch="noarch"
 license="AGPL-3.0-only"
 _php=php8
-_php_mods="-curl -zip -sodium -gd -xml -mbstring -bcmath -fileinfo -session
-           -tokenizer -xmlwriter -dom -shmop"
+_php_mods="
+    -curl
+    -zip
+    -sodium
+    -gd
+    -xml
+    -mbstring
+    -bcmath
+    -fileinfo
+    -session
+    -tokenizer
+    -xmlwriter
+    -dom
+    -shmop
+"
 depends="$_php ${_php_mods//-/$_php-}"
-_php_makemods="-intl -pdo -simplexml"
+_php_makemods="
+    -intl
+    -pdo
+    -simplexml
+"
 makedepends="$_php ${_php_makemods//-/$_php-} composer"
-source="${pkgname}-${pkgver}.tar.gz::https://github.com/firefly-iii/firefly-iii/archive/refs/tags/$pkgver.tar.gz"
+subpackages="
+    $pkgname-nginx:_nginx:noarch
+    $pkgname-mysql:_mysql
+    $pkgname-psql:_psql
+    $pkgname-sqlite:_sqlite
+"
+install="$pkgname.post-install"
+source="
+    ${pkgname}-${pkgver}.tar.gz::https://github.com/firefly-iii/firefly-iii/archive/refs/tags/$pkgver.tar.gz
+    firefly.nginx.conf
+"
 options="!check" # no clue how to run test on this
 builddir="$srcdir/firefly-iii-$pkgver/"
 
@@ -20,16 +47,42 @@ package() {
     local wwwdir="usr/share/webapps/$pkgname"
 
     mkdir -p "$pkgdir"
-	cd "$pkgdir"
+    cd "$pkgdir"
 
-	mkdir -p ./${wwwdir%/*}
-	cp -a "$builddir" ./$wwwdir
+    mkdir -p ./${wwwdir%/*}
+    cp -a "$builddir" ./$wwwdir
 
     chmod +x ./$wwwdir/artisan
 
     cd "$wwwdir" && composer install --prefer-dist --no-dev --no-scripts
+}
 
+_mysql() {
+    depends="firefly3 php8-pdo_mysql"
+	pkgdesc="Mysql dependencies for $pkgname"
+    mkdir -p "$subpkgdir"/usr
 }
+
+_psql() {
+    depends=" firefly3 php8-pdo_pgsql php8-pgsql"
+    pkgdesc="Postgresql dependencies for $pkgname"
+    mkdir -p "$subpkgdir"/usr
+}
+
+_sqlite() {
+    depends="firefly3 php8-pdo_sqlite"
+    pkgdesc="Sqlite dependencies for $pkgname"
+    mkdir -p "$subpkgdir"/usr
+}
+
+_nginx() {
+    depends="firefly3"
+    pkgdesc="nginx configuration for $pkgname"
+    install -Dm644 "$srcdir/firefly.nginx.conf" \
+        "$subpkgdir"/etc/nginx/http.d/firefly.conf
+}
+
 sha512sums="
 a59f89305eeb6cdb301ca86a6a3dfacd90497ce887b59b7c426bef341e7a070efc0d430c6e40277273e5aa56b86271c652f80e696cc53f0788b0624dd1b66a46  firefly3-5.7.13.tar.gz
+9d32e8e8bd805b09cd429eacc42fe9e746570cdc867531ac47a0b31801378e5e0fc357ef88e8d5c14617ba1887a3789a9d2f7150111b497377380df7ccdd08a7  firefly.nginx.conf
 "
diff --git a/apks/firefly3/firefly.nginx.conf b/apks/firefly3/firefly.nginx.conf
new file mode 100644
index 0000000000000000000000000000000000000000..a95ebb13dabd1340da551fc4888e36fd07ae2a25
--- /dev/null
+++ b/apks/firefly3/firefly.nginx.conf
@@ -0,0 +1,16 @@
+server {
+    listen 80;
+    server_name firefly.lan;
+    root /var/www/firefly3/public;
+
+    location ~ \.php$ {
+        try_files $uri $uri/ =404;
+        fastcgi_split_path_info ^(.+\.php)(/.+)$;
+        fastcgi_pass unix:/run/php-fpm8/fpm.sock;
+        include fastcgi.conf;
+    }
+
+    location / {
+      try_files $uri /index.php$is_args$args;
+    }
+}
diff --git a/apks/firefly3/firefly3.post-install b/apks/firefly3/firefly3.post-install
new file mode 100644
index 0000000000000000000000000000000000000000..0c5d88acf46a09e2377d26ab37a856b9815959c2
--- /dev/null
+++ b/apks/firefly3/firefly3.post-install
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+printf "  *\n  * Add the configration to '/var/www/firefly3/.env' \n"
+printf "  * Without it firefly3 won't run.\n  *\n"
+
+exit 0