mirror of
https://github.com/YunoHost-Apps/z-push_ynh.git
synced 2024-09-03 18:05:58 +02:00
commit
a669c838c6
20 changed files with 226 additions and 795 deletions
106
.github/workflows/updater.sh
vendored
106
.github/workflows/updater.sh
vendored
|
@ -1,106 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# PACKAGE UPDATING HELPER
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# This script is meant to be run by GitHub Actions
|
|
||||||
# The YunoHost-Apps organisation offers a template Action to run this script periodically
|
|
||||||
# Since each app is different, maintainers can adapt its contents so as to perform
|
|
||||||
# automatic actions when a new upstream release is detected.
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# FETCHING LATEST RELEASE AND ITS ASSETS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Fetching information
|
|
||||||
current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
|
|
||||||
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
|
|
||||||
# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions)
|
|
||||||
version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1)
|
|
||||||
assets="https://github.com/Z-Hub/Z-Push/archive/$version.tar.gz"
|
|
||||||
|
|
||||||
# Later down the script, we assume the version has only digits and dots
|
|
||||||
# Sometimes the release name starts with a "v", so let's filter it out.
|
|
||||||
# You may need more tweaks here if the upstream repository has different naming conventions.
|
|
||||||
if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then
|
|
||||||
version=${version:1}
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Setting up the environment variables
|
|
||||||
echo "Current version: $current_version"
|
|
||||||
echo "Latest release from upstream: $version"
|
|
||||||
echo "VERSION=$version" >> $GITHUB_ENV
|
|
||||||
# For the time being, let's assume the script will fail
|
|
||||||
echo "PROCEED=false" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
# Proceed only if the retrieved version is greater than the current one
|
|
||||||
if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then
|
|
||||||
echo "::warning ::No new version available"
|
|
||||||
exit 0
|
|
||||||
# Proceed only if a PR for this new version does not already exist
|
|
||||||
elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then
|
|
||||||
echo "::warning ::A branch already exists for this update"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# UPDATE SOURCE FILES
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Let's download source tarball
|
|
||||||
asset_url=$assets
|
|
||||||
|
|
||||||
echo "Handling asset at $asset_url"
|
|
||||||
|
|
||||||
src="app"
|
|
||||||
|
|
||||||
# Create the temporary directory
|
|
||||||
tempdir="$(mktemp -d)"
|
|
||||||
|
|
||||||
# Download sources and calculate checksum
|
|
||||||
filename=${asset_url##*/}
|
|
||||||
curl --silent -4 -L $asset_url -o "$tempdir/$filename"
|
|
||||||
checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
|
|
||||||
|
|
||||||
# Delete temporary directory
|
|
||||||
rm -rf $tempdir
|
|
||||||
|
|
||||||
# Get extension
|
|
||||||
if [[ $filename == *.tar.gz ]]; then
|
|
||||||
extension=tar.gz
|
|
||||||
else
|
|
||||||
extension=${filename##*.}
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Rewrite source file
|
|
||||||
cat <<EOT > conf/$src.src
|
|
||||||
SOURCE_URL=$asset_url
|
|
||||||
SOURCE_SUM=$checksum
|
|
||||||
SOURCE_SUM_PRG=sha256sum
|
|
||||||
SOURCE_FORMAT=$extension
|
|
||||||
SOURCE_IN_SUBDIR=true
|
|
||||||
SOURCE_FILENAME=
|
|
||||||
SOURCE_EXTRACT=true
|
|
||||||
EOT
|
|
||||||
echo "... conf/$src.src updated"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC UPDATE STEPS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Any action on the app's source code can be done.
|
|
||||||
# The GitHub Action workflow takes care of committing all changes after this script ends.
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Replace new version in manifest
|
|
||||||
echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json
|
|
||||||
|
|
||||||
# No need to update the README, yunohost-bot takes care of it
|
|
||||||
|
|
||||||
# The Action will proceed only if the PROCEED environment variable is set to true
|
|
||||||
echo "PROCEED=true" >> $GITHUB_ENV
|
|
||||||
exit 0
|
|
49
.github/workflows/updater.yml
vendored
49
.github/workflows/updater.yml
vendored
|
@ -1,49 +0,0 @@
|
||||||
# This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected.
|
|
||||||
# You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization.
|
|
||||||
# This file should be enough by itself, but feel free to tune it to your needs.
|
|
||||||
# It calls updater.sh, which is where you should put the app-specific update steps.
|
|
||||||
name: Check for new upstream releases
|
|
||||||
on:
|
|
||||||
# Allow to manually trigger the workflow
|
|
||||||
workflow_dispatch:
|
|
||||||
# Run it every day at 6:00 UTC
|
|
||||||
schedule:
|
|
||||||
- cron: '0 6 * * *'
|
|
||||||
jobs:
|
|
||||||
updater:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Fetch the source code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- name: Run the updater script
|
|
||||||
id: run_updater
|
|
||||||
run: |
|
|
||||||
# Setting up Git user
|
|
||||||
git config --global user.name 'yunohost-bot'
|
|
||||||
git config --global user.email 'yunohost-bot@users.noreply.github.com'
|
|
||||||
# Run the updater script
|
|
||||||
/bin/bash .github/workflows/updater.sh
|
|
||||||
- name: Commit changes
|
|
||||||
id: commit
|
|
||||||
if: ${{ env.PROCEED == 'true' }}
|
|
||||||
run: |
|
|
||||||
git commit -am "Upgrade to v$VERSION"
|
|
||||||
- name: Create Pull Request
|
|
||||||
id: cpr
|
|
||||||
if: ${{ env.PROCEED == 'true' }}
|
|
||||||
uses: peter-evans/create-pull-request@v4
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
commit-message: Update to version ${{ env.VERSION }}
|
|
||||||
committer: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
|
|
||||||
author: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
|
|
||||||
signoff: false
|
|
||||||
base: testing
|
|
||||||
branch: ci-auto-update-v${{ env.VERSION }}
|
|
||||||
delete-branch: true
|
|
||||||
title: 'Upgrade to version ${{ env.VERSION }}'
|
|
||||||
body: |
|
|
||||||
Upgrade to v${{ env.VERSION }}
|
|
||||||
draft: false
|
|
|
@ -19,17 +19,13 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
|
||||||
Z-Push is an Exchange ActiveSync fronted written in PHP which lets you synchronize emails (IMAP/SMTP backend) and calendar/contacts (cardDAV and caldDAV backend)
|
Z-Push is an Exchange ActiveSync fronted written in PHP which lets you synchronize emails (IMAP/SMTP backend) and calendar/contacts (cardDAV and caldDAV backend)
|
||||||
|
|
||||||
|
|
||||||
**Shipped version:** 2.7.0~ynh3
|
**Shipped version:** 2.7.1~ynh1
|
||||||
## Disclaimers / important information
|
|
||||||
|
|
||||||
* would be better to create a dedicated domain: autodiscover.yourdomain.org
|
|
||||||
|
|
||||||
## Documentation and resources
|
## Documentation and resources
|
||||||
|
|
||||||
* Official app website: <http://z-push.org>
|
* Official app website: <http://z-push.org>
|
||||||
* Official admin documentation: <https://wiki.z-hub.io/display/ZP/Documentation>
|
* Official admin documentation: <https://wiki.z-hub.io/display/ZP/Documentation>
|
||||||
* Upstream app code repository: <https://github.com/Z-Hub/Z-Push>
|
* Upstream app code repository: <https://github.com/Z-Hub/Z-Push>
|
||||||
* YunoHost documentation for this app: <https://yunohost.org/app_z-push>
|
* YunoHost Store: <https://apps.yunohost.org/app/z-push>
|
||||||
* Report a bug: <https://github.com/YunoHost-Apps/z-push_ynh/issues>
|
* Report a bug: <https://github.com/YunoHost-Apps/z-push_ynh/issues>
|
||||||
|
|
||||||
## Developer info
|
## Developer info
|
||||||
|
|
|
@ -19,17 +19,13 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po
|
||||||
Z-Push is an Exchange ActiveSync fronted written in PHP which lets you synchronize emails (IMAP/SMTP backend) and calendar/contacts (cardDAV and caldDAV backend)
|
Z-Push is an Exchange ActiveSync fronted written in PHP which lets you synchronize emails (IMAP/SMTP backend) and calendar/contacts (cardDAV and caldDAV backend)
|
||||||
|
|
||||||
|
|
||||||
**Version incluse :** 2.7.0~ynh3
|
**Version incluse :** 2.7.1~ynh1
|
||||||
## Avertissements / informations importantes
|
|
||||||
|
|
||||||
* would be better to create a dedicated domain: autodiscover.yourdomain.org
|
|
||||||
|
|
||||||
## Documentations et ressources
|
## Documentations et ressources
|
||||||
|
|
||||||
* Site officiel de l’app : <http://z-push.org>
|
* Site officiel de l’app : <http://z-push.org>
|
||||||
* Documentation officielle de l’admin : <https://wiki.z-hub.io/display/ZP/Documentation>
|
* Documentation officielle de l’admin : <https://wiki.z-hub.io/display/ZP/Documentation>
|
||||||
* Dépôt de code officiel de l’app : <https://github.com/Z-Hub/Z-Push>
|
* Dépôt de code officiel de l’app : <https://github.com/Z-Hub/Z-Push>
|
||||||
* Documentation YunoHost pour cette app : <https://yunohost.org/app_z-push>
|
* YunoHost Store: <https://apps.yunohost.org/app/z-push>
|
||||||
* Signaler un bug : <https://github.com/YunoHost-Apps/z-push_ynh/issues>
|
* Signaler un bug : <https://github.com/YunoHost-Apps/z-push_ynh/issues>
|
||||||
|
|
||||||
## Informations pour les développeurs
|
## Informations pour les développeurs
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
;; Test complet
|
|
||||||
; Manifest
|
|
||||||
domain="domain.tld"
|
|
||||||
path="/Microsoft-Server-ActiveSync"
|
|
||||||
; Checks
|
|
||||||
pkg_linter=1
|
|
||||||
setup_sub_dir=1
|
|
||||||
setup_root=0
|
|
||||||
setup_nourl=0
|
|
||||||
setup_private=0
|
|
||||||
setup_public=1
|
|
||||||
upgrade=1
|
|
||||||
# 2.5.1~ynh3
|
|
||||||
# upgrade=1 from_commit=9e8a72669814237122dfc6f901c9377895c193db
|
|
||||||
# 2.5.2~ynh1
|
|
||||||
# upgrade=1 from_commit=a857788c1fb369baa5f0608da12013b003cceed3
|
|
||||||
# 2.6.1~ynh1
|
|
||||||
# upgrade=1 from_commit=a05896f0e4f2b015dcf643c644ac6c98c2f6695b
|
|
||||||
# 2.6.1~ynh2
|
|
||||||
upgrade=1 from_commit=8e99ec37fb90d1ac4f8eb2c838e6d2e1f5b0c905
|
|
||||||
# 2.6.1~ynh3
|
|
||||||
upgrade=1 from_commit=f101d8cb5701c46db0d6cf5aaa02b1e7f8e0dec2
|
|
||||||
# 2.6.4~ynh1
|
|
||||||
upgrade=1 from_commit=065dc9bf0076090cb6457ef54c87ef0200d72103
|
|
||||||
backup_restore=1
|
|
||||||
multi_instance=1
|
|
||||||
port_already_use=0
|
|
||||||
change_url=0
|
|
||||||
;;; Options
|
|
||||||
Email=yalh@yahoo.com
|
|
||||||
Notification=all
|
|
|
@ -1,7 +0,0 @@
|
||||||
SOURCE_URL=https://github.com/Z-Hub/Z-Push/archive/2.7.0.tar.gz
|
|
||||||
SOURCE_SUM=0d3507af509723c0a145a910c707dce81adb5535b83455c05ebf070880988c66
|
|
||||||
SOURCE_SUM_PRG=sha256sum
|
|
||||||
SOURCE_FORMAT=tar.gz
|
|
||||||
SOURCE_IN_SUBDIR=true
|
|
||||||
SOURCE_FILENAME=
|
|
||||||
SOURCE_EXTRACT=true
|
|
|
@ -87,7 +87,7 @@
|
||||||
|
|
||||||
define('LOGBACKEND', 'filelog');
|
define('LOGBACKEND', 'filelog');
|
||||||
|
|
||||||
define('LOGFILEDIR', '__FINAL_LOGPATH__/');
|
define('LOGFILEDIR', '__LOG_DIR__/');
|
||||||
define('LOGFILE', LOGFILEDIR . 'autodiscover.log');
|
define('LOGFILE', LOGFILEDIR . 'autodiscover.log');
|
||||||
define('LOGERRORFILE', LOGFILEDIR . 'autodiscover-error.log');
|
define('LOGERRORFILE', LOGFILEDIR . 'autodiscover-error.log');
|
||||||
define('LOGLEVEL', LOGLEVEL_ERROR);
|
define('LOGLEVEL', LOGLEVEL_ERROR);
|
||||||
|
|
|
@ -217,7 +217,7 @@ define('SYSTEM_MIME_TYPES_MAPPING', '/etc/mime.types');
|
||||||
|
|
||||||
|
|
||||||
// Use BackendCalDAV for Meetings. You cannot hope to get that functionality working without a caldav backend.
|
// Use BackendCalDAV for Meetings. You cannot hope to get that functionality working without a caldav backend.
|
||||||
define('IMAP_MEETING_USE_CALDAV', __FLAGTOCHANGE__);
|
define('IMAP_MEETING_USE_CALDAV', __IMAP_MEETING_USE_CALDAV__);
|
||||||
|
|
||||||
// If your IMAP server allows authenticating via GSSAPI, php-imap will not fall back properly to other authentication
|
// If your IMAP server allows authenticating via GSSAPI, php-imap will not fall back properly to other authentication
|
||||||
// methods and you will be unable to log in. Uncomment the following line to disable that authentication method.
|
// methods and you will be unable to log in. Uncomment the following line to disable that authentication method.
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
* State migration script is available, more informations: https://wiki.z-hub.io/x/xIAa
|
* State migration script is available, more informations: https://wiki.z-hub.io/x/xIAa
|
||||||
*/
|
*/
|
||||||
define('STATE_MACHINE', 'FILE');
|
define('STATE_MACHINE', 'FILE');
|
||||||
define('STATE_DIR', '__DATADIR__/');
|
define('STATE_DIR', '__DATA_DIR__/');
|
||||||
|
|
||||||
/**********************************************************************************
|
/**********************************************************************************
|
||||||
* IPC - InterProcessCommunication
|
* IPC - InterProcessCommunication
|
||||||
|
@ -120,7 +120,7 @@
|
||||||
$specialLogUsers = array();
|
$specialLogUsers = array();
|
||||||
|
|
||||||
// Filelog settings
|
// Filelog settings
|
||||||
define('LOGFILEDIR', '__FINAL_LOGPATH__/');
|
define('LOGFILEDIR', '__LOG_DIR__');
|
||||||
define('LOGFILE', LOGFILEDIR . 'z-push.log');
|
define('LOGFILE', LOGFILEDIR . 'z-push.log');
|
||||||
define('LOGERRORFILE', LOGFILEDIR . 'z-push-error.log');
|
define('LOGERRORFILE', LOGFILEDIR . 'z-push-error.log');
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
#sub_path_only rewrite ^Microsoft-Server-ActiveSync$ Microsoft-Server-ActiveSync/ permanent;
|
#sub_path_only rewrite ^Microsoft-Server-ActiveSync$ Microsoft-Server-ActiveSync/ permanent;
|
||||||
location /Microsoft-Server-ActiveSync {
|
rewrite ^/$ Microsoft-Server-ActiveSync/ permanent;
|
||||||
|
location /Microsoft-Server-ActiveSync/ {
|
||||||
|
|
||||||
# Path to source
|
# Path to source
|
||||||
alias __FINALPATH__/;
|
alias __INSTALL_DIR__/;
|
||||||
|
|
||||||
index index.php;
|
index index.php;
|
||||||
|
|
||||||
|
@ -27,7 +28,7 @@ location /Microsoft-Server-ActiveSync {
|
||||||
}
|
}
|
||||||
|
|
||||||
location /AutoDiscover/AutoDiscover.xml {
|
location /AutoDiscover/AutoDiscover.xml {
|
||||||
alias __FINALPATH__/autodiscover/autodiscover.php;
|
alias __INSTALL_DIR__/autodiscover/autodiscover.php;
|
||||||
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
|
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_param HTTPS on;
|
fastcgi_param HTTPS on;
|
||||||
|
@ -35,7 +36,7 @@ location /AutoDiscover/AutoDiscover.xml {
|
||||||
}
|
}
|
||||||
|
|
||||||
location /Autodiscover/Autodiscover.xml {
|
location /Autodiscover/Autodiscover.xml {
|
||||||
alias __FINALPATH__/autodiscover/autodiscover.php;
|
alias __INSTALL_DIR__/autodiscover/autodiscover.php;
|
||||||
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
|
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_param HTTPS on;
|
fastcgi_param HTTPS on;
|
||||||
|
@ -43,7 +44,7 @@ location /Autodiscover/Autodiscover.xml {
|
||||||
}
|
}
|
||||||
|
|
||||||
location /autodiscover/autodiscover.xml {
|
location /autodiscover/autodiscover.xml {
|
||||||
alias __FINALPATH__/autodiscover/autodiscover.php;
|
alias __INSTALL_DIR__/autodiscover/autodiscover.php;
|
||||||
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
|
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_param HTTPS on;
|
fastcgi_param HTTPS on;
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
* would be better to create a dedicated domain: autodiscover.yourdomain.org
|
|
|
@ -1,45 +0,0 @@
|
||||||
{
|
|
||||||
"name": "Z-Push",
|
|
||||||
"id": "z-push",
|
|
||||||
"packaging_format": 1,
|
|
||||||
"description": {
|
|
||||||
"en": "ActiveSync frontend that helps you synchronize emails, calendar and contacts",
|
|
||||||
"fr": "Frontend ActiveSync qui permet de synchroniser emails, calendrier et contacts"
|
|
||||||
},
|
|
||||||
"version": "2.7.0~ynh3",
|
|
||||||
"url": "https://z-push.org",
|
|
||||||
"upstream": {
|
|
||||||
"license": "AGPL-3.0-or-later",
|
|
||||||
"website": "http://z-push.org",
|
|
||||||
"admindoc": "https://wiki.z-hub.io/display/ZP/Documentation",
|
|
||||||
"code": "https://github.com/Z-Hub/Z-Push"
|
|
||||||
},
|
|
||||||
"license": "AGPL-3.0-or-later",
|
|
||||||
"maintainer": {
|
|
||||||
"name": "yalh76"
|
|
||||||
},
|
|
||||||
"previous_maintainer": [
|
|
||||||
{
|
|
||||||
"name": "beudbeud"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "polytan02"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"requirements": {
|
|
||||||
"yunohost": ">= 11.0.9"
|
|
||||||
},
|
|
||||||
"multi_instance": true,
|
|
||||||
"services": [
|
|
||||||
"nginx",
|
|
||||||
"php7.4-fpm"
|
|
||||||
],
|
|
||||||
"arguments": {
|
|
||||||
"install": [
|
|
||||||
{
|
|
||||||
"name": "domain",
|
|
||||||
"type": "domain"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
53
manifest.toml
Normal file
53
manifest.toml
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
packaging_format = 2
|
||||||
|
|
||||||
|
id = "z-push"
|
||||||
|
name = "Z-Push"
|
||||||
|
description.en = "ActiveSync frontend that helps you synchronize emails, calendar and contacts"
|
||||||
|
description.fr = "Frontend ActiveSync qui permet de synchroniser emails, calendrier et contacts"
|
||||||
|
|
||||||
|
version = "2.7.1~ynh1"
|
||||||
|
|
||||||
|
maintainers = ["yalh76"]
|
||||||
|
|
||||||
|
[upstream]
|
||||||
|
license = "AGPL-3.0-or-later"
|
||||||
|
website = "http://z-push.org"
|
||||||
|
admindoc = "https://wiki.z-hub.io/display/ZP/Documentation"
|
||||||
|
code = "https://github.com/Z-Hub/Z-Push"
|
||||||
|
|
||||||
|
[integration]
|
||||||
|
yunohost = ">= 11.2"
|
||||||
|
architectures = "all"
|
||||||
|
multi_instance = true
|
||||||
|
ldap = false
|
||||||
|
sso = false
|
||||||
|
disk = "50M"
|
||||||
|
ram.build = "50M"
|
||||||
|
ram.runtime = "50M"
|
||||||
|
|
||||||
|
[install]
|
||||||
|
|
||||||
|
[install.domain]
|
||||||
|
type = "domain"
|
||||||
|
|
||||||
|
[resources]
|
||||||
|
[resources.sources.main]
|
||||||
|
url = "https://github.com/Z-Hub/Z-Push/archive/2.7.1.tar.gz"
|
||||||
|
sha256 = "7aadddb5da06494a35c79e4b70d6ade6b2f62203f3df343077731f8952b64a41"
|
||||||
|
|
||||||
|
|
||||||
|
[resources.system_user]
|
||||||
|
|
||||||
|
[resources.install_dir]
|
||||||
|
|
||||||
|
[resources.data_dir]
|
||||||
|
|
||||||
|
[resources.permissions]
|
||||||
|
main.url = "/"
|
||||||
|
main.allowed = "visitors" # should it always be public ?
|
||||||
|
|
||||||
|
# FIXME: watdo with this ...
|
||||||
|
#REMOVEME? ynh_permission_create --permission="autodiscover" --url="re:$domain_regex/[Aa]uto[Dd]iscover/.*" --allowed="visitors" --show_tile="false" --protected="true"
|
||||||
|
|
||||||
|
[resources.apt]
|
||||||
|
packages = "php7.4-soap, php7.4-imap, php7.4-xsl, php7.4-curl, php7.4-xml, php7.4-ldap, php7.4-cli, php7.4-mbstring, php7.4-memcached, libawl-php"
|
|
@ -4,14 +4,6 @@
|
||||||
# COMMON VARIABLES
|
# COMMON VARIABLES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
YNH_PHP_VERSION="7.4"
|
|
||||||
|
|
||||||
php_dependencies="php${YNH_PHP_VERSION}-soap php${YNH_PHP_VERSION}-imap php${YNH_PHP_VERSION}-xsl php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-ldap php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-memcached"
|
|
||||||
|
|
||||||
# dependencies used by the app (must be on a single line)
|
|
||||||
pkg_dependencies="libawl-php $php_dependencies"
|
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -10,29 +10,6 @@
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# MANAGE SCRIPT FAILURE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_clean_setup () {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
ynh_print_info --message="Loading settings..."
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
|
||||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
|
||||||
final_logpath=$(ynh_app_setting_get --app=$app --key=final_logpath)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -42,13 +19,13 @@ ynh_print_info --message="Declaring files to be backed up..."
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="$final_path"
|
ynh_backup --src_path="$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE DATA DIR
|
# BACKUP THE DATA DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="$datadir" --is_big
|
ynh_backup --src_path="$data_dir" --is_big
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
|
|
244
scripts/install
244
scripts/install
|
@ -9,170 +9,75 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# MANAGE SCRIPT FAILURE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_clean_setup () {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
path="/Microsoft-Server-ActiveSync"
|
||||||
path_url="/Microsoft-Server-ActiveSync"
|
timezone="$(cat /etc/timezone)"
|
||||||
|
log_dir="/var/log/$app/"
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
|
||||||
|
|
||||||
final_path=/var/www/$app
|
|
||||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
|
||||||
|
|
||||||
# Register (book) web path
|
|
||||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STORE SETTINGS FROM MANIFEST
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Storing installation settings..." --weight=1
|
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
|
||||||
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD MODIFICATIONS
|
|
||||||
#=================================================
|
|
||||||
# INSTALL DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Installing dependencies..." --weight=1
|
|
||||||
ynh_script_progression --message="Installing dependencies..." --weight=1
|
|
||||||
ynh_script_progression --message="Installing dependencies..." --weight=1
|
|
||||||
ynh_script_progression --message="Installing dependencies..." --weight=1
|
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring system user..." --weight=1
|
|
||||||
|
|
||||||
# Create a system user
|
|
||||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up source files..." --weight=1
|
ynh_script_progression --message="Setting up source files..."
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
mkdir -p "$final_path/tmp"
|
mkdir -p "$install_dir/tmp"
|
||||||
ynh_setup_source --dest_dir="$final_path/tmp"
|
ynh_setup_source --dest_dir="$install_dir/tmp"
|
||||||
cp -af "$final_path/tmp/src/." "$final_path/."
|
cp -af "$install_dir/tmp/src/." "$install_dir/."
|
||||||
ynh_secure_remove "$final_path/tmp"
|
ynh_secure_remove "$install_dir/tmp"
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
chmod -R o-rwx "$install_dir"
|
||||||
chmod -R o-rwx "$final_path"
|
chown -R $app:www-data "$install_dir"
|
||||||
chown -R $app:www-data "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM CONFIGURATION
|
# PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring PHP-FPM..." --weight=1
|
ynh_script_progression --message="Installing system configurations..."
|
||||||
|
|
||||||
# Create a dedicated PHP-FPM config
|
# Create a dedicated PHP-FPM config
|
||||||
ynh_add_fpm_config --usage=low --footprint=low
|
ynh_add_fpm_config
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
mkdir -p $log_dir
|
||||||
# SPECIFIC SETUP
|
chmod 750 "$log_dir"
|
||||||
#=================================================
|
chmod -R o-rwx "$log_dir"
|
||||||
# CREATE DATA DIRECTORY
|
chown -R $app:www-data "$log_dir"
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Creating a data directory..." --weight=1
|
|
||||||
|
|
||||||
datadir=/home/yunohost.app/$app
|
ynh_use_logrotate
|
||||||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
|
||||||
|
|
||||||
mkdir -p $datadir
|
|
||||||
|
|
||||||
chmod 750 "$datadir"
|
|
||||||
chmod -R o-rwx "$datadir"
|
|
||||||
chown -R $app:www-data "$datadir"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE FINAL LOG PATH
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Creating a final log path..." --weight=1
|
|
||||||
|
|
||||||
final_logpath="/var/log/$app"
|
|
||||||
ynh_app_setting_set --app=$app --key=final_logpath --value=$final_logpath
|
|
||||||
|
|
||||||
mkdir -p $final_logpath
|
|
||||||
|
|
||||||
chmod 750 "$final_logpath"
|
|
||||||
chmod -R o-rwx "$final_logpath"
|
|
||||||
chown -R $app:www-data "$final_logpath"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A CONFIGURATION
|
# ADD A CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
ynh_script_progression --message="Adding a configuration file..."
|
||||||
|
|
||||||
# Configuration
|
|
||||||
ynh_replace_string --match_string="__TIMEZONE__" --replace_string=$(cat /etc/timezone) --target_file="../conf/config.php"
|
|
||||||
ynh_replace_string --match_string="__TIMEZONE__" --replace_string=$(cat /etc/timezone) --target_file="../conf/backend/config-autodiscover.php"
|
|
||||||
ynh_replace_string --match_string="__FINAL_LOGPATH__" --replace_string=$final_logpath --target_file="../conf/config.php"
|
|
||||||
ynh_replace_string --match_string="__FINAL_LOGPATH__" --replace_string=$final_logpath --target_file="../conf/backend/config-autodiscover.php"
|
|
||||||
|
|
||||||
# Storage of state_dir in /home/yunohost.app
|
|
||||||
# This contains the sync status in between device and z-push
|
|
||||||
ynh_replace_string --match_string="__DATADIR__" --replace_string=$datadir --target_file="../conf/config.php"
|
|
||||||
|
|
||||||
# Enable caldav carddav support
|
# Enable caldav carddav support
|
||||||
if yunohost app list | grep -q 'id: baikal' ; then
|
if yunohost app list | grep -q 'id: baikal' ; then
|
||||||
echo "Detected Baikal"
|
echo "Detected Baikal"
|
||||||
bailkaldomain=$(ynh_app_setting_get --app="baikal" --key=domain)
|
baikaldomain=$(ynh_app_setting_get --app="baikal" --key=domain)
|
||||||
bailkalpath=$(ynh_app_setting_get --app="baikal" --key=path)
|
baikalpath=$(ynh_app_setting_get --app="baikal" --key=path)
|
||||||
bailkalpath=${bailkalpath%/}
|
baikalpath=${baikalpath%/}
|
||||||
|
|
||||||
# Configuration of backend
|
# Variables to hydrate template
|
||||||
ynh_replace_string --match_string="__BACKEND__" --replace_string="BackendCombined" --target_file="../conf/config.php"
|
backend="BackendCombined"
|
||||||
ynh_replace_string --match_string="__BACKEND__" --replace_string="BackendCombined" --target_file="../conf/backend/config-autodiscover.php"
|
caldav_server="$baikaldomain"
|
||||||
|
caldav_path="${baikalpath}/cal.php/calendars/%u/"
|
||||||
|
caldav_personal="default"
|
||||||
|
|
||||||
# Configuration baikal
|
carddav_server="$baikaldomain"
|
||||||
ynh_replace_string --match_string="__CALDAV_SERVER__" --replace_string="${bailkaldomain}" --target_file="../conf/backend/config-caldav.php"
|
carddav_path="${baikalpath}/card.php/addressbooks/%u/"
|
||||||
ynh_replace_string --match_string="__CALDAV_PATH__" --replace_string="${bailkalpath}/cal.php/calendars/%u/" --target_file="../conf/backend/config-caldav.php"
|
carddav_default_path="${baikalpath}/card.php/addressbooks/%u/default"
|
||||||
ynh_replace_string --match_string="__CALDAV_PERSONAL__" --replace_string="default" --target_file="../conf/backend/config-caldav.php"
|
|
||||||
|
|
||||||
ynh_replace_string --match_string="__CARDDAV_SERVER__" --replace_string="${bailkaldomain}" --target_file="../conf/backend/config-carddav.php"
|
imap_server="$domain"
|
||||||
ynh_replace_string --match_string="__CARDDAV_PATH__" --replace_string="${bailkalpath}/card.php/addressbooks/%u/" --target_file="../conf/backend/config-carddav.php"
|
imap_meeting_use_caldav="true"
|
||||||
ynh_replace_string --match_string="__CARDDAV_DEFAULT_PATH__" --replace_string="${bailkalpath}/card.php/addressbooks/%u/default" --target_file="../conf/backend/config-carddav.php"
|
|
||||||
|
|
||||||
ynh_replace_string --match_string="__IMAP_SERVER__" --replace_string="${domain}" --target_file="../conf/backend/config-imap.php"
|
ynh_add_config --template="backend/config-caldav.php" --destination="$install_dir/backend/caldav/config.php"
|
||||||
ynh_replace_string --match_string="__FLAGTOCHANGE__" --replace_string="true" --target_file="../conf/backend/config-imap.php"
|
ynh_add_config --template="backend/config-carddav.php" --destination="$install_dir/backend/carddav/config.php"
|
||||||
|
ynh_add_config --template="backend/config-imap.php" --destination="$install_dir/backend/imap/config.php"
|
||||||
# Copy config
|
ynh_add_config --template="backend/config-combined.php" --destination="$install_dir/backend/combined/config.php"
|
||||||
cp -af ../conf/backend/config-caldav.php $final_path/backend/caldav/config.php
|
|
||||||
cp -af ../conf/backend/config-carddav.php $final_path/backend/carddav/config.php
|
|
||||||
cp -af ../conf/backend/config-imap.php $final_path/backend/imap/config.php
|
|
||||||
cp -af ../conf/backend/config-combined.php $final_path/backend/combined/config.php
|
|
||||||
|
|
||||||
elif yunohost app list | grep -q 'id: nextcloud' ; then
|
elif yunohost app list | grep -q 'id: nextcloud' ; then
|
||||||
echo "Detected NextCloud"
|
echo "Detected NextCloud"
|
||||||
|
@ -180,75 +85,40 @@ elif yunohost app list | grep -q 'id: nextcloud' ; then
|
||||||
nextcloudpath=$(ynh_app_setting_get --app="nextcloud" --key=path)
|
nextcloudpath=$(ynh_app_setting_get --app="nextcloud" --key=path)
|
||||||
nextcloudpath=${nextcloudpath%/}
|
nextcloudpath=${nextcloudpath%/}
|
||||||
|
|
||||||
# Configuration of backend
|
# Variables to hydrate template
|
||||||
ynh_replace_string --match_string="__BACKEND__" --replace_string="BackendCombined" --target_file="../conf/config.php"
|
backend="BackendCombined"
|
||||||
ynh_replace_string --match_string="__BACKEND__" --replace_string="BackendCombined" --target_file="../conf/backend/config-autodiscover.php"
|
caldav_server="$nextclouddomain"
|
||||||
|
caldav_path="${nextcloudpath}/remote.php/dav/calendars/%u/"
|
||||||
|
caldav_personal="personal"
|
||||||
|
|
||||||
# Configuration nextcloud
|
carddav_server="$nextclouddomain"
|
||||||
ynh_replace_string --match_string="__CALDAV_SERVER__" --replace_string="${nextclouddomain}" --target_file="../conf/backend/config-caldav.php"
|
carddav_path="${nextcloudpath}/remote.php/dav/addressbooks/users/%u/"
|
||||||
ynh_replace_string --match_string="__CALDAV_PATH__" --replace_string="${nextcloudpath}/remote.php/dav/calendars/%u/" --target_file="../conf/backend/config-caldav.php"
|
carddav_default_path="${nextcloudpath}/remote.php/dav/addressbooks/users/%u/"
|
||||||
ynh_replace_string --match_string="__CALDAV_PERSONAL__" --replace_string="personal" --target_file="../conf/backend/config-caldav.php"
|
|
||||||
|
|
||||||
ynh_replace_string --match_string="__CARDDAV_SERVER__" --replace_string="${nextclouddomain}" --target_file="../conf/backend/config-carddav.php"
|
imap_server="$domain"
|
||||||
ynh_replace_string --match_string="__CARDDAV_PATH__" --replace_string="${nextcloudpath}/remote.php/dav/addressbooks/users/%u/" --target_file="../conf/backend/config-carddav.php"
|
imap_meeting_use_caldav="true"
|
||||||
ynh_replace_string --match_string="__CARDDAV_DEFAULT_PATH__" --replace_string="${nextcloudpath}/remote.php/dav/addressbooks/users/%u/" --target_file="../conf/backend/config-carddav.php"
|
|
||||||
|
|
||||||
ynh_replace_string --match_string="__IMAP_SERVER__" --replace_string="${domain}" --target_file="../conf/backend/config-imap.php"
|
ynh_add_config --template="backend/config-caldav.php" --destination="$install_dir/backend/caldav/config.php"
|
||||||
ynh_replace_string --match_string="__FLAGTOCHANGE__" --replace_string="true" --target_file="../conf/backend/config-imap.php"
|
ynh_add_config --template="backend/config-carddav.php" --destination="$install_dir/backend/carddav/config.php"
|
||||||
|
ynh_add_config --template="backend/config-imap.php" --destination="$install_dir/backend/imap/config.php"
|
||||||
|
ynh_add_config --template="backend/config-combined.php" --destination="$install_dir/backend/combined/config.php"
|
||||||
|
|
||||||
# Copy config
|
|
||||||
cp -af ../conf/backend/config-caldav.php $final_path/backend/caldav/config.php
|
|
||||||
cp -af ../conf/backend/config-carddav.php $final_path/backend/carddav/config.php
|
|
||||||
cp -af ../conf/backend/config-imap.php $final_path/backend/imap/config.php
|
|
||||||
cp -af ../conf/backend/config-combined.php $final_path/backend/combined/config.php
|
|
||||||
else
|
else
|
||||||
# Configuration of backend
|
backend="BackendIMAP"
|
||||||
ynh_replace_string --match_string="__BACKEND__" --replace_string="BackendIMAP" --target_file="../conf/config.php"
|
imap_server="$domain"
|
||||||
ynh_replace_string --match_string="__BACKEND__" --replace_string="BackendIMAP" --target_file="../conf/backend/config-autodiscover.php"
|
imap_meeting_use_caldav="false"
|
||||||
|
|
||||||
# Configuration imap
|
ynh_add_config --template="backend/config-imap.php" --destination="$install_dir/backend/imap/config.php"
|
||||||
ynh_replace_string --match_string="__IMAP_SERVER__" --replace_string="${domain}" --target_file="../conf/backend/config-imap.php"
|
|
||||||
ynh_replace_string --match_string="__FLAGTOCHANGE__" --replace_string="false" --target_file="../conf/backend/config-imap.php"
|
|
||||||
|
|
||||||
# Copy config
|
|
||||||
cp -af ../conf/backend/config-imap.php $final_path/backend/imap/config.php
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Copy config
|
# Copy config
|
||||||
cp -af ../conf/config.php $final_path/config.php
|
ynh_add_config --template="config.php" --destination="$install_dir/config.php"
|
||||||
cp -af ../conf/backend/config-autodiscover.php $final_path/autodiscover/config.php
|
ynh_add_config --template="backend/config-autodiscover.php" --destination="$install_dir/autodiscover/config.php"
|
||||||
cp -af ../conf/backend/config-searchldap.php $final_path/backend/searchldap/config.php
|
ynh_add_config --template="backend/config-searchldap.php" --destination="$install_dir/backend/searchldap/config.php"
|
||||||
|
|
||||||
#Copy XMLElement.php
|
#Copy XMLElement.php
|
||||||
ln -s /usr/share/awl/inc/XML* /var/www/$app/include/
|
ln -s /usr/share/awl/inc/XML* /var/www/$app/include/
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
|
||||||
# SETUP LOGROTATE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring log rotation..." --weight=1
|
|
||||||
|
|
||||||
# Use logrotate to manage application logfile(s)
|
|
||||||
ynh_use_logrotate
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SETUP SSOWAT
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring permissions..." --weight=1
|
|
||||||
|
|
||||||
# Make app public
|
|
||||||
ynh_permission_update --permission="main" --add="visitors"
|
|
||||||
|
|
||||||
domain_regex=$(echo "$domain" | sed 's@-@.@g')
|
|
||||||
ynh_permission_create --permission="autodiscover" --url="re:$domain_regex/[Aa]uto[Dd]iscover/.*" --allowed="visitors" --show_tile="false" --protected="true"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RELOAD NGINX
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
|
@ -9,18 +9,6 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Loading settings..." --weight=1
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
||||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
|
||||||
final_logpath=$(ynh_app_setting_get --app=$app --key=final_logpath)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# STANDARD REMOVE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -31,67 +19,13 @@ ynh_script_progression --message="Removing logrotate configuration..." --weight=
|
||||||
# Remove the app-specific logrotate config
|
# Remove the app-specific logrotate config
|
||||||
ynh_remove_logrotate
|
ynh_remove_logrotate
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE APP MAIN DIR
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing app main directory..." --weight=1
|
|
||||||
|
|
||||||
# Remove the app directory securely
|
|
||||||
ynh_secure_remove --file="$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE DATA DIR
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Remove the data directory if --purge option is used
|
|
||||||
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
|
|
||||||
then
|
|
||||||
ynh_script_progression --message="Removing app data directory..." --weight=1
|
|
||||||
ynh_secure_remove --file="$datadir"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
|
|
||||||
|
|
||||||
# Remove the dedicated NGINX config
|
# Remove the dedicated NGINX config
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE PHP-FPM CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1
|
|
||||||
|
|
||||||
# Remove the dedicated PHP-FPM config
|
# Remove the dedicated PHP-FPM config
|
||||||
ynh_remove_fpm_config
|
ynh_remove_fpm_config
|
||||||
|
|
||||||
#=================================================
|
ynh_secure_remove --file="$log_dir"
|
||||||
# REMOVE DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing dependencies..." --weight=1
|
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
|
||||||
ynh_remove_app_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC REMOVE
|
|
||||||
#=================================================
|
|
||||||
# REMOVE VARIOUS FILES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing various files..." --weight=1
|
|
||||||
|
|
||||||
ynh_secure_remove --file="$final_logpath"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
|
||||||
# REMOVE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
|
||||||
|
|
||||||
# Delete a system user
|
|
||||||
ynh_system_user_delete --username=$app
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
|
@ -10,81 +10,26 @@
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
log_dir="/var/log/$app/"
|
||||||
# MANAGE SCRIPT FAILURE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_clean_setup () {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Loading settings..." --weight=1
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
||||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
|
||||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
|
||||||
final_logpath=$(ynh_app_setting_get --app=$app --key=final_logpath)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
|
||||||
|
|
||||||
test ! -d $final_path \
|
|
||||||
|| ynh_die --message="There is already a directory: $final_path "
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD RESTORATION STEPS
|
|
||||||
#=================================================
|
|
||||||
# RECREATE THE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
|
||||||
|
|
||||||
# Create the dedicated user (if not existing)
|
|
||||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$final_path"
|
ynh_restore_file --origin_path="$install_dir"
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
chmod -R o-rwx "$install_dir"
|
||||||
chmod -R o-rwx "$final_path"
|
chown -R $app:www-data "$install_dir"
|
||||||
chown -R $app:www-data "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE DATA DIRECTORY
|
# RESTORE THE DATA DIRECTORY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the data directory..." --weight=1
|
ynh_script_progression --message="Restoring the data directory..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$datadir" --not_mandatory
|
ynh_restore_file --origin_path="$data_dir" --not_mandatory
|
||||||
|
|
||||||
mkdir -p $datadir
|
chown -R $app:www-data "$data_dir"
|
||||||
|
|
||||||
chmod 750 "$datadir"
|
|
||||||
chmod -R o-rwx "$datadir"
|
|
||||||
chown -R $app:www-data "$datadir"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC RESTORATION
|
|
||||||
#=================================================
|
|
||||||
# REINSTALL DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
|
|
||||||
|
|
||||||
# Define and install dependencies
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE PHP-FPM CONFIGURATION
|
# RESTORE THE PHP-FPM CONFIGURATION
|
||||||
|
@ -93,24 +38,15 @@ ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weig
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||||
|
|
||||||
# Recreate a dedicated php-fpm config
|
|
||||||
ynh_add_fpm_config --usage=low --footprint=low
|
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE THE NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
|
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE THE LOGROTATE CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
|
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||||
|
|
||||||
|
mkdir -p $log_dir
|
||||||
|
chmod 750 "$log_dir"
|
||||||
|
chmod -R o-rwx "$log_dir"
|
||||||
|
chown -R $app:www-data "$log_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
258
scripts/upgrade
258
scripts/upgrade
|
@ -9,76 +9,14 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Loading settings..." --weight=1
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
||||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
||||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
|
||||||
final_logpath=$(ynh_app_setting_get --app=$app --key=final_logpath)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK VERSION
|
# CHECK VERSION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Checking version..." --weight=1
|
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
upgrade_type=$(ynh_check_app_version_changed)
|
||||||
|
|
||||||
#=================================================
|
timezone="$(cat /etc/timezone)"
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
log_dir="/var/log/$app/"
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
|
|
||||||
|
|
||||||
# Backup the current version of the app
|
|
||||||
ynh_backup_before_upgrade
|
|
||||||
ynh_clean_setup () {
|
|
||||||
# Restore it if the upgrade fails
|
|
||||||
ynh_restore_upgradebackup
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD UPGRADE STEPS
|
|
||||||
#=================================================
|
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
|
||||||
|
|
||||||
# Cleaning legacy permissions
|
|
||||||
if ynh_legacy_permissions_exists; then
|
|
||||||
ynh_legacy_permissions_delete_all
|
|
||||||
|
|
||||||
ynh_app_setting_delete --app=$app --key=is_public
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$datadir" ];
|
|
||||||
then
|
|
||||||
datadir="/home/yunohost.app/$app"
|
|
||||||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
|
||||||
ynh_app_setting_delete --app=$app --key=statedir
|
|
||||||
mkdir -p $datadir
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$final_logpath" ];
|
|
||||||
then
|
|
||||||
final_logpath="/var/log/$app"
|
|
||||||
ynh_app_setting_set --app=$app --key=final_logpath --value=$final_logpath
|
|
||||||
mkdir -p $final_logpath
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
|
||||||
|
|
||||||
# Create a dedicated user (if not existing)
|
|
||||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
|
@ -86,153 +24,127 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
ynh_script_progression --message="Upgrading source files..."
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
mkdir "$install_dir/bkp"
|
||||||
mkdir "$final_path/tmp"
|
conf_files_to_keep="config.php backend/caldav/config.php backend/carddav/config.php backend/imap/config.php backend/combined/config.php autodiscover/config.php backend/searchldap/config.php"
|
||||||
ynh_setup_source --dest_dir="$final_path/tmp"
|
for file in $conf_files_to_keep
|
||||||
cp -af "$final_path/tmp/src/." "$final_path/."
|
do
|
||||||
ynh_secure_remove --file="$final_path/tmp"
|
if [ -e $install_dir/$file ]
|
||||||
|
then
|
||||||
|
mkdir -p $install_dir/bkp/$(dirname $file)
|
||||||
|
cp $install_dir/$file $install_dir/bkp/$file
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
|
mkdir "$install_dir/tmp"
|
||||||
|
ynh_setup_source --dest_dir="$install_dir/tmp"
|
||||||
|
cp -af "$install_dir/tmp/src/." "$install_dir/."
|
||||||
|
ynh_secure_remove --file="$install_dir/tmp"
|
||||||
|
|
||||||
|
for file in $conf_files_to_keep
|
||||||
|
do
|
||||||
|
if [ -e $install_dir/bkp/$file ]
|
||||||
|
then
|
||||||
|
cp $install_dir/bkp/$file $install_dir/$file
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
ynh_secure_remove --file="$install_dir/bkp"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
chmod -R o-rwx "$install_dir"
|
||||||
chmod -R o-rwx "$final_path"
|
chown -R $app:www-data "$install_dir"
|
||||||
chown -R $app:www-data "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# UPGRADE DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Upgrading dependencies..." --weight=1
|
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM CONFIGURATION
|
# PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
|
ynh_script_progression --message="Installing system configurations..."
|
||||||
|
|
||||||
# Create a dedicated PHP-FPM config
|
# Create a dedicated PHP-FPM config
|
||||||
ynh_add_fpm_config --usage=low --footprint=low
|
ynh_add_fpm_config
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
|
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
|
mkdir -p $log_dir
|
||||||
|
chmod 750 "$log_dir"
|
||||||
|
chmod -R o-rwx "$log_dir"
|
||||||
|
chown -R $app:www-data "$log_dir"
|
||||||
|
|
||||||
|
ynh_use_logrotate --non-append
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC UPGRADE
|
# SPECIFIC UPGRADE
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPDATE A CONFIG FILE
|
# UPDATE A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating a config file..." --weight=1
|
ynh_script_progression --message="Updating a config file..."
|
||||||
|
|
||||||
# Configuration
|
|
||||||
ynh_replace_string --match_string="__TIMEZONE__" --replace_string="$(cat /etc/timezone)" --target_file="../conf/config.php"
|
|
||||||
ynh_replace_string --match_string="__TIMEZONE__" --replace_string="$(cat /etc/timezone)" --target_file="../conf/backend/config-autodiscover.php"
|
|
||||||
ynh_replace_string --match_string="__FINAL_LOGPATH__" --replace_string="$final_logpath" --target_file="../conf/config.php"
|
|
||||||
ynh_replace_string --match_string="__FINAL_LOGPATH__" --replace_string="$final_logpath" --target_file="../conf/backend/config-autodiscover.php"
|
|
||||||
|
|
||||||
# Storage of state_dir in /home/yunohost.app
|
|
||||||
# This contains the sync status in between device and z-push
|
|
||||||
ynh_replace_string __DATADIR__ $datadir ../conf/config.php
|
|
||||||
|
|
||||||
# Enable caldav carddav support
|
# Enable caldav carddav support
|
||||||
if yunohost app list | grep -q 'id: baikal' ; then
|
if yunohost app list | grep -q 'id: baikal' ; then
|
||||||
echo "Detected Baikal"
|
echo "Detected Baikal"
|
||||||
bailkaldomain=$(ynh_app_setting_get --app=baikal --key=domain)
|
baikaldomain=$(ynh_app_setting_get --app="baikal" --key=domain)
|
||||||
bailkalpath=$(ynh_app_setting_get --app=baikal --key=path)
|
baikalpath=$(ynh_app_setting_get --app="baikal" --key=path)
|
||||||
bailkalpath=${bailkalpath%/}
|
baikalpath=${baikalpath%/}
|
||||||
|
|
||||||
# Configuration of backend
|
# Variables to hydrate template
|
||||||
ynh_replace_string --match_string="__BACKEND__" --replace_string="BackendCombined" --target_file="../conf/config.php"
|
backend="BackendCombined"
|
||||||
ynh_replace_string --match_string="__BACKEND__" --replace_string="BackendCombined" --target_file="../conf/backend/config-autodiscover.php"
|
caldav_server="$baikaldomain"
|
||||||
|
caldav_path="${baikalpath}/cal.php/calendars/%u/"
|
||||||
|
caldav_personal="default"
|
||||||
|
|
||||||
# Configuration baikal
|
carddav_server="$baikaldomain"
|
||||||
ynh_replace_string --match_string="__CALDAV_SERVER__" --replace_string="${bailkaldomain}" --target_file="../conf/backend/config-caldav.php"
|
carddav_path="${baikalpath}/card.php/addressbooks/%u/"
|
||||||
ynh_replace_string --match_string="__CALDAV_PATH__" --replace_string="${bailkalpath}/cal.php/calendars/%u/" --target_file="../conf/backend/config-caldav.php"
|
carddav_default_path="${baikalpath}/card.php/addressbooks/%u/default"
|
||||||
ynh_replace_string --match_string="__CALDAV_PERSONAL__" --replace_string="default" --target_file="../conf/backend/config-caldav.php"
|
|
||||||
|
|
||||||
ynh_replace_string --match_string="__CARDDAV_SERVER__" --replace_string="${bailkaldomain}" --target_file="../conf/backend/config-carddav.php"
|
imap_server="$domain"
|
||||||
ynh_replace_string --match_string="__CARDDAV_PATH__" --replace_string="${bailkalpath}/card.php/addressbooks/%u/" --target_file="../conf/backend/config-carddav.php"
|
imap_meeting_use_caldav="true"
|
||||||
ynh_replace_string --match_string="__CARDDAV_DEFAULT_PATH__" --replace_string="${bailkalpath}/card.php/addressbooks/%u/default" --target_file="../conf/backend/config-carddav.php"
|
|
||||||
|
|
||||||
ynh_replace_string --match_string="__IMAP_SERVER__" --replace_string="${domain}" --target_file="../conf/backend/config-imap.php"
|
ynh_add_config --template="backend/config-caldav.php" --destination="$install_dir/backend/caldav/config.php"
|
||||||
ynh_replace_string --match_string="__FLAGTOCHANGE__" --replace_string="true" --target_file="../conf/backend/config-imap.php"
|
ynh_add_config --template="backend/config-carddav.php" --destination="$install_dir/backend/carddav/config.php"
|
||||||
|
ynh_add_config --template="backend/config-imap.php" --destination="$install_dir/backend/imap/config.php"
|
||||||
# Copy config
|
ynh_add_config --template="backend/config-combined.php" --destination="$install_dir/backend/combined/config.php"
|
||||||
cp -af ../conf/backend/config-caldav.php $final_path/backend/caldav/config.php
|
|
||||||
cp -af ../conf/backend/config-carddav.php $final_path/backend/carddav/config.php
|
|
||||||
cp -af ../conf/backend/config-imap.php $final_path/backend/imap/config.php
|
|
||||||
cp -af ../conf/backend/config-combined.php $final_path/backend/combined/config.php
|
|
||||||
|
|
||||||
elif yunohost app list | grep -q 'id: nextcloud' ; then
|
elif yunohost app list | grep -q 'id: nextcloud' ; then
|
||||||
echo "Detected NextCloud"
|
echo "Detected NextCloud"
|
||||||
nextclouddomain=$(ynh_app_setting_get --app=nextcloud --key=domain)
|
nextclouddomain=$(ynh_app_setting_get --app="nextcloud" --key=domain)
|
||||||
nextcloudpath=$(ynh_app_setting_get --app=nextcloud --key=path)
|
nextcloudpath=$(ynh_app_setting_get --app="nextcloud" --key=path)
|
||||||
nextcloudpath=${nextcloudpath%/}
|
nextcloudpath=${nextcloudpath%/}
|
||||||
|
|
||||||
# Configuration of backend
|
# Variables to hydrate template
|
||||||
ynh_replace_string --match_string="__BACKEND__" --replace_string="BackendCombined" --target_file="../conf/config.php"
|
backend="BackendCombined"
|
||||||
ynh_replace_string --match_string="__BACKEND__" --replace_string="BackendCombined" --target_file="../conf/backend/config-autodiscover.php"
|
caldav_server="$nextclouddomain"
|
||||||
|
caldav_path="${nextcloudpath}/remote.php/dav/calendars/%u/"
|
||||||
|
caldav_personal="personal"
|
||||||
|
|
||||||
# Configuration nextcloud
|
carddav_server="$nextclouddomain"
|
||||||
ynh_replace_string --match_string="__CALDAV_SERVER__" --replace_string="${nextclouddomain}" --target_file="../conf/backend/config-caldav.php"
|
carddav_path="${nextcloudpath}/remote.php/dav/addressbooks/users/%u/"
|
||||||
ynh_replace_string --match_string="__CALDAV_PATH__" --replace_string="${nextcloudpath}/remote.php/dav/calendars/%u/" --target_file="../conf/backend/config-caldav.php"
|
carddav_default_path="${nextcloudpath}/remote.php/dav/addressbooks/users/%u/"
|
||||||
ynh_replace_string --match_string="__CALDAV_PERSONAL__" --replace_string="personal" --target_file="../conf/backend/config-caldav.php"
|
|
||||||
|
|
||||||
ynh_replace_string --match_string="__CARDDAV_SERVER__" --replace_string="${nextclouddomain}" --target_file="../conf/backend/config-carddav.php"
|
imap_server="$domain"
|
||||||
ynh_replace_string --match_string="__CARDDAV_PATH__" --replace_string="${nextcloudpath}/remote.php/dav/addressbooks/users/%u/contacts/" --target_file="../conf/backend/config-carddav.php"
|
imap_meeting_use_caldav="true"
|
||||||
ynh_replace_string --match_string="__CARDDAV_DEFAULT_PATH__" --replace_string="${nextcloudpath}/remote.php/dav/addressbooks/users/%u/contacts/" --target_file="../conf/backend/config-carddav.php"
|
|
||||||
|
|
||||||
ynh_replace_string --match_string="__IMAP_SERVER__" --replace_string="${domain}" --target_file="../conf/backend/config-imap.php"
|
ynh_add_config --template="backend/config-caldav.php" --destination="$install_dir/backend/caldav/config.php"
|
||||||
ynh_replace_string --match_string="__FLAGTOCHANGE__" --replace_string="true" --target_file="../conf/backend/config-imap.php"
|
ynh_add_config --template="backend/config-carddav.php" --destination="$install_dir/backend/carddav/config.php"
|
||||||
|
ynh_add_config --template="backend/config-imap.php" --destination="$install_dir/backend/imap/config.php"
|
||||||
|
ynh_add_config --template="backend/config-combined.php" --destination="$install_dir/backend/combined/config.php"
|
||||||
|
|
||||||
# Copy config
|
|
||||||
cp -af ../conf/backend/config-caldav.php $final_path/backend/caldav/config.php
|
|
||||||
cp -af ../conf/backend/config-carddav.php $final_path/backend/carddav/config.php
|
|
||||||
cp -af ../conf/backend/config-imap.php $final_path/backend/imap/config.php
|
|
||||||
cp -af ../conf/backend/config-combined.php $final_path/backend/combined/config.php
|
|
||||||
else
|
else
|
||||||
# Configuration of backend
|
backend="BackendIMAP"
|
||||||
ynh_replace_string --match_string="__BACKEND__" --replace_string="BackendIMAP" --target_file="../conf/config.php"
|
imap_server="$domain"
|
||||||
ynh_replace_string --match_string="__BACKEND__" --replace_string="BackendIMAP" --target_file="../conf/backend/config-autodiscover.php"
|
imap_meeting_use_caldav="false"
|
||||||
|
|
||||||
# Configuration imap
|
ynh_add_config --template="backend/config-imap.php" --destination="$install_dir/backend/imap/config.php"
|
||||||
ynh_replace_string --match_string="__IMAP_SERVER__" --replace_string="${domain}" --target_file="../conf/backend/config-imap.php"
|
|
||||||
ynh_replace_string --match_string="__FLAGTOCHANGE__" --replace_string="false" --target_file="../conf/backend/config-imap.php"
|
|
||||||
|
|
||||||
# Copy config
|
|
||||||
cp -af ../conf/backend/config-imap.php $final_path/backend/imap/config.php
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Copy config
|
# Copy config
|
||||||
cp -af ../conf/config.php $final_path/config.php
|
ynh_add_config --template="config.php" --destination="$install_dir/config.php"
|
||||||
cp -af ../conf/backend/config-autodiscover.php $final_path/autodiscover/config.php
|
ynh_add_config --template="backend/config-autodiscover.php" --destination="$install_dir/autodiscover/config.php"
|
||||||
cp -af ../conf/backend/config-searchldap.php $final_path/backend/searchldap/config.php
|
ynh_add_config --template="backend/config-searchldap.php" --destination="$install_dir/backend/searchldap/config.php"
|
||||||
|
|
||||||
# Fixstates to avoid full resync of devices after version upgrades
|
# Fixstates to avoid full resync of devices after version upgrades
|
||||||
$final_path/z-push-admin.php -a fixstates
|
$install_dir/z-push-admin.php -a fixstates
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
|
||||||
# SETUP LOGROTATE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
|
|
||||||
|
|
||||||
# Use logrotate to manage app-specific logfile(s)
|
|
||||||
ynh_use_logrotate --non-append
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RELOAD NGINX
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
3
tests.toml
Normal file
3
tests.toml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
test_format = 1.0
|
||||||
|
|
||||||
|
[default]
|
Loading…
Add table
Reference in a new issue