From c98913ac5e7e93e3dc1c8d5ebde117f6df1c854d Mon Sep 17 00:00:00 2001 From: Tee KOBAYASHI Date: Mon, 4 Apr 2022 18:09:19 +0900 Subject: [PATCH] new package: z-push --- packages/z-push/build.sh | 29 +++++++++++++++++++ ...fig-apache2-z-push-autodiscover.conf.patch | 12 ++++++++ .../z-push/config-apache2-z-push.conf.patch | 14 +++++++++ .../z-push/src-autodiscover-config.php.patch | 11 +++++++ .../z-push/src-backend-imap-config.php.patch | 11 +++++++ .../z-push/src-backend-imap-imap.php.patch | 11 +++++++ .../src-backend-kopano-checkshares.php.patch | 24 +++++++++++++++ .../src-backend-kopano-config.php.patch | 24 +++++++++++++++ .../src-backend-kopano-listfolders.php.patch | 24 +++++++++++++++ .../src-backend-vcarddir-config.php.patch | 8 +++++ packages/z-push/src-config.php.patch | 20 +++++++++++++ 11 files changed, 188 insertions(+) create mode 100644 packages/z-push/build.sh create mode 100644 packages/z-push/config-apache2-z-push-autodiscover.conf.patch create mode 100644 packages/z-push/config-apache2-z-push.conf.patch create mode 100644 packages/z-push/src-autodiscover-config.php.patch create mode 100644 packages/z-push/src-backend-imap-config.php.patch create mode 100644 packages/z-push/src-backend-imap-imap.php.patch create mode 100644 packages/z-push/src-backend-kopano-checkshares.php.patch create mode 100644 packages/z-push/src-backend-kopano-config.php.patch create mode 100644 packages/z-push/src-backend-kopano-listfolders.php.patch create mode 100644 packages/z-push/src-backend-vcarddir-config.php.patch create mode 100644 packages/z-push/src-config.php.patch diff --git a/packages/z-push/build.sh b/packages/z-push/build.sh new file mode 100644 index 000000000..8fcc7c784 --- /dev/null +++ b/packages/z-push/build.sh @@ -0,0 +1,29 @@ +TERMUX_PKG_HOMEPAGE=https://z-push.org/ +TERMUX_PKG_DESCRIPTION="An open-source application to synchronize ActiveSync compatible devices and Outlook" +TERMUX_PKG_LICENSE="AGPL-V3" +TERMUX_PKG_MAINTAINER="@termux" +TERMUX_PKG_VERSION=2.6.4 +TERMUX_PKG_SRCURL=https://github.com/Z-Hub/Z-Push/archive/refs/tags/${TERMUX_PKG_VERSION}.tar.gz +TERMUX_PKG_SHA256=7795ae7165fa3fb39a6ba40ca3e79609767e0c78c01857ede0f7014b90b27431 +TERMUX_PKG_DEPENDS="apache2, php" +TERMUX_PKG_PLATFORM_INDEPENDENT=true +TERMUX_PKG_BUILD_IN_SRC=true + +termux_step_make_install() { + cp -rT src $TERMUX_PREFIX/share/z-push + local f + for f in z-push-{admin,top}; do + ln -sfr $TERMUX_PREFIX/share/z-push/${f}.php $TERMUX_PREFIX/bin/${f} + install -Dm600 -t $TERMUX_PREFIX/share/man/man8 man/${f}.8 + done + install -Dm600 -t $TERMUX_PREFIX/etc/apache2/conf.d config/apache2/*.conf +} + +termux_step_create_debscripts() { + cat <<- EOF > ./postinst + #!$TERMUX_PREFIX/bin/sh + mkdir -p $TERMUX_PREFIX/var/lib/z-push + mkdir -p $TERMUX_PREFIX/var/log/z-push + EOF +} + diff --git a/packages/z-push/config-apache2-z-push-autodiscover.conf.patch b/packages/z-push/config-apache2-z-push-autodiscover.conf.patch new file mode 100644 index 000000000..bbb7b61dd --- /dev/null +++ b/packages/z-push/config-apache2-z-push-autodiscover.conf.patch @@ -0,0 +1,12 @@ +--- a/config/apache2/z-push-autodiscover.conf ++++ b/config/apache2/z-push-autodiscover.conf +@@ -1,6 +1,6 @@ + # Z-Push AutoDiscover - ActiveSync over-the-air - default Apache configuration + +- Alias /AutoDiscover/AutoDiscover.xml "/usr/share/z-push/autodiscover/autodiscover.php" +- Alias /Autodiscover/Autodiscover.xml "/usr/share/z-push/autodiscover/autodiscover.php" +- Alias /autodiscover/autodiscover.xml "/usr/share/z-push/autodiscover/autodiscover.php" ++ Alias /AutoDiscover/AutoDiscover.xml "@TERMUX_PREFIX@/share/z-push/autodiscover/autodiscover.php" ++ Alias /Autodiscover/Autodiscover.xml "@TERMUX_PREFIX@/share/z-push/autodiscover/autodiscover.php" ++ Alias /autodiscover/autodiscover.xml "@TERMUX_PREFIX@/share/z-push/autodiscover/autodiscover.php" + diff --git a/packages/z-push/config-apache2-z-push.conf.patch b/packages/z-push/config-apache2-z-push.conf.patch new file mode 100644 index 000000000..f6bf5beda --- /dev/null +++ b/packages/z-push/config-apache2-z-push.conf.patch @@ -0,0 +1,14 @@ +--- a/config/apache2/z-push.conf ++++ b/config/apache2/z-push.conf +@@ -1,9 +1,9 @@ + # Z-Push - ActiveSync over-the-air - default Apache configuration + +- Alias /Microsoft-Server-ActiveSync /usr/share/z-push/index.php ++ Alias /Microsoft-Server-ActiveSync @TERMUX_PREFIX@/share/z-push/index.php + + +- ++ + # Don't list a directory index, follow symlinks (maybe state dir is somewhere linked) + DirectoryIndex index.php + Options -Indexes +FollowSymLinks diff --git a/packages/z-push/src-autodiscover-config.php.patch b/packages/z-push/src-autodiscover-config.php.patch new file mode 100644 index 000000000..9332bc1f0 --- /dev/null +++ b/packages/z-push/src-autodiscover-config.php.patch @@ -0,0 +1,11 @@ +--- a/src/autodiscover/config.php ++++ b/src/autodiscover/config.php +@@ -87,7 +87,7 @@ + + define('LOGBACKEND', 'filelog'); + +- define('LOGFILEDIR', '/var/log/z-push/'); ++ define('LOGFILEDIR', '@TERMUX_PREFIX@/var/log/z-push/'); + define('LOGFILE', LOGFILEDIR . 'autodiscover.log'); + define('LOGERRORFILE', LOGFILEDIR . 'autodiscover-error.log'); + define('LOGLEVEL', LOGLEVEL_INFO); diff --git a/packages/z-push/src-backend-imap-config.php.patch b/packages/z-push/src-backend-imap-config.php.patch new file mode 100644 index 000000000..fb9d0d965 --- /dev/null +++ b/packages/z-push/src-backend-imap-config.php.patch @@ -0,0 +1,11 @@ +--- a/src/backend/imap/config.php ++++ b/src/backend/imap/config.php +@@ -204,7 +204,7 @@ + + // A file containing file mime types->extension mappings. + // SELINUX users: make sure the file has a security context accesible by your apache/php-fpm process +-define('SYSTEM_MIME_TYPES_MAPPING', '/etc/mime.types'); ++define('SYSTEM_MIME_TYPES_MAPPING', '@TERMUX_PREFIX@/etc/mime.types'); + + + // Use BackendCalDAV for Meetings. You cannot hope to get that functionality working without a caldav backend. diff --git a/packages/z-push/src-backend-imap-imap.php.patch b/packages/z-push/src-backend-imap-imap.php.patch new file mode 100644 index 000000000..f80a00574 --- /dev/null +++ b/packages/z-push/src-backend-imap-imap.php.patch @@ -0,0 +1,11 @@ +--- a/src/backend/imap/imap.php ++++ b/src/backend/imap/imap.php +@@ -35,7 +35,7 @@ + // Add the path for Andrew's Web Libraries to include_path + // because it is required for the emails with ics attachments + // @see https://jira.z-hub.io/browse/ZP-1149 +-set_include_path(get_include_path() . PATH_SEPARATOR . '/usr/share/awl/inc' . PATH_SEPARATOR . dirname(__FILE__) . '/'); ++set_include_path(get_include_path() . PATH_SEPARATOR . '@TERMUX_PREFIX@/share/awl/inc' . PATH_SEPARATOR . dirname(__FILE__) . '/'); + + class BackendIMAP extends BackendDiff implements ISearchProvider { + private $wasteID; diff --git a/packages/z-push/src-backend-kopano-checkshares.php.patch b/packages/z-push/src-backend-kopano-checkshares.php.patch new file mode 100644 index 000000000..5dd2ec050 --- /dev/null +++ b/packages/z-push/src-backend-kopano-checkshares.php.patch @@ -0,0 +1,24 @@ +--- a/src/backend/kopano/checkshares.php ++++ b/src/backend/kopano/checkshares.php +@@ -67,10 +67,10 @@ + $this->server = 'default:'; + } + elseif ($this->checkMapiExtVersion('7.2.0')) { +- $this->server = 'file:///var/run/zarafad/server.sock'; ++ $this->server = 'file://@TERMUX_PREFIX@/var/run/zarafad/server.sock'; + } + else { +- $this->server = 'file:///var/run/zarafa'; ++ $this->server = 'file://@TERMUX_PREFIX@/var/run/zarafa'; + } + } + +@@ -331,7 +331,7 @@ + -s|--server - KC server location URI or path, e.g http://localhost:236 or default:. + -U|--remoteuser - login as authenticated administration user. + -P|--password - password for the administration user. +--C|--certpath - login with a ssl certificate located in this location, e.g. /etc/kopano/ssl/client.pem. ++-C|--certpath - login with a ssl certificate located in this location, e.g. @TERMUX_PREFIX@/etc/kopano/ssl/client.pem. + -W|--certpassword - password for the ssl certificate for login. + + USAGE; diff --git a/packages/z-push/src-backend-kopano-config.php.patch b/packages/z-push/src-backend-kopano-config.php.patch new file mode 100644 index 000000000..e9d519150 --- /dev/null +++ b/packages/z-push/src-backend-kopano-config.php.patch @@ -0,0 +1,24 @@ +--- a/src/backend/kopano/config.php ++++ b/src/backend/kopano/config.php +@@ -31,17 +31,17 @@ + // + // Depending on your setup, it might be advisable to change the lines below to one defined with your + // default socket location. +-// Normally "default:" points to the default setting ("file:///var/run/kopano/server.sock") ++// Normally "default:" points to the default setting ("file://@TERMUX_PREFIX@/var/run/kopano/server.sock") + // Examples: define("MAPI_SERVER", "default:"); + // define("MAPI_SERVER", "http://localhost:236/kopano"); + // define("MAPI_SERVER", "https://localhost:237/kopano"); +-// define("MAPI_SERVER", "file:///var/run/kopano/server.sock"); ++// define("MAPI_SERVER", "file://@TERMUX_PREFIX@/var/run/kopano/server.sock"); + // If you are using ZCP >= 7.2.0, set it to the zarafa location, e.g. + // define("MAPI_SERVER", "http://localhost:236/zarafa"); + // define("MAPI_SERVER", "https://localhost:237/zarafa"); +-// define("MAPI_SERVER", "file:///var/run/zarafad/server.sock"); ++// define("MAPI_SERVER", "file://@TERMUX_PREFIX@/var/run/zarafad/server.sock"); + // For ZCP versions prior to 7.2.0 the socket location is different (http(s) sockets are the same): +-// define("MAPI_SERVER", "file:///var/run/zarafa"); ++// define("MAPI_SERVER", "file://@TERMUX_PREFIX@/var/run/zarafa"); + + define('MAPI_SERVER', 'default:'); + diff --git a/packages/z-push/src-backend-kopano-listfolders.php.patch b/packages/z-push/src-backend-kopano-listfolders.php.patch new file mode 100644 index 000000000..44f0bf60e --- /dev/null +++ b/packages/z-push/src-backend-kopano-listfolders.php.patch @@ -0,0 +1,24 @@ +--- a/src/backend/kopano/listfolders.php ++++ b/src/backend/kopano/listfolders.php +@@ -31,10 +31,10 @@ + define('MAPI_SERVER', 'default:'); + } + elseif (CheckMapiExtVersion('7.2.0')) { +- define('MAPI_SERVER', 'file:///var/run/zarafad/server.sock'); ++ define('MAPI_SERVER', 'file://@TERMUX_PREFIX@/var/run/zarafad/server.sock'); + } + else { +- define('MAPI_SERVER', 'file:///var/run/zarafa'); ++ define('MAPI_SERVER', 'file://@TERMUX_PREFIX@/var/run/zarafa'); + } + define('SSLCERT_FILE', null); + define('SSLCERT_PASS', null); +@@ -102,7 +102,7 @@ + listfolders_getlist($zarafaAdmin['adminStore'], $zarafaAdmin['session'], trim($options['l'])); + } + else { +- echo "Usage:\nlistfolders.php [actions] [options]\n\nActions: [-l username]\n\t-l username\tlist folders of user, for public folder use 'SYSTEM'\n\nGlobal options: [-h path] [[-u remoteuser] [-p password]] [[-c certificate_path] [-p password]]\n\t-h path\t\tconnect through , e.g. file:///var/run/socket or https://10.0.0.1:237/kopano\n\t-u remoteuser\tlogin as authenticated administration user\n\t-c certificate\tlogin with a ssl certificate located in this location, e.g. /etc/zarafa/ssl/client.pem\n\t-p password\tpassword of the remoteuser or certificate\n\n"; ++ echo "Usage:\nlistfolders.php [actions] [options]\n\nActions: [-l username]\n\t-l username\tlist folders of user, for public folder use 'SYSTEM'\n\nGlobal options: [-h path] [[-u remoteuser] [-p password]] [[-c certificate_path] [-p password]]\n\t-h path\t\tconnect through , e.g. file://@TERMUX_PREFIX@/var/run/socket or https://10.0.0.1:237/kopano\n\t-u remoteuser\tlogin as authenticated administration user\n\t-c certificate\tlogin with a ssl certificate located in this location, e.g. @TERMUX_PREFIX@/etc/zarafa/ssl/client.pem\n\t-p password\tpassword of the remoteuser or certificate\n\n"; + } + } + diff --git a/packages/z-push/src-backend-vcarddir-config.php.patch b/packages/z-push/src-backend-vcarddir-config.php.patch new file mode 100644 index 000000000..7c819f5c7 --- /dev/null +++ b/packages/z-push/src-backend-vcarddir-config.php.patch @@ -0,0 +1,8 @@ +--- a/src/backend/vcarddir/config.php ++++ b/src/backend/vcarddir/config.php +@@ -27,4 +27,4 @@ + // BackendVCardDir settings + // ********************** + +-define('VCARDDIR_DIR', '/home/%u/.kde/share/apps/kabc/stdvcf'); ++define('VCARDDIR_DIR', '@TERMUX_HOME@/.kde/share/apps/kabc/stdvcf'); diff --git a/packages/z-push/src-config.php.patch b/packages/z-push/src-config.php.patch new file mode 100644 index 000000000..72b943a1e --- /dev/null +++ b/packages/z-push/src-config.php.patch @@ -0,0 +1,20 @@ +--- a/src/config.php ++++ b/src/config.php +@@ -68,7 +68,7 @@ + * State migration script is available, more informations: https://wiki.z-hub.io/x/xIAa + */ + define('STATE_MACHINE', 'FILE'); +- define('STATE_DIR', '/var/lib/z-push/'); ++ define('STATE_DIR', '@TERMUX_PREFIX@/var/lib/z-push/'); + + /********************************************************************************** + * IPC - InterProcessCommunication +@@ -123,7 +123,7 @@ + $specialLogUsers = array(); + + // Filelog settings +- define('LOGFILEDIR', '/var/log/z-push/'); ++ define('LOGFILEDIR', '@TERMUX_PREFIX@/var/log/z-push/'); + define('LOGFILE', LOGFILEDIR . 'z-push.log'); + define('LOGERRORFILE', LOGFILEDIR . 'z-push-error.log'); +