Skip to content

Instantly share code, notes, and snippets.

@pierres
Created December 20, 2022 10:06
Show Gist options
  • Save pierres/227602544b54a1b027471b6ccdab36c1 to your computer and use it in GitHub Desktop.
Save pierres/227602544b54a1b027471b6ccdab36c1 to your computer and use it in GitHub Desktop.
Index: PKGBUILD
===================================================================
--- PKGBUILD (revision 1363433)
+++ PKGBUILD (working copy)
@@ -5,12 +5,12 @@
# NOTE: always check first whether the version is supposed to be packaged:
# https://github.com/nextcloud/server/wiki/Maintenance-and-Release-Schedule
pkgver=25.0.2
-pkgrel=1
+pkgrel=2
pkgdesc="A cloud server to store your files centrally on a hardware controlled by you"
arch=(any)
url="https://nextcloud.com"
license=(AGPL3)
-makedepends=(php php-gd)
+makedepends=('php-legacy' 'php-legacy-gd')
optdepends=(
'curl: for webcron jobs from within uwsgi'
'ffmpeg: for preview generation'
@@ -48,11 +48,11 @@
'5f9be223225e6ad2772989c440df8585a852ea0be697274384064ec73df47dab2f5d0847c275732fab26c419a713911d8f77ebc2b639bf6e8ede76272b752cde'
'92592f9a76ee534d0ae6d3aedf2257c147337debe7e2d6dbec1daff66a682e3abc74611e08662058de314bf3ea6ff1c85efd678674b782d71251c38786e446f9'
'2791382d7b005c64cd6938695f273e83435cc5f1b785fe7d44d6dbd69864c502847e45d93c4a5f6752a759a660118279e3e22e5bc32f79b8775693fde603a9c5'
- '20f12f0bb1d0ac735fb86e79e90fb99028e06e0d5a6842d449e443b418442682cad2573cfd4bf8e2a802c2aeb5780bce4647d45054bbc38156ae037802358698'
+ 'b54b5a9957f846842603677b21fa79628ab69b5b7e05913dcf631ae2b4fd11d09822429900ab0efc6e75e83f85cc0d8e7d53eb6a4c91e08148ddbed235b2453b'
'1d06f339c43d57e5f5406c2698b815241fd9e39039a9e55f777face510c9a5ddae5ccd4e051393e8f16f391301a6aa03fff2462837a2d3441d969ea7195e7d84'
'919008a2bf6cf2492cb1e9c8e28c1e082d74e45da5a96e6669f8971d6cf721e36d23625c89918fe10d8bc1b202c0340aa897849d9ec501a26f3f4572ccb57a98'
- '67d32011e3dccf41ecaaeffa7486e70b8ee516b3423796c19cc9c95ba6ecd5d031540eeacefb9423fdfc70b1baad15a4885b7147cfbbb2773b349e72d3fe4df2'
- '66f542d8b84701d81e6f6d896163faa232996ee081bcabe4acc121064ef538b5c1ea43728222b5cadc60a5d433b1e54ad7c1fe9d1d188ffa8eaf331fd4cd8ec0'
+ '1fec4c01be263ce69e8cc1a92acb4558f77e22197ff88dbc15e807b3b6f43b99afd5c73ede674be66bd00cc09e72c4b29b8df1250daefab84c5f9a5cf0143c02'
+ '3d3e22841bbae0b910c1d1dc9cccfff1182f5fd569c39ae76ca7f3828de31d5d91bf0d28524dd397171f027046bfb193845ecfc06bd0abbbc79899acb26306bb'
'eb69785a5b0df0e2a11f53f9c2e2dbf75681d7c698e88cbcc5ceed713a558d528511cc576813cc083cbaa28a2c83d543a39436ad4805670348ef22634305b1c8')
b2sums=('8980fa45dcfa1f9cc70434f0bdd15154a2ef42b80bb4e57b5cb2792afa9ad77867640bc6a6d266b88e52a12aae829d34bd55d5c46fd2ba74acde0bea7b4c028e'
'SKIP'
@@ -59,16 +59,15 @@
'7d40d120c28291f1a7537f3e1b5049fa83c9c0af949371345ea9ccdf3de4a0f3a3a06edbc52d9254dba483e4d11acf562cf679b9e379c5dfc2f61dfbfc2e4cef'
'4ad061efbc20b4d0e9f8cfd01c5e8e612fa5af29bce754b77f90c1835b98ee445ef4de3d8c83da91461053622620af14d880eb9014b51f2383c75f1860d479f4'
'c69f18de513562e32f0f655fee7ef81877d74a76717e2eaad9a13882bf8edd0dad99bec5958e460a4ec32eecfdd425ae009d11ac27af16a3ad1d6498282be32f'
- 'f3d1423a457c7a24c25c8b18e24b838b63e99a7f7562ded954ea605c76bbd31e8e79158314e1343e341aa21b6a26dc57ca4f00b871bbc170f6b7d5044985e661'
+ 'c5c4499f588c2b4d90223c00b2c1e575611d4c90c5077d3199cfcdad455ad55ab34db66159ad2c42a2f56db87a844f60ff4cdfd2fdb14df3a52f44e376dd2e3e'
'1a61a89531636b65dade03cd7edca8747b3e1e880f9bbd4d5a53cffa452d70fe17e345cfed739ae92e99e336d4c1f2633c84a5c84a4ee6da518762bf1396b1db'
'd132044cb7f1d61a1ce87800d2e1142e3ac385acdec25e2f5ad685603a0ffa88e105f4c35688584d65d287adbb40b8d9a02d6a80d7a0b58bb8801a6769405218'
- '67fa7d9207ab3e8309d4adcce734bd25f82bd03f1f88adea7e40adaddebb345b96a793df7960db79f4f39947f5edff61548bb409066b81e3fe643d313e68d66a'
- 'a84fbdc9b5caf28eae6bfb147ea0c77e4cfc5a42f29b3fe93c0ecf8414f95ed20999a131efb7c7ba49041304fe7104813c574e6b5aaa6b03881aea3428144f33'
+ 'd23c227c42041eaa500618cba115770bba4f0cf2156e4e5631694db7c426ecd18926b246d76f4e4f04bf0f507a1e271dfeac15e9dd39e9404ffa42feabdda67e'
+ '3478252d09c5283dc148836e8a1bc6520bee40b19fe9d98c40ef1240b6ede20d8f397400a9901fb188bcf5859bda19e4fe0454ae30aa00d494cdb467ccaf3fc3'
'e6214351ca16bfe97683e838e727d6b5eaa62194878272204034c62aac4a632c9b33cd31aa0570c2eb936d7e9e7ff60190ac05a3a8cc2e27eda423a7d89b6d39')
validpgpkeys=('28806A878AE423A28372792ED75899B9A724937A') # Nextcloud Security <security@nextcloud.com>
_get_php_versions() {
- local _phps=(php7 php)
local _min _max
_min=$(sed -nr 's/^.*PHP_VERSION_ID < ([0-9]*).*$/\1/p' $pkgname/lib/versioncheck.php)
@@ -76,72 +75,29 @@
_min_php="${_min:0:1}.${_min:2:1}"
_max_php="${_max:0:1}.${_max:2:1}"
- _php_interpreter=""
- for _php in "${_phps[@]}"; do
- if command -v "$_php" > /dev/null; then
- if [[ -z "$_php_interpreter" ]]; then
- _php_interpreter="$_php"
- fi
- fi
- done
- _system_php="$($_php_interpreter --version |head -n1 |cut -d ' ' -f2)"
- printf "Detected php interpreter %s\n" $_php_interpreter
- printf "Detected php %s\n" $_system_php
printf "%s requires %s >= php < %s\n" $pkgname $_min_php $_max_php
}
-prepare() {
- local _file
-
- _get_php_versions
-
- # setup files with default PHP interpreter
- mkdir -vp custom_files
- for _file in nextcloud.{occ.sh,uwsgi} nextcloud-cron.service; do
- sed "s/PHP_INTERPRETER/$_php_interpreter/g" $_file > custom_files/$_file
- done
-}
-
check() {
- _get_php_versions
- if [[ "$(vercmp "$_system_php" "$_min_php" )" -lt 0 ]]; then
- printf "%s requires php >= %s, but %s is provided\n" $pkgname $_min_php $_system_php
- exit 1
- fi
- if [[ "$(vercmp "$_system_php" "$_max_php" )" -gt 0 ]]; then
- printf "%s requires php < %s, but %s is provided\n" $pkgname $_max_php $_system_php
- exit 1
- fi
+ php-legacy -f "$pkgname/lib/versioncheck.php"
}
package() {
- local _dep_ver=""
-
_get_php_versions
- depends=("php-interpreter<$_max_php")
-
- # NOTE: this sets up a custom prefix based on the php major version for for a php based package (e.g. php7-apcu)
- if [[ "$_php_interpreter" != *php ]]; then
- _dep_ver="${_system_php%%.*}"
- fi
-
- depends+=("php$_dep_ver-gd")
-
- # NOTE: due to weird makepkg checks we can't add optdepends with dynamically derived contents directly
- _optdepends=(
- "php$_dep_ver-apcu: for caching with APCU"
- "php$_dep_ver-apache: to use the Apache web server"
- "php$_dep_ver-fpm: to run in fastCGI process manager"
- "php$_dep_ver-imagick: for preview generation"
- "php$_dep_ver-imap: for external user authentication"
- "php$_dep_ver-intl: to increase language translation performance and fix sorting"
- "php$_dep_ver-memcached: for caching with memcached"
- "php$_dep_ver-pgsql: to use the PostgreSQL database backend"
- "php$_dep_ver-redis: for caching with redis"
- "php$_dep_ver-sqlite: to use the SQLite database backend"
- "uwsgi-plugin-php$_dep_ver: run as application container"
+ depends=("php-interpreter<$_max_php" 'php-legacy-gd')
+ optdepends=(
+ 'php-legacy-apcu: for caching with APCU'
+ 'php-legacy-apache: to use the Apache web server'
+ 'php-legacy-fpm: to run in fastCGI process manager'
+ 'php-legacy-imagick: for preview generation'
+ 'php-legacy-imap: for external user authentication'
+ 'php-legacy-intl: to increase language translation performance and fix sorting'
+ 'php-legacy-memcached: for caching with memcached'
+ 'php-legacy-pgsql: to use the PostgreSQL database backend'
+ 'php-legacy-redis: for caching with redis'
+ 'php-legacy-sqlite: to use the SQLite database backend'
+ 'uwsgi-plugin-php-legacy: run as application container'
)
- optdepends+=("${_optdepends[@]}")
cd $pkgname
# sysusers.d integration
@@ -155,7 +111,7 @@
# log dir
install -vdm 755 "$pkgdir/var/log/$pkgname/"
# uwsgi integration
- install -vDm 644 ../custom_files/$pkgname.uwsgi "$pkgdir/etc/uwsgi/$pkgname.ini"
+ install -vDm 644 ../$pkgname.uwsgi "$pkgdir/etc/uwsgi/$pkgname.ini"
# config dir
install -vDm 644 .htaccess -t "$pkgdir/etc/webapps/$pkgname/"
install -vDm 640 ../$pkgname.config.php "$pkgdir/etc/webapps/$pkgname/config/config.php"
@@ -175,12 +131,12 @@
# install occ command
install -vDm 755 occ -t "$pkgdir/usr/share/webapps/$pkgname/"
# occ script
- install -vDm 755 ../custom_files/$pkgname.occ.sh "$pkgdir/usr/bin/occ"
+ install -vDm 755 ../$pkgname.occ.sh "$pkgdir/usr/bin/occ"
# optional pacman hook
install -vDm 644 ../$pkgname.hook -t "$pkgdir/usr/share/doc/$pkgname/"
# apache example conf
install -vDm 644 ../apache.example.conf -t "$pkgdir/usr/share/doc/$pkgname/"
# systemd service
- install -vDm 644 ../custom_files/$pkgname-cron.service -t "$pkgdir/usr/lib/systemd/system/"
+ install -vDm 644 ../$pkgname-cron.service -t "$pkgdir/usr/lib/systemd/system/"
install -vDm 644 ../$pkgname-cron.timer -t "$pkgdir/usr/lib/systemd/system/"
}
Index: nextcloud-cron.service
===================================================================
--- nextcloud-cron.service (revision 1363433)
+++ nextcloud-cron.service (working copy)
@@ -4,4 +4,4 @@
[Service]
KillMode=mixed
User=nextcloud
-ExecStart=/usr/bin/PHP_INTERPRETER -f /usr/share/webapps/nextcloud/cron.php
+ExecStart=/usr/bin/php-legacy -f /usr/share/webapps/nextcloud/cron.php
Index: nextcloud.occ.sh
===================================================================
--- nextcloud.occ.sh (revision 1363433)
+++ nextcloud.occ.sh (working copy)
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
-readonly default_config="/etc/php/php.ini"
-readonly default_php_command="/usr/bin/PHP_INTERPRETER"
+readonly default_config="/etc/php-legacy/php.ini"
+readonly default_php_command="/usr/bin/php-legacy"
readonly default_user="nextcloud"
readonly preserved_environment_vars="NEXTCLOUD_CONFIG_DIR"
Index: nextcloud.uwsgi
===================================================================
--- nextcloud.uwsgi (revision 1363433)
+++ nextcloud.uwsgi (working copy)
@@ -1,6 +1,6 @@
[uwsgi]
procname-master = %n
-plugins = PHP_INTERPRETER
+plugins = php_legacy
master = true
socket = /run/%n/%n.sock
# uncomment for a stats socket, that can be used with uwsgitop
@@ -24,7 +24,7 @@
php-docroot = /usr/share/webapps/%n
php-index = index.php
php-set = date.timezone=Europe/Berlin
-php-set = open_basedir=%(cloud_data_dir):%(cloud_writable_apps_dir):/var/lib/%n:/tmp/:/usr/share/webapps/%n:/etc/webapps/%n:/dev/urandom:/usr/lib/PHP_INTERPRETER/modules:/run/redis/redis.sock:/var/log/%n/%n.log:/proc/meminfo
+php-set = open_basedir=%(cloud_data_dir):%(cloud_writable_apps_dir):/var/lib/%n:/tmp/:/usr/share/webapps/%n:/etc/webapps/%n:/dev/urandom:/usr/lib/php-legacy/modules:/run/redis/redis.sock:/var/log/%n/%n.log:/proc/meminfo
php-set = session.save_path=/tmp
php-set = session.gc_maxlifetime 21600
php-set = session.gc_divisor 500
@@ -79,4 +79,4 @@
# change the URL to your own address and uncomment to run a webcron job every five minutes
# cron = -5 -1 -1 -1 -1 curl --silent https://change.me.tld/cron.php 1>/dev/null
# uncomment to run a cron job every five minutes
-# cron = -5 -1 -1 -1 -1 php -f /usr/share/webapps/%n/cron.php
+# cron = -5 -1 -1 -1 -1 php-legacy -f /usr/share/webapps/%n/cron.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment