diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..2729a6b --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,55 @@ +--- +name: Bug report +about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently. + +--- + +**How to post a meaningful bug report** +1. *Read this whole template first.* +2. *Determine if you are on the right place:* + - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!* + - *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.* + - *When in doubt, post here and we will figure it out together.* +3. *Delete the italic comments as you write over them below, and remove this guide.* +--- + +### Describe the bug + +*A clear and concise description of what the bug is.* + +### Context + +- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...* +- YunoHost version: x.x.x +- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...* +- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes* + - If yes, please explain: +- Using, or trying to install package version/branch: +- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`* + +### Steps to reproduce + +- *If you performed a command from the CLI, the command itself is enough. For example:* + ```sh + sudo yunohost app install the_app + ``` +- *If you used the webadmin, please perform the equivalent command from the CLI first.* +- *If the error occurs in your browser, explain what you did:* + 1. *Go to '...'* + 2. *Click on '...'* + 3. *Scroll down to '...'* + 4. *See error* + +### Expected behavior + +*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.* + +### Logs + +*When an operation fails, YunoHost provides a simple way to share the logs.* +- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.* +- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.* + +*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)* + +*If applicable and useful, add screenshots to help explain your problem.* diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..ef70e18 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,16 @@ +## Problem + +- *Description of why you made this PR* + +## Solution + +- *And how do you fix that problem* + +## PR Status + +- [ ] Code finished and ready to be reviewed/tested +- [ ] The fix/enhancement were manually tested (if applicable) + +## Automatic tests + +Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization) diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh new file mode 100644 index 0000000..cddea17 --- /dev/null +++ b/.github/workflows/updater.sh @@ -0,0 +1,107 @@ +#!/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/GetSimpleCMS/GetSimpleCMS/archive/refs/tags/$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 +echo "REPO=$repo" >> $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 < 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 diff --git a/.github/workflows/updater.yml b/.github/workflows/updater.yml new file mode 100644 index 0000000..fb72ba0 --- /dev/null +++ b/.github/workflows/updater.yml @@ -0,0 +1,49 @@ +# 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 ' + author: 'yunohost-bot ' + 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 diff --git a/README.md b/README.md index 837d179..91e2ca3 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ It shall NOT be edited by hand. # GetSimple for YunoHost -[![Integration level](https://dash.yunohost.org/integration/getsimple.svg)](https://dash.yunohost.org/appci/app/getsimple) ![](https://ci-apps.yunohost.org/ci/badges/getsimple.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/getsimple.maintain.svg) +[![Integration level](https://dash.yunohost.org/integration/getsimple.svg)](https://dash.yunohost.org/appci/app/getsimple) ![Working status](https://ci-apps.yunohost.org/ci/badges/getsimple.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/getsimple.maintain.svg) [![Install GetSimple with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=getsimple) *[Lire ce readme en français.](./README_fr.md)* @@ -26,13 +26,13 @@ GetSimple is an XML based, stand-alone, fully independent and lite Content Manag - Simple Theme Customization - Designed For the Small-Site Market -**Shipped version:** 3.3.16~ynh1 +**Shipped version:** 3.3.16~ynh2 **Demo:** https://demo.example.com ## Screenshots -![](./doc/screenshots/screenshot_editpage.png) +![Screenshot of GetSimple](./doc/screenshots/screenshot_editpage.png) ## Disclaimers / important information @@ -40,21 +40,22 @@ From a web browser, navigate to the folder where you just uploaded GetSimple to. ## Documentation and resources -* Official app website: http://get-simple.info/ -* Official admin documentation: http://get-simple.info/wiki/fr:start -* Upstream app code repository: https://github.com/GetSimpleCMS/GetSimpleCMS -* YunoHost documentation for this app: https://yunohost.org/app_getsimple -* Report a bug: https://github.com/YunoHost-Apps/getsimple_ynh/issues +* Official app website: +* Official admin documentation: +* Upstream app code repository: +* YunoHost documentation for this app: +* Report a bug: ## Developer info Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/getsimple_ynh/tree/testing). To try the testing branch, please proceed like that. -``` + +``` bash sudo yunohost app install https://github.com/YunoHost-Apps/getsimple_ynh/tree/testing --debug or sudo yunohost app upgrade getsimple -u https://github.com/YunoHost-Apps/getsimple_ynh/tree/testing --debug ``` -**More info regarding app packaging:** https://yunohost.org/packaging_apps \ No newline at end of file +**More info regarding app packaging:** diff --git a/README_fr.md b/README_fr.md index 5e5411f..604a47b 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,10 +1,14 @@ + + # GetSimple pour YunoHost -[![Niveau d'intégration](https://dash.yunohost.org/integration/getsimple.svg)](https://dash.yunohost.org/appci/app/getsimple) ![](https://ci-apps.yunohost.org/ci/badges/getsimple.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/getsimple.maintain.svg) +[![Niveau d'intégration](https://dash.yunohost.org/integration/getsimple.svg)](https://dash.yunohost.org/appci/app/getsimple) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/getsimple.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/getsimple.maintain.svg) [![Installer GetSimple avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=getsimple) *[Read this readme in english.](./README.md)* -*[Lire ce readme en français.](./README_fr.md)* > *Ce package vous permet d'installer GetSimple rapidement et simplement sur un serveur YunoHost. Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* @@ -22,13 +26,13 @@ GetSimple is an XML based, stand-alone, fully independent and lite Content Manag - Simple Theme Customization - Designed For the Small-Site Market -**Version incluse :** 3.3.16~ynh1 +**Version incluse :** 3.3.16~ynh2 **Démo :** https://demo.example.com ## Captures d'écran -![](./doc/screenshots/screenshot_editpage.png) +![Capture d'écran de GetSimple](./doc/screenshots/screenshot_editpage.png) ## Avertissements / informations importantes @@ -36,21 +40,22 @@ From a web browser, navigate to the folder where you just uploaded GetSimple to. ## Documentations et ressources -* Site officiel de l'app : http://get-simple.info/ -* Documentation officielle de l'admin : http://get-simple.info/wiki/fr:start -* Dépôt de code officiel de l'app : https://github.com/GetSimpleCMS/GetSimpleCMS -* Documentation YunoHost pour cette app : https://yunohost.org/app_getsimple -* Signaler un bug : https://github.com/YunoHost-Apps/getsimple_ynh/issues +* Site officiel de l'app : +* Documentation officielle de l'admin : +* Dépôt de code officiel de l'app : +* Documentation YunoHost pour cette app : +* Signaler un bug : ## Informations pour les développeurs Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/getsimple_ynh/tree/testing). Pour essayer la branche testing, procédez comme suit. -``` + +``` bash sudo yunohost app install https://github.com/YunoHost-Apps/getsimple_ynh/tree/testing --debug ou sudo yunohost app upgrade getsimple -u https://github.com/YunoHost-Apps/getsimple_ynh/tree/testing --debug ``` -**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps \ No newline at end of file +**Plus d'infos sur le packaging d'applications :** diff --git a/check_process b/check_process index 8362c16..064eb37 100644 --- a/check_process +++ b/check_process @@ -21,7 +21,3 @@ ;;; Options Email= Notification=none -;;; Upgrade options - ; commit=CommitHash - name=Name and date of the commit. - manifest_arg=domain=DOMAIN&path=PATH&is_public=1&language=fr&admin=USER&password=pass&port=666& diff --git a/conf/nginx.conf b/conf/nginx.conf index 549b52a..d9fdc4e 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -2,7 +2,7 @@ location __PATH__/ { # Path to source - alias __FINALPATH__/ ; + alias __FINALPATH__/; index index.php; diff --git a/conf/systemd.service b/conf/systemd.service deleted file mode 100644 index 31e9da3..0000000 --- a/conf/systemd.service +++ /dev/null @@ -1,45 +0,0 @@ -[Unit] -Description=Small description of the service -After=network.target - -[Service] -Type=simple -User=__APP__ -Group=__APP__ -WorkingDirectory=__FINALPATH__/ -ExecStart=__FINALPATH__/script -StandardOutput=append:/var/log/__APP__/__APP__.log -StandardError=inherit - -# Sandboxing options to harden security -# Depending on specificities of your service/app, you may need to tweak these -# .. but this should be a good baseline -# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html -NoNewPrivileges=yes -PrivateTmp=yes -PrivateDevices=yes -RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 -RestrictNamespaces=yes -RestrictRealtime=yes -DevicePolicy=closed -ProtectSystem=full -ProtectControlGroups=yes -ProtectKernelModules=yes -ProtectKernelTunables=yes -LockPersonality=yes -SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap - -# Denying access to capabilities that should not be relevant for webapps -# Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html -CapabilityBoundingSet=~CAP_RAWIO CAP_MKNOD -CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_AUDIT_WRITE -CapabilityBoundingSet=~CAP_SYS_BOOT CAP_SYS_TIME CAP_SYS_MODULE CAP_SYS_PACCT -CapabilityBoundingSet=~CAP_LEASE CAP_LINUX_IMMUTABLE CAP_IPC_LOCK -CapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_WAKE_ALARM -CapabilityBoundingSet=~CAP_SYS_TTY_CONFIG -CapabilityBoundingSet=~CAP_MAC_ADMIN CAP_MAC_OVERRIDE -CapabilityBoundingSet=~CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW -CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG - -[Install] -WantedBy=multi-user.target diff --git a/conf/temp.gsconfig.php b/conf/temp.gsconfig.php index bff157f..4e3fe46 100644 --- a/conf/temp.gsconfig.php +++ b/conf/temp.gsconfig.php @@ -61,7 +61,7 @@ define('GSDONOTPING', 1); #define('GSEDITOROPTIONS', ''); # Set email from address -#define('GSFROMEMAIL', 'noreply@get-simple.info'); +#define('GSFROMEMAIL', 'noreply@__DOMAIN__'); # Autosave within edit.php. Value is the autosave interval in seconds #define('GSAUTOSAVE', 900); @@ -71,7 +71,7 @@ define('GSDONOTPING', 1); # Set PHP locale # http://php.net/manual/en/function.setlocale.php -etlocale(LC_ALL, '__LANGUAGE__'); +setlocale(LC_ALL, '__LANGUAGE__'); # Define default timezone of server, accepts php timezone string # valid timeszones can be found here http://www.php.net/manual/en/timezones.php @@ -127,4 +127,4 @@ define('GSNOAPACHECHECK', true); # GS can format its xml files before saving them if you require human readable source for them # define('GSFORMATXML',true); -?> \ No newline at end of file +?> diff --git a/manifest.json b/manifest.json index 672a9db..1a75109 100644 --- a/manifest.json +++ b/manifest.json @@ -6,11 +6,11 @@ "en": "Flatfile CMS that works fast and efficient", "fr": "Flatfile CMS that works fast and efficient" }, - "version": "3.3.16~ynh1", - "url": "http://get-simple.info/", + "version": "3.3.16~ynh2", + "url": "http://get-simple.info", "upstream": { "license": "GPL-3.0", - "website": "http://get-simple.info/", + "website": "http://get-simple.info", "demo": "https://demo.example.com", "admindoc": "http://get-simple.info/wiki/fr:start", "code": "https://github.com/GetSimpleCMS/GetSimpleCMS" @@ -26,10 +26,10 @@ "multi_instance": true, "services": [ "nginx", - "php7.4-fpm" + "php7.3-fpm" ], "arguments": { - "install" : [ + "install": [ { "name": "domain", "type": "domain" @@ -52,8 +52,21 @@ "en": "Choose the application language", "fr": "Choisissez la langue de l'application" }, - "choices": ["de_DE", "en_US", "fr_FR", "nl_NL"], + "choices": [ + "de_DE", + "en_US", + "fr_FR", + "nl_NL" + ], "default": "fr_FR" + }, + { + "name": "admin", + "type": "user" + }, + { + "name": "password", + "type": "password" } ] } diff --git a/scripts/_common.sh b/scripts/_common.sh index 4af8641..bdb3d3a 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,9 +4,8 @@ # COMMON VARIABLES #================================================= -YNH_PHP_VERSION="7.4" - -pkg_dependencies="php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-xml" +# dependencies used by the app +pkg_dependencies="php$YNH_DEFAULT_PHP_VERSION-xml php$YNH_DEFAULT_PHP_VERSION-curl php$YNH_DEFAULT_PHP_VERSION-gd php$YNH_DEFAULT_PHP_VERSION-zip php$YNH_DEFAULT_PHP_VERSION-xml" #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index 2efaa42..9b12047 100755 --- a/scripts/backup +++ b/scripts/backup @@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. true } # Exit if an error occurs during the execution of the script diff --git a/scripts/install b/scripts/install index 5757c3f..f0ef46b 100755 --- a/scripts/install +++ b/scripts/install @@ -14,7 +14,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. true } # Exit if an error occurs during the execution of the script @@ -28,11 +27,14 @@ domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH is_public=$YNH_APP_ARG_IS_PUBLIC language=$YNH_APP_ARG_LANGUAGE -timezone="$(cat /etc/timezone)" -phpversion=$YNH_PHP_VERSION +admin=$YNH_APP_ARG_ADMIN +password=$YNH_APP_ARG_PASSWORD app=$YNH_APP_INSTANCE_NAME +timezone="$(cat /etc/timezone)" +email=$(ynh_user_get_info --username=$admin --key="mail") + #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= @@ -52,6 +54,7 @@ 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 ynh_app_setting_set --app=$app --key=language --value=$language +ynh_app_setting_set --app=$app --key=admin --value=$admin #================================================= # INSTALL DEPENDENCIES @@ -77,20 +80,10 @@ 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" -mv ../sources/lang/* $final_path/admin/lang - chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=1 - -# Create a dedicated NGINX config -ynh_add_nginx_config - #================================================= # PHP-FPM CONFIGURATION #================================================= @@ -99,15 +92,44 @@ ynh_script_progression --message="Configuring PHP-FPM..." --weight=1 # Create a dedicated PHP-FPM config ynh_add_fpm_config +#================================================= +# NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Configuring NGINX web server..." --weight=1 + +# Create a dedicated NGINX config +ynh_add_nginx_config + +#================================================= +# SPECIFIC SETUP #================================================= # ADD A CONFIGURATION #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 -ynh_add_config --template="../conf/temp.gsconfig.php" --destination="$final_path/temp.gsconfig.php" +ynh_add_config --template="../conf/temp.gsconfig.php" --destination="$final_path/gsconfig.php" -# chmod 655 "$final_path/temp.gsconfig.php" -# chown $app:$app "$final_path/temp.gsconfig.php" +chmod 400 "$final_path/gsconfig.php" +chown $app:$app "$final_path/gsconfig.php" + +#================================================= +# SETUP APPLICATION WITH CURL +#================================================= +ynh_script_progression --message="Setuping application with CURL..." + +# Set the app as temporarily public for curl call +ynh_script_progression --message="Configuring SSOwat..." +# Making the app public for curl +ynh_permission_update --permission="main" --add="visitors" + +# Installation with curl +ynh_script_progression --message="Finalizing installation..." +ynh_local_curl "/admin/install.php" "lang=$language" "continue=continue" +ynh_local_curl "/admin/setup.php" "siteurl=https://$domain$path_url" "lang=$language" "sitename=YunoHost" "user=$admin" "email=$email" "submitted=submitted" +ynh_local_curl "/admin/support.php" "updated=2" + +# Remove the public access +ynh_permission_update --permission="main" --remove="visitors" #================================================= # SETUP SSOWAT @@ -117,6 +139,8 @@ ynh_script_progression --message="Configuring permissions..." --weight=1 # Make app public if necessary if [ $is_public -eq 1 ] then + # Everyone can access the app. + # The "main" permission is automatically created before the install script. ynh_permission_update --permission="main" --add="visitors" fi diff --git a/scripts/remove b/scripts/remove index 89ee8eb..765a213 100755 --- a/scripts/remove +++ b/scripts/remove @@ -19,6 +19,8 @@ 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) +#================================================= +# STANDARD REMOVE #================================================= # REMOVE APP MAIN DIR #================================================= diff --git a/scripts/restore b/scripts/restore index c85fc6b..e20d9eb 100755 --- a/scripts/restore +++ b/scripts/restore @@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - #### Remove this function if there's nothing to clean before calling the remove script. true } # Exit if an error occurs during the execution of the script @@ -43,13 +42,6 @@ test ! -d $final_path \ #================================================= # STANDARD RESTORATION STEPS -#================================================= -# 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" - #================================================= # RECREATE THE DEDICATED USER #================================================= @@ -86,6 +78,13 @@ ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weig ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +#================================================= +# 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" + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index b39ba75..b3070f0 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,9 +21,12 @@ path_url=$(ynh_app_setting_get --app=$app --key=path) language=$(ynh_app_setting_get --app=$app --key=language) final_path=$(ynh_app_setting_get --app=$app --key=final_path) +timezone="$(cat /etc/timezone)" + #================================================= # CHECK VERSION #================================================= +ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) @@ -58,21 +61,13 @@ then ynh_script_progression --message="Upgrading source files..." --weight=5 # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" + ynh_setup_source --dest_dir="$final_path" --keep="gsconfig.php data/ backups/" fi chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 - -# Create a dedicated NGINX config -ynh_add_nginx_config - #================================================= # UPGRADE DEPENDENCIES #================================================= @@ -88,6 +83,29 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1 # Create a dedicated PHP-FPM config ynh_add_fpm_config +#================================================= +# NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 + +# Create a dedicated NGINX config +ynh_add_nginx_config + +#================================================= +# SPECIFIC UPGRADE +#================================================= +# UPDATE A CONFIG FILE +#================================================= +ynh_script_progression --message="Updating a configuration file..." + +ynh_add_config --template="../conf/temp.gsconfig.php" --destination="$final_path/gsconfig.php" + +chmod 400 "$final_path/gsconfig.php" +chown $app:$app "$final_path/gsconfig.php" +ynh_local_curl "/admin/support.php" "updated=2" + +#================================================= +# GENERIC FINALIZATION #================================================= # RELOAD NGINX #================================================= diff --git a/sources/lang/de_DE.php b/sources/extra_files/app/admin/lang/de_DE.php similarity index 100% rename from sources/lang/de_DE.php rename to sources/extra_files/app/admin/lang/de_DE.php diff --git a/sources/lang/fr_FR.php b/sources/extra_files/app/admin/lang/fr_FR.php old mode 100755 new mode 100644 similarity index 100% rename from sources/lang/fr_FR.php rename to sources/extra_files/app/admin/lang/fr_FR.php diff --git a/sources/lang/nl_NL.php b/sources/extra_files/app/admin/lang/nl_NL.php similarity index 100% rename from sources/lang/nl_NL.php rename to sources/extra_files/app/admin/lang/nl_NL.php