mirror of
https://github.com/YunoHost-Apps/roundcube_ynh.git
synced 2024-09-03 20:16:28 +02:00
commit
29d72f708b
20 changed files with 162 additions and 811 deletions
129
.github/workflows/updater.sh
vendored
129
.github/workflows/updater.sh
vendored
|
@ -1,129 +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.
|
||||
|
||||
# Remove this exit command when you are ready to run this Action
|
||||
#exit 1
|
||||
|
||||
#=================================================
|
||||
# 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=($(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '[ .[] | select(.tag_name=="'$version'").assets[].browser_download_url ] | join(" ") | @sh' | tr -d "'"))
|
||||
|
||||
# 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
|
||||
|
||||
# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.)
|
||||
echo "${#assets[@]} available asset(s)"
|
||||
|
||||
#=================================================
|
||||
# UPDATE SOURCE FILES
|
||||
#=================================================
|
||||
|
||||
# Here we use the $assets variable to get the resources published in the upstream release.
|
||||
# Here is an example for Grav, it has to be adapted in accordance with how the upstream releases look like.
|
||||
|
||||
# Let's loop over the array of assets URLs
|
||||
for asset_url in ${assets[@]}; do
|
||||
|
||||
echo "Handling asset at $asset_url"
|
||||
|
||||
# Assign the asset to a source file in conf/ directory
|
||||
# Here we base the source file name upon a unique keyword in the assets url (admin vs. update)
|
||||
# Leave $src empty to ignore the asset
|
||||
case $asset_url in
|
||||
*"roundcubemail-"*".tar.gz")
|
||||
src="app"
|
||||
;;
|
||||
esac
|
||||
|
||||
# If $src is not empty, let's process the asset
|
||||
if [ ! -z "$src" ]; then
|
||||
|
||||
# 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=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
EOT
|
||||
echo "... conf/$src.src updated"
|
||||
|
||||
else
|
||||
echo "... asset ignored"
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
#=================================================
|
||||
# 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@v2
|
||||
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@v3
|
||||
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
|
47
README.md
47
README.md
|
@ -36,53 +36,6 @@ In addition to Roundcube core features, the following are made available with th
|
|||
|
||||
![Screenshot of Roundcube](./doc/screenshots/screenshot.png)
|
||||
|
||||
## Disclaimers / important information
|
||||
|
||||
## Configuration
|
||||
|
||||
You can extend - or even override - the Roundcube configuration which is coming with this package in the file `conf/local.inc.php`. Do not edit the file `conf/config.inc.php` as future upgrades will overwrite it.
|
||||
|
||||
#### Multi-users support
|
||||
|
||||
* Integrate with YunoHost users and SSO - i.e logout button, YunoHost users search
|
||||
|
||||
#### Plugins
|
||||
|
||||
You can also install other plugins - which will not be removed with upgrades. To do so, you can use the official [Plugin Repository](https://plugins.roundcube.net/).
|
||||
|
||||
##### From the Plugin Repository
|
||||
|
||||
Let's say for example that we want to install the [html5_notifier](https://packagist.org/packages/kitist/html5_notifier) plugin.
|
||||
|
||||
1. Connect to your server as root using SSH:
|
||||
```
|
||||
$ ssh admin@1.2.3.4
|
||||
$ sudo -i
|
||||
```
|
||||
|
||||
2. Log in as the `roundcube` user - which owns the roundcube directory - and navigate in it:
|
||||
```
|
||||
# su -s /bin/bash - roundcube
|
||||
$ cd /var/www/roundcube
|
||||
```
|
||||
|
||||
3. Install the plugin you want using composer - note that you have to specify *kitist/html5_notifier* and not only *html5_notifier*:
|
||||
```
|
||||
$ COMPOSER_HOME=./.composer php composer.phar require "kitist/html5_notifier"
|
||||
```
|
||||
|
||||
4. Enable it in the local configuration file `conf/local.inc.php` using your favorite text editor by adding:
|
||||
```
|
||||
<?php
|
||||
$config['plugins'][] = 'html5_notifier';
|
||||
```
|
||||
|
||||
Note that you should also check the plugin homepage for additional installation steps as needed.
|
||||
|
||||
##### Manual installation
|
||||
|
||||
You can also download the plugin and put it under the `plugins/` directory. In this case, do not forget to change ownerships of this folder to `roundcube`.
|
||||
|
||||
## Documentation and resources
|
||||
|
||||
* Official app website: <https://roundcube.net/>
|
||||
|
|
47
README_fr.md
47
README_fr.md
|
@ -37,53 +37,6 @@ En plus des fonctionnalités principales de Roundcube, les éléments suivants s
|
|||
|
||||
![Capture d’écran de Roundcube](./doc/screenshots/screenshot.png)
|
||||
|
||||
## Avertissements / informations importantes
|
||||
|
||||
## Configuration
|
||||
|
||||
Vous pouvez étendre (ou même remplacer) la configuration de Roundcube fournie avec ce paquet dans le fichier `conf/local.inc.php`. Ne modifiez pas le fichier `conf/config.inc.php` car les futures mises à jour le remplaceront.
|
||||
|
||||
#### Support multi-utilisateur
|
||||
|
||||
* Intégration avec les utilisateurs YunoHost et SSO - c'est-à-dire le bouton de déconnexion, reconnaissance des autres utilisateurs de l'instance YunoHost.
|
||||
|
||||
#### Plugins
|
||||
|
||||
Vous pouvez également installer d'autres plugins (qui ne seront pas supprimés avec les mises à niveau). Pour cela, vous pouvez utiliser le [Plugin Repository](https://plugins.roundcube.net/) officiel.
|
||||
|
||||
##### Depuis le dépôt de plugins
|
||||
|
||||
Si, par exemple, vous voulez installer le plugin [html5_notifier](https://packagist.org/packages/kitist/html5_notifier).
|
||||
|
||||
1. Connectez-vous en SSH à votre serveur en tant que root :
|
||||
```
|
||||
$ ssh admin@1.2.3.4
|
||||
$ sudo -i
|
||||
```
|
||||
|
||||
2. Connectez-vous en tant qu'utilisateur `roundcube` (qui possède le répertoire roundcube) et naviguez dedans :
|
||||
```
|
||||
# su -s /bin/bash - roundcube
|
||||
$ cd /var/www/roundcube
|
||||
```
|
||||
|
||||
3. Installez le plugin que vous voulez en utilisant Composer - notez que vous devez spécifier *kitist/html5_notifier* et pas seulement *html5_notifier* :
|
||||
```
|
||||
$ COMPOSER_HOME=./.composer php composer.phar require "kitist/html5_notifier"
|
||||
```
|
||||
|
||||
4. Activez-le dans le fichier de configuration local `conf/local.inc.php` en ajoutant :
|
||||
```
|
||||
<?php
|
||||
$config['plugins'][] = 'html5_notifier';
|
||||
```
|
||||
|
||||
Notez que vous devez également consulter la page d'accueil du plugin pour connaître les étapes d'installation supplémentaires si nécessaire.
|
||||
|
||||
##### Installation manual
|
||||
|
||||
Vous pouvez également télécharger le plugin et le placer dans le répertoire `plugins /`. Dans ce cas, n'oubliez pas de changer la propriété de ce dossier en `roundcube`.
|
||||
|
||||
## Documentations et ressources
|
||||
|
||||
* Site officiel de l’app : <https://roundcube.net/>
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
;; Test complet
|
||||
; Manifest
|
||||
domain="domain.tld"
|
||||
path="/path"
|
||||
language="en_GB"
|
||||
with_carddav=1
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=1
|
||||
setup_root=1
|
||||
setup_nourl=0
|
||||
setup_private=0
|
||||
setup_public=0
|
||||
upgrade=1
|
||||
upgrade=1 from_commit=f470adac1152482928c90a9c657b968f0907cf8a
|
||||
backup_restore=1
|
||||
multi_instance=1
|
||||
change_url=1
|
||||
;;; Options
|
||||
Email=
|
||||
Notification=none
|
||||
;;; Upgrade options
|
||||
; commit=f470adac1152482928c90a9c657b968f0907cf8a
|
||||
name=Merge pull request #119
|
|
@ -14,7 +14,7 @@ $config['enigma_debug'] = false;
|
|||
|
||||
// REQUIRED! Keys directory for all users.
|
||||
// Must be writeable by PHP process, and not in the web server document root
|
||||
$config['enigma_pgp_homedir'] = '/var/www/__APP__/plugins/enigma/home';
|
||||
$config['enigma_pgp_homedir'] = '__INSTALL_DIR__/plugins/enigma/home';
|
||||
|
||||
// Location of gpg binary. By default it will be auto-detected.
|
||||
// This is also a way to force gpg2 use if there are both 1.x and 2.x on the system.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; Additional php.ini defines, specific to this pool of workers.
|
||||
|
||||
php_admin_value[upload_max_filesize] = 50M
|
||||
php_admin_value[post_max_size] = 50M
|
||||
php_admin_value[upload_max_filesize] = 256M
|
||||
php_admin_value[post_max_size] = 256M
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
location __PATH__/ {
|
||||
|
||||
# Path to source
|
||||
alias __FINALPATH__/ ;
|
||||
alias __INSTALL_DIR__/;
|
||||
|
||||
index index.php;
|
||||
client_max_body_size 50M;
|
||||
|
|
|
@ -1,71 +0,0 @@
|
|||
{
|
||||
"id": "roundcube",
|
||||
"name": "Roundcube",
|
||||
"packaging_format": 1,
|
||||
"description": {
|
||||
"en": "Open Source Webmail software",
|
||||
"fr": "Webmail Open Source"
|
||||
},
|
||||
"version": "1.6.6~ynh1",
|
||||
"url": "https://roundcube.net/",
|
||||
"upstream": {
|
||||
"license": "GPL-3.0-only",
|
||||
"website": "https://roundcube.net/",
|
||||
"demo": "https://demo.yunohost.org/webmail/",
|
||||
"admindoc": "https://github.com/roundcube/roundcubemail/wiki",
|
||||
"code": "https://github.com/roundcube/roundcubemail",
|
||||
"cpe": "cpe:2.3:a:roundcube:webmail"
|
||||
},
|
||||
"license": "GPL-3.0-only",
|
||||
"maintainer": {
|
||||
"name": "",
|
||||
"email": ""
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 11.2"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
"nginx",
|
||||
"php7.4-fpm",
|
||||
"mysql"
|
||||
],
|
||||
"arguments": {
|
||||
"install": [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
"type": "path",
|
||||
"example": "/webmail",
|
||||
"default": "/webmail"
|
||||
},
|
||||
{
|
||||
"name": "language",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Choose the application language",
|
||||
"fr": "Choisissez la langue de l'application"
|
||||
},
|
||||
"choices": [
|
||||
"de_DE",
|
||||
"en_GB",
|
||||
"fr_FR",
|
||||
"it_IT"
|
||||
],
|
||||
"default": "en_GB"
|
||||
},
|
||||
{
|
||||
"name": "with_carddav",
|
||||
"type": "boolean",
|
||||
"ask": {
|
||||
"en": "Install CardDAV synchronization plugin?",
|
||||
"fr": "Installer le plugin de synchronisation CardDAV ?"
|
||||
},
|
||||
"default": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
84
manifest.toml
Normal file
84
manifest.toml
Normal file
|
@ -0,0 +1,84 @@
|
|||
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
|
||||
|
||||
packaging_format = 2
|
||||
|
||||
id = "roundcube"
|
||||
name = "Roundcube"
|
||||
description.en = "Open Source Webmail software"
|
||||
description.fr = "Webmail Open Source"
|
||||
|
||||
version = "1.6.6~ynh1"
|
||||
maintainers = []
|
||||
|
||||
[upstream]
|
||||
license = "GPL-3.0-only"
|
||||
website = "https://roundcube.net/"
|
||||
demo = "https://demo.yunohost.org/webmail/"
|
||||
admindoc = "https://github.com/roundcube/roundcubemail/wiki"
|
||||
code = "https://github.com/roundcube/roundcubemail"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.2"
|
||||
architectures = "all"
|
||||
multi_instance = true
|
||||
ldap = true
|
||||
sso = true
|
||||
disk = "50M"
|
||||
ram.build = "50M"
|
||||
ram.runtime = "50M"
|
||||
|
||||
[install]
|
||||
[install.domain]
|
||||
type = "domain"
|
||||
|
||||
[install.path]
|
||||
type = "path"
|
||||
default = "/webmail"
|
||||
|
||||
[install.init_main_permission]
|
||||
type = "group"
|
||||
default = "visitors"
|
||||
|
||||
[install.language]
|
||||
ask.en = "Choose the application language"
|
||||
ask.fr = "Choisissez la langue de l'application"
|
||||
type = "select"
|
||||
choices = ["de_DE", "en_GB", "fr_FR", "it_IT"]
|
||||
default = "en_GB"
|
||||
|
||||
[install.with_carddav]
|
||||
ask.en = "Install CardDAV synchronization plugin?"
|
||||
ask.fr = "Installer le plugin de synchronisation CardDAV ?"
|
||||
type = "boolean"
|
||||
default = false
|
||||
|
||||
[resources]
|
||||
[resources.sources.main]
|
||||
url = "https://github.com/roundcube/roundcubemail/releases/download/1.6.6/roundcubemail-1.6.6.tar.gz"
|
||||
sha256 = "40e4d7505b01f401e757f7439930ed96b1245ffc3863dd326fcf21e0e5847c74"
|
||||
autoupdate.strategy = "latest_github_release"
|
||||
|
||||
[resources.system_user]
|
||||
|
||||
[resources.install_dir]
|
||||
|
||||
[resources.permissions]
|
||||
main.url = "/"
|
||||
|
||||
[resources.apt]
|
||||
packages = [
|
||||
"mariadb-server",
|
||||
"php-pear",
|
||||
"php8.1-ldap",
|
||||
"php8.1-mysql",
|
||||
"php8.1-cli",
|
||||
"php8.1-intl",
|
||||
"php8.1-zip",
|
||||
"php8.1-gd",
|
||||
"php8.1-mbstring",
|
||||
"php8.1-dom",
|
||||
"php8.1-curl",
|
||||
]
|
||||
|
||||
[resources.database]
|
||||
type = "mysql"
|
|
@ -4,13 +4,8 @@
|
|||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
|
||||
YNH_PHP_VERSION="7.4"
|
||||
|
||||
# Package dependencies
|
||||
pkg_dependencies="php-pear php${YNH_PHP_VERSION}-ldap php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-dom php${YNH_PHP_VERSION}-curl"
|
||||
|
||||
# Composer version
|
||||
YNH_COMPOSER_VERSION=2.3.7
|
||||
YNH_COMPOSER_VERSION=2.5.5
|
||||
|
||||
# Plugins version
|
||||
contextmenu_version=3.3.1
|
||||
|
|
|
@ -9,25 +9,6 @@
|
|||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info --message="Loading installation 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)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
#=================================================
|
||||
|
@ -37,7 +18,7 @@ ynh_print_info --message="Declaring files to be backed up..."
|
|||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="$final_path"
|
||||
ynh_backup --src_path="$install_dir"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
|
|
|
@ -8,60 +8,6 @@
|
|||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS
|
||||
#=================================================
|
||||
|
||||
old_domain=$YNH_APP_OLD_DOMAIN
|
||||
old_path=$YNH_APP_OLD_PATH
|
||||
|
||||
new_domain=$YNH_APP_NEW_DOMAIN
|
||||
new_path=$YNH_APP_NEW_PATH
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=2
|
||||
|
||||
# Needed for helper "ynh_add_nginx_config"
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
||||
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# CHECK WHICH PARTS SHOULD BE CHANGED
|
||||
#=================================================
|
||||
|
||||
change_domain=0
|
||||
if [ "$old_domain" != "$new_domain" ]
|
||||
then
|
||||
change_domain=1
|
||||
fi
|
||||
|
||||
change_path=0
|
||||
if [ "$old_path" != "$new_path" ]
|
||||
then
|
||||
change_path=1
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
|
@ -70,38 +16,7 @@ fi
|
|||
#=================================================
|
||||
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2
|
||||
|
||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||
|
||||
# Change the path in the NGINX config file
|
||||
if [ $change_path -eq 1 ]
|
||||
then
|
||||
# Make a backup of the original NGINX config file if modified
|
||||
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
||||
# Set global variables for NGINX helper
|
||||
domain="$old_domain"
|
||||
path_url="$new_path"
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
fi
|
||||
|
||||
# Change the domain for NGINX
|
||||
if [ $change_domain -eq 1 ]
|
||||
then
|
||||
# Delete file checksum for the old conf file location
|
||||
ynh_delete_file_checksum --file="$nginx_conf_path"
|
||||
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
||||
# Store file checksum for the new config file location
|
||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=2
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
ynh_change_url_nginx_config
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
113
scripts/install
113
scripts/install
|
@ -9,91 +9,33 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||
#=================================================
|
||||
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url=$YNH_APP_ARG_PATH
|
||||
with_carddav=$YNH_APP_ARG_WITH_CARDDAV
|
||||
language=$YNH_APP_ARG_LANGUAGE
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
fpm_footprint="low"
|
||||
fpm_free_footprint=0
|
||||
fpm_usage="low"
|
||||
|
||||
#=================================================
|
||||
# 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=2
|
||||
|
||||
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
||||
ynh_app_setting_set --app=$app --key=with_carddav --value=$with_carddav
|
||||
ynh_app_setting_set --app=$app --key=language --value=$language
|
||||
ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
|
||||
ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint
|
||||
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# CREATE A MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a MySQL database..." --weight=2
|
||||
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
db_user=$db_name
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
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=3
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..." --weight=7
|
||||
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
ynh_setup_source --dest_dir="$install_dir"
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
|
@ -103,14 +45,8 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2
|
|||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
|
||||
|
||||
# Create a dedicated php-fpm config
|
||||
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
|
@ -120,7 +56,7 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
|||
ynh_script_progression --message="Installing Roundcube with Composer..." --weight=30
|
||||
|
||||
# Install composer.json
|
||||
cp "$final_path/composer.json-dist" "$final_path/composer.json"
|
||||
cp "$install_dir/composer.json-dist" "$install_dir/composer.json"
|
||||
|
||||
# Install composer
|
||||
ynh_install_composer
|
||||
|
@ -130,8 +66,7 @@ ynh_install_composer
|
|||
#=================================================
|
||||
ynh_script_progression --message="Initializing database..." --weight=3
|
||||
|
||||
ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" \
|
||||
< "$final_path/SQL/mysql.initial.sql"
|
||||
ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < "$install_dir/SQL/mysql.initial.sql"
|
||||
|
||||
#=================================================
|
||||
# CONFIGURE ROUNDCUBE
|
||||
|
@ -139,7 +74,7 @@ ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name
|
|||
ynh_script_progression --message="Configuring Roundcube..." --weight=2
|
||||
|
||||
deskey=$(ynh_string_random --length=24)
|
||||
ynh_add_config --template="../conf/config.inc.php" --destination="$final_path/config/config.inc.php"
|
||||
ynh_add_config --template="../conf/config.inc.php" --destination="$install_dir/config/config.inc.php"
|
||||
|
||||
#=================================================
|
||||
# INSTALL ADDITIONAL PLUGINS
|
||||
|
@ -147,9 +82,10 @@ ynh_add_config --template="../conf/config.inc.php" --destination="$final_path/co
|
|||
ynh_script_progression --message="Installing additional plugins..." --weight=60
|
||||
|
||||
# Create logs and temp directories
|
||||
mkdir -p "$final_path/"{logs,temp}
|
||||
mkdir -p "$install_dir/"{logs,temp}
|
||||
|
||||
# Install net_LDAP
|
||||
export COMPOSER_ALLOW_SUPERUSER=1
|
||||
ynh_composer_exec --commands="require kolab/net_ldap3"
|
||||
|
||||
# Install contextmenu and automatic_addressbook plugins
|
||||
|
@ -161,9 +97,9 @@ ynh_composer_exec --commands="require \
|
|||
|
||||
installed_plugins+=" 'contextmenu', 'automatic_addressbook',"
|
||||
|
||||
ynh_add_config --template="../conf/enigma.config.inc.php" --destination="$final_path/plugins/enigma/config.inc.php"
|
||||
mkdir -p "$final_path/plugins/enigma/home"
|
||||
chown -R $app:www-data "$final_path/plugins/enigma/home"
|
||||
ynh_add_config --template="../conf/enigma.config.inc.php" --destination="$install_dir/plugins/enigma/config.inc.php"
|
||||
mkdir -p "$install_dir/plugins/enigma/home"
|
||||
chown -R $app:www-data "$install_dir/plugins/enigma/home"
|
||||
|
||||
# Install CardDAV plugin
|
||||
if [ $with_carddav -eq 1 ]
|
||||
|
@ -174,7 +110,7 @@ then
|
|||
carddav_server=0
|
||||
|
||||
# Copy the plugin configuration file
|
||||
cp $final_path/plugins/carddav/config.inc.php{.dist,}
|
||||
cp $install_dir/plugins/carddav/config.inc.php{.dist,}
|
||||
|
||||
# Look for installed and supported CardDAV servers
|
||||
for carddav_app in "nextcloud" "baikal"
|
||||
|
@ -184,13 +120,13 @@ then
|
|||
do
|
||||
carddav_server=1
|
||||
# Append preset configuration to the config file
|
||||
cat "../conf/${carddav_app}.inc.php" >> $final_path/plugins/carddav/config.inc.php
|
||||
cat "../conf/${carddav_app}.inc.php" >> $install_dir/plugins/carddav/config.inc.php
|
||||
# Retrieve app settings and enable relevant preset
|
||||
carddav_domain=$(ynh_app_setting_get --app=$carddav_app_id --key=domain)
|
||||
carddav_path=$(ynh_app_setting_get --app=$carddav_app_id --key=path)
|
||||
carddav_url="https://${carddav_domain}${carddav_path%/}"
|
||||
ynh_replace_string --match_string="{${carddav_app}_id}" --replace_string="$carddav_app_id" --target_file="$final_path/plugins/carddav/config.inc.php"
|
||||
ynh_replace_string --match_string="{${carddav_app}_url}" --replace_string="$carddav_url" --target_file="$final_path/plugins/carddav/config.inc.php"
|
||||
ynh_replace_string --match_string="{${carddav_app}_id}" --replace_string="$carddav_app_id" --target_file="$install_dir/plugins/carddav/config.inc.php"
|
||||
ynh_replace_string --match_string="{${carddav_app}_url}" --replace_string="$carddav_url" --target_file="$install_dir/plugins/carddav/config.inc.php"
|
||||
done
|
||||
done
|
||||
|
||||
|
@ -206,26 +142,17 @@ fi
|
|||
#=================================================
|
||||
ynh_script_progression --message="Updating Roundcube configuration..." --weight=3
|
||||
|
||||
ynh_replace_string --match_string="^\s*// installed plugins" --replace_string="&\n $installed_plugins" --target_file="$final_path/config/config.inc.php"
|
||||
ynh_replace_string --match_string="^\s*// installed plugins" --replace_string="&\n $installed_plugins" --target_file="$install_dir/config/config.inc.php"
|
||||
|
||||
# Update javascript dependencies
|
||||
(cd "$final_path"
|
||||
(cd "$install_dir"
|
||||
/usr/bin/php$phpversion -q ./bin/install-jsdeps.sh -v ?)
|
||||
|
||||
# Store the config file checksum into the app settings
|
||||
ynh_store_file_checksum --file="$final_path/config/config.inc.php"
|
||||
ynh_store_file_checksum --file="$install_dir/config/config.inc.php"
|
||||
|
||||
chmod 400 "$final_path/config/config.inc.php"
|
||||
chown $app:$app "$final_path/config/config.inc.php"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=2
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
chmod 400 "$install_dir/config/config.inc.php"
|
||||
chown $app:$app "$install_dir/config/config.inc.php"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -9,34 +9,6 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the MySQL database..." --weight=2
|
||||
|
||||
# Remove a database if it exists, along with the associated user
|
||||
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing $app main directory..." --weight=3
|
||||
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove --file="$final_path"
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -45,32 +17,9 @@ ynh_script_progression --message="Removing NGINX web server configuration..." --
|
|||
# Remove the dedicated NGINX config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=3
|
||||
|
||||
# Remove the dedicated PHP-FPM config
|
||||
ynh_remove_fpm_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..." --weight=1
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the dedicated system user..." --weight=2
|
||||
|
||||
# Delete a system user
|
||||
ynh_system_user_delete --username=$app
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -9,66 +9,22 @@
|
|||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
# 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)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
|
||||
fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..." --weight=3
|
||||
|
||||
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=4
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring $app main directory..." --weight=4
|
||||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
ynh_restore_file --origin_path="$install_dir"
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
|
||||
ynh_script_progression --message="Restoring the MySQL database..." --weight=5
|
||||
|
||||
# Define and install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
|
@ -77,27 +33,8 @@ ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weig
|
|||
|
||||
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
|
||||
# Recreate a dedicated php-fpm config
|
||||
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$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"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the MySQL database..." --weight=5
|
||||
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
|
136
scripts/upgrade
136
scripts/upgrade
|
@ -9,67 +9,20 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=2
|
||||
|
||||
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)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
with_carddav=$(ynh_app_setting_get --app=$app --key=with_carddav)
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
language=$(ynh_app_setting_get --app=$app --key=language)
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
|
||||
fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
|
||||
fpm_free_footprint=$(ynh_app_setting_get --app=$app --key=fpm_free_footprint)
|
||||
fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up $app before upgrading (may take a while)..." --weight=5
|
||||
|
||||
# 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
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||
|
||||
# If db_name doesn't exist, create it
|
||||
if [ -z "$db_name" ]; then
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
fi
|
||||
|
||||
# If final_path doesn't exist, create it
|
||||
if [ -z "$final_path" ]; then
|
||||
final_path=/var/www/$app
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
fi
|
||||
|
||||
# If with_carddav doesn't exist, create it
|
||||
if [ -z "$with_carddav" ]; then
|
||||
if [ -f "$final_path/plugins/carddav/config.inc.php" ]
|
||||
if [ -z "${with_carddav:-}" ]; then
|
||||
if [ -f "$install_dir/plugins/carddav/config.inc.php" ]
|
||||
then
|
||||
with_carddav=1
|
||||
else
|
||||
|
@ -79,44 +32,29 @@ if [ -z "$with_carddav" ]; then
|
|||
fi
|
||||
|
||||
# If language doesn't exist, create it
|
||||
if [ -z "$language" ]; then
|
||||
if [ -z "${language:-}" ]; then
|
||||
language="en_GB"
|
||||
ynh_app_setting_set --app=$app --key=language --value=$language
|
||||
fi
|
||||
|
||||
# If fpm_footprint doesn't exist, create it
|
||||
if [ -z "$fpm_footprint" ]; then
|
||||
if [ -z "${fpm_footprint:-}" ]; then
|
||||
fpm_footprint=low
|
||||
ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
|
||||
fi
|
||||
|
||||
# If fpm_free_footprint doesn't exist, create it
|
||||
if [ -z "$fpm_free_footprint" ]; then
|
||||
if [ -z "${fpm_free_footprint:-}" ]; then
|
||||
fpm_free_footprint=0
|
||||
ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint
|
||||
fi
|
||||
|
||||
# If fpm_usage doesn't exist, create it
|
||||
if [ -z "$fpm_usage" ]; then
|
||||
if [ -z "${fpm_usage:-}" ]; then
|
||||
fpm_usage=low
|
||||
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
|
||||
fi
|
||||
|
||||
# Cleaning legacy permissions
|
||||
if ynh_legacy_permissions_exists; then
|
||||
ynh_legacy_permissions_delete_all
|
||||
|
||||
ynh_app_setting_delete --app=$app --key=is_public
|
||||
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"
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
|
@ -124,26 +62,18 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
|
|||
#=================================================
|
||||
|
||||
# Get the current version of roundcube
|
||||
oldversion=$(grep RCMAIL_VERSION "$final_path/program/include/iniset.php" | cut -d\' -f4)
|
||||
oldversion=$(grep RCMAIL_VERSION "$install_dir/program/include/iniset.php" | cut -d\' -f4)
|
||||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=3
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
ynh_setup_source --dest_dir="$install_dir"
|
||||
fi
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..." --weight=1
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
|
@ -151,12 +81,7 @@ ynh_install_app_dependencies $pkg_dependencies
|
|||
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=5
|
||||
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
|
||||
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
@ -172,7 +97,7 @@ then
|
|||
ynh_script_progression --message="Reconfiguring Roundcube..." --weight=1
|
||||
|
||||
deskey=$(ynh_string_random --length=24)
|
||||
ynh_add_config --template="../conf/config.inc.php" --destination="$final_path/config/config.inc.php"
|
||||
ynh_add_config --template="../conf/config.inc.php" --destination="$install_dir/config/config.inc.php"
|
||||
|
||||
#=================================================
|
||||
# UPDATE DEPENDENCIES WITH COMPOSER
|
||||
|
@ -183,14 +108,14 @@ then
|
|||
ynh_install_composer
|
||||
|
||||
# Check if dependencies need to be updated with Composer
|
||||
if [ -f "$final_path/composer.json" ]
|
||||
if [ -f "$install_dir/composer.json" ]
|
||||
then
|
||||
ynh_exec_warn_less ynh_composer_exec --commands="update"
|
||||
# Update plugin-installer for Composer version 2.0
|
||||
ynh_exec_warn_less ynh_composer_exec --commands="require roundcube/plugin-installer:>=0.2.0"
|
||||
else
|
||||
# Install composer.json
|
||||
cp "$final_path/composer.json-dist" "$final_path/composer.json"
|
||||
cp "$install_dir/composer.json-dist" "$install_dir/composer.json"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -199,7 +124,7 @@ then
|
|||
ynh_script_progression --message="Upgrading additional plugins..." --weight=30
|
||||
|
||||
# Create logs and temp directories
|
||||
mkdir -p "$final_path/"{logs,temp}
|
||||
mkdir -p "$install_dir/"{logs,temp}
|
||||
|
||||
# Install net_LDAP
|
||||
ynh_composer_exec --commands="require kolab/net_ldap3"
|
||||
|
@ -213,9 +138,9 @@ then
|
|||
|
||||
installed_plugins+=" 'contextmenu', 'automatic_addressbook',"
|
||||
|
||||
ynh_add_config --template="../conf/enigma.config.inc.php" --destination="$final_path/plugins/enigma/config.inc.php"
|
||||
mkdir -p "$final_path/plugins/enigma/home"
|
||||
chown -R $app:$app "$final_path/plugins/enigma/home"
|
||||
ynh_add_config --template="../conf/enigma.config.inc.php" --destination="$install_dir/plugins/enigma/config.inc.php"
|
||||
mkdir -p "$install_dir/plugins/enigma/home"
|
||||
chown -R $app:$app "$install_dir/plugins/enigma/home"
|
||||
|
||||
# Update or install CardDAV plugin
|
||||
if [ $with_carddav -eq 1 ]
|
||||
|
@ -226,7 +151,7 @@ then
|
|||
carddav_server=0
|
||||
|
||||
# Copy the plugin configuration file
|
||||
cp $final_path/plugins/carddav/config.inc.php{.dist,}
|
||||
cp $install_dir/plugins/carddav/config.inc.php{.dist,}
|
||||
|
||||
# Look for installed and supported CardDAV servers
|
||||
for carddav_app in "nextcloud" "baikal"
|
||||
|
@ -236,13 +161,13 @@ then
|
|||
do
|
||||
carddav_server=1
|
||||
# Append preset configuration to the config file
|
||||
cat "../conf/${carddav_app}.inc.php" >> $final_path/plugins/carddav/config.inc.php
|
||||
cat "../conf/${carddav_app}.inc.php" >> $install_dir/plugins/carddav/config.inc.php
|
||||
# Retrieve app settings and enable relevant preset
|
||||
carddav_domain=$(ynh_app_setting_get --app=$carddav_app_id --key=domain)
|
||||
carddav_path=$(ynh_app_setting_get --app=$carddav_app_id --key=path)
|
||||
carddav_url="https://${carddav_domain}${carddav_path%/}"
|
||||
ynh_replace_string --match_string="{${carddav_app}_id}" --replace_string="$carddav_app_id" --target_file="$final_path/plugins/carddav/config.inc.php"
|
||||
ynh_replace_string --match_string="{${carddav_app}_url}" --replace_string="$carddav_url" --target_file="$final_path/plugins/carddav/config.inc.php"
|
||||
ynh_replace_string --match_string="{${carddav_app}_id}" --replace_string="$carddav_app_id" --target_file="$install_dir/plugins/carddav/config.inc.php"
|
||||
ynh_replace_string --match_string="{${carddav_app}_url}" --replace_string="$carddav_url" --target_file="$install_dir/plugins/carddav/config.inc.php"
|
||||
done
|
||||
done
|
||||
|
||||
|
@ -258,17 +183,17 @@ then
|
|||
#=================================================
|
||||
ynh_script_progression --message="Updating $app configuration..." --weight=4
|
||||
|
||||
ynh_replace_string --match_string="^\s*// installed plugins" --replace_string="&\n $installed_plugins" --target_file="$final_path/config/config.inc.php"
|
||||
ynh_replace_string --match_string="^\s*// installed plugins" --replace_string="&\n $installed_plugins" --target_file="$install_dir/config/config.inc.php"
|
||||
|
||||
# Update JavaScript dependencies
|
||||
pushd "$final_path"
|
||||
pushd "$install_dir"
|
||||
COMPOSER_ALLOW_SUPERUSER=1 ./bin/update.sh --version="?" -y <<< ""
|
||||
|
||||
# Store the config file checksum into the app settings
|
||||
ynh_store_file_checksum --file="$final_path/config/config.inc.php"
|
||||
ynh_store_file_checksum --file="$install_dir/config/config.inc.php"
|
||||
|
||||
chmod 400 "$final_path/config/config.inc.php"
|
||||
chown $app:$app "$final_path/config/config.inc.php"
|
||||
chmod 400 "$install_dir/config/config.inc.php"
|
||||
chown $app:$app "$install_dir/config/config.inc.php"
|
||||
|
||||
#=================================================
|
||||
# UPDATE ROUNDCUBE CORE
|
||||
|
@ -279,13 +204,6 @@ then
|
|||
popd
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
12
tests.toml
Normal file
12
tests.toml
Normal file
|
@ -0,0 +1,12 @@
|
|||
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json
|
||||
|
||||
test_format = 1.0
|
||||
|
||||
[default]
|
||||
|
||||
# -------------------------------
|
||||
# Default args to use for install
|
||||
# -------------------------------
|
||||
|
||||
args.language = "en_GB"
|
||||
args.with_carddav = 1
|
Loading…
Reference in a new issue