1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/lutim_ynh.git synced 2024-09-03 19:36:24 +02:00
This commit is contained in:
Éric Gaspar 2023-04-15 23:28:37 +02:00
parent 66379c9088
commit 6ea7f943ef
16 changed files with 28 additions and 642 deletions

View file

@ -1,83 +0,0 @@
Changelog
=========
## [0.12.1~ynh1](https://github.com/YunoHost-Apps/lutim_ynh/pull/46) - 2020-10-18
#### Changed
* [Update to Lutim 0.12.1](https://github.com/YunoHost-Apps/lutim_ynh/pull/52)
## [0.11.6~ynh4](https://github.com/YunoHost-Apps/lutim_ynh/pull/46) - 2020-04-25
#### Added
- [Add new badges](https://github.com/YunoHost-Apps/lutim_ynh/pull/46/commits/4e28257f0550378297789c77a5354b004100f5ae)
* [New reset actions](https://github.com/YunoHost-Apps/lutim_ynh/pull/46/commits/e1c90a7c1b2c0c66c4d7bfc8a8e2a221d5c817ab)
#### Fixed
- [Fix potential error on install](https://github.com/YunoHost-Apps/lutim_ynh/pull/46/commits/e481e03e0511787f297e10f85d6a54b3fedb5470)
#### Changed
- [Indentation](https://github.com/YunoHost-Apps/lutim_ynh/pull/46/commits/a934b7369842dfbdc45e7c1dfdf3483276d4c755)
- [Misc upgrade](https://github.com/YunoHost-Apps/lutim_ynh/pull/46/commits/750ea401950f4e8b3facfa7caa5bc2388b6a4272)
## [0.11.6~ynh3](https://github.com/YunoHost-Apps/lutim_ynh/pull/45) - 2020-03-12
#### Changed
- [ Fix migration to new permission system](https://github.com/YunoHost-Apps/lutim_ynh/pull/45/commits/e0d3764ffbcde3d354b7c27154f829cad8172e2e)
## [0.11.6~ynh2](https://github.com/YunoHost-Apps/lutim_ynh/pull/43) - 2020-01-04
#### Fixed
- [Fix config-panel](https://github.com/YunoHost-Apps/lutim_ynh/pull/43/commits/a549f8139737d0ed3f641a8b0425dfdeefb50ef4)
## [0.11.6~ynh1](https://github.com/YunoHost-Apps/lutim_ynh/pull/42) - 2020-01-02
#### Added
* [Set workers according to cpu](https://github.com/YunoHost-Apps/lutim_ynh/pull/42/commits/58e291949769d678ec48306199bcc03e3be20631)
- [Add changelog](https://github.com/YunoHost-Apps/lutim_ynh/pull/42/commits/b0859ab1612c22d210321d6302cad7872ec17abd)
#### Fixed
- [Fix cron tasks](https://github.com/YunoHost-Apps/lutim_ynh/pull/42/commits/dec8d0820fb46e984b2ca65e1012f5f737861965)
#### Changed
- [Update to last standard](https://github.com/YunoHost-Apps/lutim_ynh/pull/42/commits/5e5bf7c7a8f68b0768555005797ec3024a223299) [(twice)](https://github.com/YunoHost-Apps/lutim_ynh/pull/42/commits/51113ba7544991a3400abc9a78258ba594d58b4b)
- [Use toml for actions and config-panel](https://github.com/YunoHost-Apps/lutim_ynh/pull/42/commits/4f7bac24481138654e3e3128ba6637cdf8855855)
* [Update to 0.11.6](https://github.com/YunoHost-Apps/lutim_ynh/pull/42/commits/4b50a261fb4515aa2a32b7ca20c750c322bfd5c0)
## [0.11.5~ynh1](https://github.com/YunoHost-Apps/lutim_ynh/pull/35) - 2019-05-06
#### Changed
* [Update to Lutim 0.11.5](https://github.com/YunoHost-Apps/lutim_ynh/pull/35)
## [0.11.4~ynh3](https://github.com/YunoHost-Apps/lutim_ynh/pull/33) - 2019-02-18
#### Changed
- [Upgrade protected_regex](https://github.com/YunoHost-Apps/lutim_ynh/pull/33)
## [0.11.4~ynh2](https://github.com/YunoHost-Apps/lutim_ynh/pull/31) - 2019-02-03
#### Added
- [Add progression bar](https://github.com/YunoHost-Apps/lutim_ynh/pull/31/commits/6b63a2ce2feca4550e55f2404e8b18f13ef58fc7)
- [Changelog & html email](https://github.com/YunoHost-Apps/lutim_ynh/pull/31/commits/746d00174c3fde429f64b514d4f113b01780e701)
#### Fixed
- [Do not open port](https://github.com/YunoHost-Apps/lutim_ynh/pull/31/commits/0c2af89b610a420129588e62537bb248d7810777)
- [Delete dedicated user](https://github.com/YunoHost-Apps/lutim_ynh/pull/31/commits/f9d7f124f0966870004aa620ac4626dd8ebb19ff)
## [0.11.4~ynh1](https://github.com/YunoHost-Apps/lutim_ynh/pull/30) - 2019-01-21
#### Changed
* [Update to Lutim 0.11.4](https://github.com/YunoHost-Apps/lutim_ynh/pull/30/commits/0b3640581ce18b9f823baae7130ab0645f9f1e8e)
- [Update to last standart](https://github.com/YunoHost-Apps/lutim_ynh/pull/30/commits/9d37c8b9f50ef728ebe4a05031de4c70f76940b4)
## [0.10.4~ynh2](https://github.com/YunoHost-Apps/lutim_ynh/pull/29) - 2018-09-30
#### Added
* [Panel-config + actions fully tested](https://github.com/YunoHost-Apps/lutim_ynh/pull/29/commits/6cf6b6331170fd6f36575c9c06a17b11a9da66d0)

View file

@ -1,5 +1,5 @@
[Unit]
Description=Lutim: Image hosting and sharing service
Description=Lutim: image hosting and sharing service
After=network.target
[Service]

4
doc/ADMIN.md Normal file
View file

@ -0,0 +1,4 @@
## Configuration
Edit the file `__INSTALL_DIR__/lutim.conf` to configure Lutim.
Then reload the lutim service.

2
doc/ADMIN_fr.md Normal file
View file

@ -0,0 +1,2 @@
Éditez le fichier `__INSTALL_DIR__/lutim.conf` pour configurer Lutim.
Rechargez ensuite le service Lutim.

View file

@ -1,4 +0,0 @@
## Configuration
Edit the file `/var/www/lutim/lutim.conf` to configure Lutim.
Then reload the lutim service.

View file

@ -1,4 +0,0 @@
## Configuration
Éditez le fichier `/var/www/lutim/lutim.conf` pour configurer Lutim.
Rechargez ensuite le service Lutim.

View file

@ -1,66 +0,0 @@
{
"name": "Lutim",
"id": "lutim",
"packaging_format": 1,
"description": {
"en": "Anonymous image hosting service",
"fr": "Service d'hébergement anonyme d'images"
},
"version": "0.12.1~ynh4",
"url": "https://lut.im",
"upstream": {
"license": "AGPL-3.0-only",
"website": "https://lut.im",
"demo": "https://lut.im/",
"userdoc": "https://framagit.org/luc/lutim/wikis/home",
"code": "https://framagit.org/fiat-tux/hat-softwares/lutim"
},
"license": "AGPL-3.0-only",
"maintainer": {
"name": "",
"email": ""
},
"previous_maintainers": [{
"name": "Maniack Crudelis et matlink",
"email": "maniackc_dev@crudelis.fr"
}],
"requirements": {
"yunohost": ">= 4.3.0"
},
"multi_instance": false,
"services": [
"nginx"
],
"arguments": {
"install": [
{
"name": "domain",
"type": "domain"
},
{
"name": "path",
"type": "path",
"example": "/lutim",
"default": "/lutim"
},
{
"name": "is_public",
"type": "boolean",
"default": false,
"help": {
"en": "If you set Lutim as public, everyone will be able to upload images and share them.<br>But even if not public, everyone can see an image from a link shared with your Lutim.",
"fr": "Si vous définissez Lutim comme public, tout le monde pourra télécharger des images et les partager.<br>Mais même si ce n'est pas public, tout le monde peut voir une image à partir d'un lien partagé avec votre Lutim."
}
},
{
"name": "always_encrypt",
"type": "boolean",
"ask": {
"en": "Force the encryption of images?",
"fr": "Forcer le chiffrement des images ?"
},
"default": true
}
]
}
}

View file

@ -15,26 +15,22 @@ website = "https://lut.im"
demo = "https://lut.im/"
userdoc = "https://framagit.org/luc/lutim/wikis/home"
code = "https://framagit.org/fiat-tux/hat-softwares/lutim"
cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number)
fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin.
[integration]
yunohost = ">= 4.3.0"
architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"]
yunohost = ">= 1.1.17"
architectures = "all"
multi_instance = false
ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials.
sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal.
disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ...
ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
ldap = false
sso = false
disk = "50M"
ram.build = "50M"
ram.runtime = "50M"
[install]
[install.domain]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "domain"
[install.path]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "path"
default = "/lutim"
@ -55,6 +51,7 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen
url = "https://framagit.org/fiat-tux/hat-softwares/lutim/-/archive/0.12.1/lutim-0.12.1.tar.gz"
sha256 = "141f142d47e3a8367e0c292304ddbecfc34b49ae7e561e2c3526000040318973"
[resources.ports]
[resources.system_user]
@ -62,3 +59,6 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen
[resources.permissions]
main.url = "/"
[resources.apt]
packages = "carton perlmagick libpq-dev shared-mime-info"

View file

@ -4,9 +4,6 @@
# COMMON VARIABLES
#=================================================
# dependencies used by the app
#REMOVEME? pkg_dependencies="carton perlmagick libpq-dev shared-mime-info"
#=================================================
# PERSONAL HELPERS
#=================================================

View file

@ -10,23 +10,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
#REMOVEME? ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_print_info --message="Loading installation settings..."
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================

View file

@ -9,73 +9,14 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN
#REMOVEME? old_path=$YNH_APP_OLD_PATH
#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN
#REMOVEME? new_path=$YNH_APP_NEW_PATH
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=2
#REMOVEME? # Needed for helper "ynh_add_nginx_config"
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
# Add settings here as needed by your application
#REMOVEME? is_public=$(ynh_app_setting_get --app=$app --key=is_public)
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
#REMOVEME? ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=20
# Backup the current version of the app
#REMOVEME? ynh_backup_before_upgrade
#REMOVEME? ynh_clean_setup () {
#REMOVEME? ynh_clean_check_starting
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# Restore it if the upgrade fails
#REMOVEME? ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#=================================================
# ACTIVATE MAINTENANCE MODE
#=================================================
ynh_script_progression --message="Activating maintenance mode..."
#REMOVEME?
path=$old_path
domain=$old_domain
ynh_maintenance_mode_ON
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
#REMOVEME? change_domain=0
#REMOVEME? if [ "$old_domain" != "$new_domain" ]
then
#REMOVEME? change_domain=1
fi
#REMOVEME? change_path=0
#REMOVEME? if [ "$old_path" != "$new_path" ]
then
#REMOVEME? change_path=1
fi
#=================================================
# STANDARD MODIFICATIONS
#=================================================
@ -92,47 +33,6 @@ ynh_script_progression --message="Updating NGINX web server configuration..." --
ynh_change_url_nginx_config
#REMOVEME? 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
#REMOVEME? ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for NGINX helper
#REMOVEME? domain="$old_domain"
#REMOVEME? path="$new_path"
# Create a dedicated NGINX config
#REMOVEME? 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
#REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path"
#REMOVEME? mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
# Store file checksum for the new config file location
#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
#=================================================
# UPDATE SSOWAT
#=================================================
ynh_script_progression --message="Reconfiguring SSOwat..."
#REMOVEME? if [ $is_public -eq 0 ] # Only user with a yunohost account can upload an image
then
# If the app is private, viewing images stays publicly accessible.
if [ "$new_path" == "/" ]; then
# If the path is /, clear it to prevent any error with the regex.
new_path=""
fi
# Modify the domain to be used in a regex
domain_regex=$(echo "$new_domain" | sed 's@-@.@g')
#REMOVEME? ynh_app_setting_set --app=$app --key=protected_regex --value="$domain_regex$new_path/stats/?$","$domain_regex$new_path/manifest.webapp/?$","$domain_regex$new_path/?$","$domain_regex$new_path/[d-m]/.*$"
fi
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
@ -151,18 +51,10 @@ ynh_script_progression --message="Starting a systemd service..." --weight=3
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="120"
#=================================================
# RELOAD NGINX
#=================================================
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..."
#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# DEACTIVE MAINTENANCE MODE
#=================================================
ynh_script_progression --message="Disabling maintenance mode..."
#REMOVEME?
path=$old_path
domain=$old_domain
ynh_maintenance_mode_OFF

View file

@ -9,92 +9,32 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
#REMOVEME? ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
#REMOVEME? domain=$YNH_APP_ARG_DOMAIN
#REMOVEME? path=$YNH_APP_ARG_PATH
#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC
#REMOVEME? always_encrypt=$YNH_APP_ARG_ALWAYS_ENCRYPT
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
secret=$(ynh_string_random)
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=2
#REMOVEME? install_dir=/var/www/$app
#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder"
# Register (book) web path
#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=2
#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain
#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
ynh_app_setting_set --app=$app --key=always_encrypt --value=$always_encrypt
ynh_app_setting_set --app=$app --key=secret --value="$secret"
ynh_app_setting_set --app=$app --key=overwrite_settings --value=1
ynh_app_setting_set --app=$app --key=overwrite_nginx --value=1
ynh_app_setting_set --app=$app --key=overwrite_systemd --value=1
#REMOVEME? ynh_app_setting_set --app=$app --key=admin_mail_html --value=1
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# FIND AND OPEN A PORT
#=================================================
#REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=3
# Find an available port
#REMOVEME? port=$(ynh_find_port --port=8095)
#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port
#=================================================
# INSTALL DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=60
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=2
# Create a system user
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
ynh_app_setting_set --app=$app --key=admin_mail_html --value=1
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..."
#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:$app "$install_dir"
@ -199,56 +139,6 @@ chown -R $app:$app $install_dir
# Wait for lutim to be fully started
ynh_systemd_action --action=restart --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="120"
#=================================================
# SETUP SSOWAT
#=================================================
#REMOVEME? ynh_script_progression --message="Configuring permissions..."
#REMOVEME? ynh_permission_update --permission="main" --add="visitors"
# This is a fake permission without any URL.
# The purpose of this permission is only to trigger hooks post_app_add/removeaccess when it's modified.
# We can't use a real permission for now because the actual permision system doesn't support regex.
#REMOVEME? ynh_permission_create --permission="upload images" --allowed="visitors"
#REMOVEME? if [ $is_public -eq 0 ]
then
# If the app is private, viewing images stays publicly accessible.
if [ "$path" == "/" ]; then
# If the path is /, clear it to prevent any error with the regex.
path=""
fi
# Modify the domain to be used in a regex
domain_regex=$(echo "$domain" | sed 's@-@.@g')
#REMOVEME? ynh_app_setting_set --app=$app --key=protected_regex --value="$domain_regex$path/stats/?$","$domain_regex$path/manifest.webapp/?$","$domain_regex$path/?$","$domain_regex$path/[d-m]/.*$"
# If the app is not public, then the "visitors" group doesn't have this permission
#REMOVEME? ynh_permission_update --permission="upload images" --remove="visitors"
fi
#=================================================
# RELOAD NGINX
#=================================================
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=2
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# SEND A README FOR THE ADMIN
#=================================================
# Get main domain and buid the URL of the admin panel of the app.
admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
echo "You can find a config file at $install_dir/lutim.conf
You can configure this app easily by using the experimental __URL_TAG1__config-panel feature__URL_TAG2__$admin_panel/config-panel__URL_TAG3__.
You can also find some specific actions for this app by using the experimental __URL_TAG1__action feature__URL_TAG2__$admin_panel/actions__URL_TAG3__.
If you're facing an issue or want to improve this app, please open a new issue in this __URL_TAG1__project__URL_TAG2__https://github.com/YunoHost-Apps/lutim_ynh__URL_TAG3__." > mail_to_send
ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type=install
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -9,16 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=2
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#=================================================
# STANDARD REMOVE
#=================================================
@ -48,14 +38,6 @@ ynh_script_progression --message="Removing logrotate configuration..."
# Remove the app-specific logrotate config
ynh_remove_logrotate
#=================================================
# REMOVE APP MAIN DIR
#=================================================
#REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=2
# Remove the app directory securely
#REMOVEME? ynh_secure_remove --file="$install_dir"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
@ -64,14 +46,6 @@ ynh_script_progression --message="Removing NGINX web server configuration..."
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=20
# Remove metapackage and its dependencies
#REMOVEME? ynh_remove_app_dependencies
#=================================================
# SPECIFIC REMOVE
#=================================================
@ -82,16 +56,6 @@ ynh_script_progression --message="Removing various files..."
# Remove a cron file
ynh_secure_remove --file="/etc/cron.d/$app"
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=5
# Delete a system user
#REMOVEME? ynh_system_user_delete --username=$app
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -10,52 +10,12 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
#REMOVEME? ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=2
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
#REMOVEME? ynh_script_progression --message="Validating restoration parameters..."
#REMOVEME? test ! -d $install_dir \
|| ynh_die --message="There is already a directory: $install_dir "
#=================================================
# ACTIVATE MAINTENANCE MODE
#=================================================
ynh_script_progression --message="Activating maintenance mode..." --weight=2
ynh_maintenance_mode_ON
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=2
# Create the dedicated user (if not existing)
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
@ -63,20 +23,9 @@ ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file --origin_path="$install_dir"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:$app "$install_dir"
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=60
# Define and install dependencies
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
@ -137,26 +86,9 @@ ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# DEACTIVE MAINTENANCE MODE
#=================================================
ynh_script_progression --message="Disabling maintenance mode..." --weight=7
ynh_maintenance_mode_OFF
#=================================================
# SEND A README FOR THE ADMIN
#=================================================
# Get main domain and buid the url of the admin panel of the app.
admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
echo "You can find a config file at $install_dir/lutim.conf
You can configure this app easily by using the experimental __URL_TAG1__config-panel feature__URL_TAG2__$admin_panel/config-panel__URL_TAG3__.
You can also find some specific actions for this app by using the experimental __URL_TAG1__action feature__URL_TAG2__$admin_panel/actions__URL_TAG3__.
If you're facing an issue or want to improve this app, please open a new issue in this __URL_TAG1__project__URL_TAG2__https://github.com/YunoHost-Apps/lutim_ynh__URL_TAG3__." > mail_to_send
ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type=restore
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -9,52 +9,12 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=4
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
#REMOVEME? is_public=$(ynh_app_setting_get --app=$app --key=is_public)
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
#REMOVEME? always_encrypt=$(ynh_app_setting_get --app=$app --key=always_encrypt)
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#REMOVEME? secret=$(ynh_app_setting_get --app=$app --key=secret)
#REMOVEME? overwrite_settings=$(ynh_app_setting_get --app=$app --key=overwrite_settings)
#REMOVEME? overwrite_nginx=$(ynh_app_setting_get --app=$app --key=overwrite_nginx)
#REMOVEME? overwrite_systemd=$(ynh_app_setting_get --app=$app --key=overwrite_systemd)
#REMOVEME? admin_mail_html=$(ynh_app_setting_get --app=$app --key=admin_mail_html)
# Optional parameters from config-panel feature
#REMOVEME? antiflood=$(ynh_app_setting_get --app=$app --key=antiflood)
#REMOVEME? delay=$(ynh_app_setting_get --app=$app --key=delay)
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=15
# Backup the current version of the app
#REMOVEME? ynh_backup_before_upgrade
#REMOVEME? ynh_clean_setup () {
ynh_clean_check_starting
# Restore it if the upgrade fails
#REMOVEME? ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#=================================================
# ACTIVATE MAINTENANCE MODE
#=================================================
@ -83,36 +43,6 @@ if [ ! -z "$skipped_uris" ]; then
ynh_app_setting_delete --app=$app --key=skipped_uris
fi
# Create the permission "upload images" only if it doesn't exist.
#REMOVEME? if ! ynh_permission_exists --permission="upload images"
then
# This is a fake permission without any URL.
# The purpose of this permission is only to trigger hooks post_app_add/removeaccess when it's modified.
# We can't use a real permission for now because the actual permision system doesn't support regex.
#REMOVEME? ynh_permission_create --permission="upload images" --allowed="visitors"
#REMOVEME? if [ $is_public -eq 0 ]
then
# If the app is private, viewing images stays publicly accessible.
if [ "$path" == "/" ]; then
# If the path is /, clear it to prevent any error with the regex.
path=""
fi
# Modify the domain to be used in a regex
domain_regex=$(echo "$domain" | sed 's@-@.@g')
#REMOVEME? ynh_app_setting_set --app=$app --key=protected_regex --value="$domain_regex$path/stats/?$","$domain_regex$path/manifest.webapp/?$","$domain_regex$path/?$","$domain_regex$path/[d-m]/.*$"
# If the app is not public, then the "visitors" group doesn't have this permission
#REMOVEME? ynh_permission_update --permission="upload images" --remove="visitors"
fi
fi
# if install_dir isn't set, which can happens with old scripts, set install_dir.
if [ -z "$install_dir" ]; then
#REMOVEME? install_dir=/var/www/$app
#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
fi
# Fix always_encrypt as a boolean
if [ "$always_encrypt" = "Yes" ]; then
ynh_app_setting_set --app=$app --key=always_encrypt --value=1
@ -146,24 +76,6 @@ if [ -z "$secret" ]; then
ynh_app_setting_set --app=$app --key=secret --value=$secret
fi
# Close opened port
if yunohost firewall list | grep -q "\- $port$"
then
ynh_exec_quiet yunohost firewall disallow TCP $port
fi
# Replace skipped_uris by unprotected_uris for the migration to the new permission system.
ynh_app_setting_delete --app=$app --key=skipped_uris
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
#=================================================
# CREATE DEDICATED USER
#=================================================
#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -176,17 +88,9 @@ then
ynh_setup_source --dest_dir="$install_dir"
fi
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=9
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#=================================================
# NGINX CONFIGURATION
#=================================================
@ -289,44 +193,12 @@ ynh_script_progression --message="Starting a systemd service..." --weight=4
ynh_systemd_action --service_name=$app --action="start" --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="120"
#=================================================
# RELOAD NGINX
#=================================================
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..."
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# DEACTIVE MAINTENANCE MODE
#=================================================
ynh_script_progression --message="Disabling maintenance mode..." --weight=7
ynh_maintenance_mode_OFF
#=================================================
# SEND A README FOR THE ADMIN
#=================================================
# Get main domain and buid the url of the admin panel of the app.
admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
# Build the changelog
ynh_app_changelog || true
echo "You can find a config file at $install_dir/lutim.conf
You can configure this app easily by using the experimental __URL_TAG1__config-panel feature__URL_TAG2__$admin_panel/config-panel__URL_TAG3__.
You can also find some specific actions for this app by using the experimental __URL_TAG1__action feature__URL_TAG2__$admin_panel/actions__URL_TAG3__.
If you're facing an issue or want to improve this app, please open a new issue in this __URL_TAG1__project__URL_TAG2__https://github.com/YunoHost-Apps/lutim_ynh__URL_TAG3__.
---
Changelog since your last upgrade:
$(cat changelog)" > mail_to_send
ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type=upgrade
#=================================================
# END OF SCRIPT
#=================================================

7
tests.toml Normal file
View file

@ -0,0 +1,7 @@
test_format = 1.0
[default]
# ------------
# Tests to run
# ------------