mirror of
https://github.com/YunoHost-Apps/lstu_ynh.git
synced 2024-09-03 19:36:12 +02:00
Merge pull request #70 from YunoHost-Apps/testing
Upgrade to 0.26.0~ynh1
This commit is contained in:
commit
cecbb81af1
16 changed files with 258 additions and 237 deletions
21
README.md
21
README.md
|
@ -5,7 +5,7 @@ It shall NOT be edited by hand.
|
|||
|
||||
# Lstu for YunoHost
|
||||
|
||||
[![Integration level](https://dash.yunohost.org/integration/lstu.svg)](https://dash.yunohost.org/appci/app/lstu) ![](https://ci-apps.yunohost.org/ci/badges/lstu.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/lstu.maintain.svg)
|
||||
[![Integration level](https://dash.yunohost.org/integration/lstu.svg)](https://dash.yunohost.org/appci/app/lstu) ![Working status](https://ci-apps.yunohost.org/ci/badges/lstu.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/lstu.maintain.svg)
|
||||
[![Install Lstu with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=lstu)
|
||||
|
||||
*[Lire ce readme en français.](./README_fr.md)*
|
||||
|
@ -17,13 +17,13 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
|
|||
|
||||
URL Shortener
|
||||
|
||||
**Shipped version:** 0.25.0~ynh1
|
||||
**Shipped version:** 0.26.0~ynh1
|
||||
|
||||
**Demo:** https://lstu.fr
|
||||
|
||||
## Screenshots
|
||||
|
||||
![](./doc/screenshots/LSTU_screenshot.png)
|
||||
![Screenshot of Lstu](./doc/screenshots/LSTU_screenshot.png)
|
||||
|
||||
## Disclaimers / important information
|
||||
|
||||
|
@ -33,21 +33,22 @@ How to configure this app: a plain file at `/var/www/lstu/lstu.conf` with SSH.
|
|||
|
||||
## Documentation and resources
|
||||
|
||||
* Official app website: https://lstu.fr
|
||||
* Official admin documentation: https://framagit.org/fiat-tux/hat-softwares/lstu/wikis/home
|
||||
* Upstream app code repository: https://framagit.org/fiat-tux/hat-softwares/lstu
|
||||
* YunoHost documentation for this app: https://yunohost.org/app_lstu
|
||||
* Report a bug: https://github.com/YunoHost-Apps/lstu_ynh/issues
|
||||
* Official app website: <https://lstu.fr>
|
||||
* Official admin documentation: <https://framagit.org/fiat-tux/hat-softwares/lstu/wikis/home>
|
||||
* Upstream app code repository: <https://framagit.org/fiat-tux/hat-softwares/lstu>
|
||||
* YunoHost documentation for this app: <https://yunohost.org/app_lstu>
|
||||
* Report a bug: <https://github.com/YunoHost-Apps/lstu_ynh/issues>
|
||||
|
||||
## Developer info
|
||||
|
||||
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/lstu_ynh/tree/testing).
|
||||
|
||||
To try the testing branch, please proceed like that.
|
||||
```
|
||||
|
||||
``` bash
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/lstu_ynh/tree/testing --debug
|
||||
or
|
||||
sudo yunohost app upgrade lstu -u https://github.com/YunoHost-Apps/lstu_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**More info regarding app packaging:** https://yunohost.org/packaging_apps
|
||||
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>
|
||||
|
|
27
README_fr.md
27
README_fr.md
|
@ -1,10 +1,14 @@
|
|||
<!--
|
||||
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
|
||||
It shall NOT be edited by hand.
|
||||
-->
|
||||
|
||||
# Lstu pour YunoHost
|
||||
|
||||
[![Niveau d'intégration](https://dash.yunohost.org/integration/lstu.svg)](https://dash.yunohost.org/appci/app/lstu) ![](https://ci-apps.yunohost.org/ci/badges/lstu.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/lstu.maintain.svg)
|
||||
[![Niveau d'intégration](https://dash.yunohost.org/integration/lstu.svg)](https://dash.yunohost.org/appci/app/lstu) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/lstu.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/lstu.maintain.svg)
|
||||
[![Installer Lstu avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=lstu)
|
||||
|
||||
*[Read this readme in english.](./README.md)*
|
||||
*[Lire ce readme en français.](./README_fr.md)*
|
||||
|
||||
> *Ce package vous permet d'installer Lstu 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.*
|
||||
|
@ -13,13 +17,13 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
|
|||
|
||||
Raccourcisseur d'URL
|
||||
|
||||
**Version incluse :** 0.25.0~ynh1
|
||||
**Version incluse :** 0.26.0~ynh1
|
||||
|
||||
**Démo :** https://lstu.fr
|
||||
|
||||
## Captures d'écran
|
||||
|
||||
![](./doc/screenshots/LSTU_screenshot.png)
|
||||
![Capture d'écran de Lstu](./doc/screenshots/LSTU_screenshot.png)
|
||||
|
||||
## Avertissements / informations importantes
|
||||
|
||||
|
@ -29,21 +33,22 @@ Comment configurer cette application : un fichier simple à `/var/www/lstu/lstu.
|
|||
|
||||
## Documentations et ressources
|
||||
|
||||
* Site officiel de l'app : https://lstu.fr
|
||||
* Documentation officielle de l'admin : https://framagit.org/fiat-tux/hat-softwares/lstu/wikis/home
|
||||
* Dépôt de code officiel de l'app : https://framagit.org/fiat-tux/hat-softwares/lstu
|
||||
* Documentation YunoHost pour cette app : https://yunohost.org/app_lstu
|
||||
* Signaler un bug : https://github.com/YunoHost-Apps/lstu_ynh/issues
|
||||
* Site officiel de l'app : <https://lstu.fr>
|
||||
* Documentation officielle de l'admin : <https://framagit.org/fiat-tux/hat-softwares/lstu/wikis/home>
|
||||
* Dépôt de code officiel de l'app : <https://framagit.org/fiat-tux/hat-softwares/lstu>
|
||||
* Documentation YunoHost pour cette app : <https://yunohost.org/app_lstu>
|
||||
* Signaler un bug : <https://github.com/YunoHost-Apps/lstu_ynh/issues>
|
||||
|
||||
## Informations pour les développeurs
|
||||
|
||||
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/lstu_ynh/tree/testing).
|
||||
|
||||
Pour essayer la branche testing, procédez comme suit.
|
||||
```
|
||||
|
||||
``` bash
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/lstu_ynh/tree/testing --debug
|
||||
ou
|
||||
sudo yunohost app upgrade lstu -u https://github.com/YunoHost-Apps/lstu_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps
|
||||
**Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
;; Nom du test
|
||||
auto_remove=1
|
||||
;; Test complet
|
||||
; Manifest
|
||||
domain="domain.tld"
|
||||
path="/path"
|
||||
is_public=1
|
||||
theme="milligram"
|
||||
password="verysecretpassword"
|
||||
password="1Strong-Password"
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=1
|
||||
|
@ -18,7 +17,11 @@
|
|||
upgrade=1 from_commit=469fb267ebc496d2c63b10de35aaf3493ce8124f
|
||||
backup_restore=1
|
||||
multi_instance=1
|
||||
port_already_use=0
|
||||
change_url=1
|
||||
;;; Options
|
||||
Email=
|
||||
Notification=none
|
||||
;;; Upgrade options
|
||||
; commit=469fb267ebc496d2c63b10de35aaf3493ce8124f
|
||||
name=Merge pull request #52
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
SOURCE_URL=https://framagit.org/fiat-tux/hat-softwares/lstu/-/archive/0.25-0/lstu-0.25-0.tar.gz
|
||||
SOURCE_SUM=eae4bc13ef761996a13c8133647dce14e040a67173b099b630ef35dba3b19209
|
||||
SOURCE_URL=https://framagit.org/fiat-tux/hat-softwares/lstu/-/archive/0.26-0/lstu-0.26-0.tar.gz
|
||||
SOURCE_SUM=323c81b4cb04a97eda7cb37b2a63d16e808591fd46eb4326f6619200ce742960
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=
|
||||
SOURCE_EXTRACT=true
|
||||
|
|
|
@ -31,6 +31,11 @@
|
|||
# optional, but you won't have access to admin /stats if not set and if adminpwd is not set either
|
||||
hashed_adminpwd => '__HASHED_PASSWORD__',
|
||||
|
||||
# indicates if you want to really delete URLs from admin page (/stats)
|
||||
# or just want to deactivate the shorten URL (won’t redirect anymore, can’t be used anymore)
|
||||
# optional, default to 0 (false)
|
||||
#really_delete_urls => 0,
|
||||
|
||||
# choose a theme. See the available themes in `themes` directory
|
||||
# optional, default is 'default'
|
||||
theme => '__THEME__', # default or milligram
|
||||
|
@ -66,6 +71,10 @@
|
|||
# optional
|
||||
#fixed_domain => 'example.org',
|
||||
|
||||
# if set to 1, Lstu will try to prevent its use without using the web interface
|
||||
# optional, default is 0
|
||||
#disable_api => 0,
|
||||
|
||||
# choose what database you want to use
|
||||
# valid choices are sqlite, postgresql and mysql (all lowercase)
|
||||
# optional, default is sqlite
|
||||
|
@ -264,5 +273,9 @@
|
|||
# Set to 1 if you want to register the IP addresses of URL creators
|
||||
# optional, default is 0
|
||||
#log_creator_ip => 0,
|
||||
};
|
||||
|
||||
# Positive integer which specifies how many pixels one "module" (one block of the QR code) occupies.
|
||||
# You can't use fractional values. An arbitrary upper limit of 100 is imposed by Image::PNG::QRCode module.
|
||||
# optional, default is 3
|
||||
#qrcode_size => 3,
|
||||
};
|
||||
|
|
|
@ -273,5 +273,9 @@
|
|||
# Set to 1 if you want to register the IP addresses of URL creators
|
||||
# optional, default is 0
|
||||
#log_creator_ip => 0,
|
||||
};
|
||||
|
||||
# Positive integer which specifies how many pixels one "module" (one block of the QR code) occupies.
|
||||
# You can't use fractional values. An arbitrary upper limit of 100 is imposed by Image::PNG::QRCode module.
|
||||
# optional, default is 3
|
||||
#qrcode_size => 3,
|
||||
};
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"en": "URL Shortener",
|
||||
"fr": "Raccourcisseur d'URL"
|
||||
},
|
||||
"version": "0.25.0~ynh1",
|
||||
"version": "0.26.0~ynh1",
|
||||
"url": "https://lstu.fr",
|
||||
"upstream": {
|
||||
"license": "WTFPL",
|
||||
|
|
|
@ -149,3 +149,7 @@ __PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/service
|
|||
# Send the email to the recipients
|
||||
cat mail_to_send | $mail_bin -a "Content-Type: $content_type; charset=UTF-8" -s "$mail_subject" "$recipients"
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# FUTURE OFFICIAL HELPERS
|
||||
#=================================================
|
||||
|
|
|
@ -34,7 +34,6 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
|||
#=================================================
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
#=================================================
|
||||
|
||||
ynh_print_info --message="Declaring files to be backed up..."
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -40,17 +40,18 @@ theme=$(ynh_app_setting_get --app=$app --key=theme)
|
|||
hashed_password=$(ynh_app_setting_get --app=$app --key=hashed_password)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
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.
|
||||
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
|
||||
# restore it if the upgrade fails
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
|
@ -88,19 +89,19 @@ ynh_script_progression --message="Updating NGINX web server configuration..."
|
|||
|
||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||
|
||||
# Change the path in the nginx config file
|
||||
# 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
|
||||
# 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
|
||||
# Set global variables for NGINX helper
|
||||
domain="$old_domain"
|
||||
path_url="$new_path"
|
||||
# Create a dedicated nginx config
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
fi
|
||||
|
||||
# Change the domain for nginx
|
||||
# Change the domain for NGINX
|
||||
if [ $change_domain -eq 1 ]
|
||||
then
|
||||
# Delete file checksum for the old conf file location
|
||||
|
@ -113,32 +114,19 @@ fi
|
|||
#=================================================
|
||||
# SPECIFIC MODIFICATIONS
|
||||
#=================================================
|
||||
# CONFIGURE LSTU
|
||||
# UPDATE A CONFIG FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring lstu..."
|
||||
ynh_script_progression --message="Updating a configuration file..."
|
||||
|
||||
domain="$new_domain"
|
||||
path_url="$new_path"
|
||||
|
||||
config="${final_path}/lstu.conf"
|
||||
ynh_backup_if_checksum_is_different --file="$config"
|
||||
cp ../conf/lstu.conf.template "$config"
|
||||
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config"
|
||||
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$config"
|
||||
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config"
|
||||
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$config"
|
||||
ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$config"
|
||||
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config"
|
||||
ynh_replace_string --match_string="__SELECTED_THEME__" --replace_string="$theme" --target_file="$config"
|
||||
ynh_replace_string --match_string="__PASSWORD_HASHED__" --replace_string="$hashed_password" --target_file="$config"
|
||||
ynh_replace_string --match_string="__SECRET__" --replace_string="$secret" --target_file="$config"
|
||||
if [ $is_public -eq 0 ];
|
||||
then
|
||||
ynh_replace_string --match_string="__IS_PUBLIC__" --replace_string="" --target_file="$config"
|
||||
ynh_add_config --template="../conf/lstu.conf.ldap" --destination="$final_path/lstu.conf"
|
||||
else
|
||||
ynh_replace_string --match_string="__IS_PUBLIC__" --replace_string="#" --target_file="$config"
|
||||
ynh_add_config --template="../conf/lstu.conf.template" --destination="$final_path/lstu.conf"
|
||||
fi
|
||||
ynh_store_file_checksum --file="$config"
|
||||
|
||||
#=================================================
|
||||
# UPDATE SSOWAT
|
||||
|
|
|
@ -28,11 +28,12 @@ path_url=$YNH_APP_ARG_PATH
|
|||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
theme=$YNH_APP_ARG_THEME
|
||||
password=$YNH_APP_ARG_PASSWORD
|
||||
secret=$(ynh_string_random --length=24)
|
||||
hashed_password=$(echo -n $password | sha256sum | cut -d' ' -f1)
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
secret=$(ynh_string_random --length=24)
|
||||
hashed_password=$(echo -n $password | sha256sum | cut -d' ' -f1)
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
#=================================================
|
||||
|
@ -74,6 +75,14 @@ ynh_script_progression --message="Installing dependencies..."
|
|||
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..."
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# CREATE A POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
|
@ -86,14 +95,6 @@ db_user=$db_name
|
|||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..."
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
@ -118,9 +119,9 @@ ynh_add_nginx_config
|
|||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
# CONFIGURE LSTU
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring Lstu..."
|
||||
ynh_script_progression --message="Adding a configuration file..."
|
||||
|
||||
if [ $is_public -eq 0 ];
|
||||
then
|
||||
|
@ -174,6 +175,8 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --l
|
|||
#=================================================
|
||||
ynh_script_progression --message="Configuring permissions..."
|
||||
|
||||
# Everyone can access the app.
|
||||
# The "main" permission is automatically created before the install script.
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
|
||||
if [ $is_public -eq 0 ]
|
||||
|
|
|
@ -28,10 +28,10 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|||
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
||||
#=================================================
|
||||
|
||||
# Remove the service from the list of services known by Yunohost (added from `yunohost service add`)
|
||||
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
||||
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
||||
then
|
||||
ynh_script_progression --message="Removing $app service..."
|
||||
ynh_script_progression --message="Removing $app service integration..."
|
||||
yunohost service remove $app
|
||||
fi
|
||||
|
||||
|
@ -43,21 +43,21 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
|
|||
# Remove the dedicated systemd config
|
||||
ynh_remove_systemd_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing logrotate configuration..."
|
||||
|
||||
# Remove the app-specific logrotate config
|
||||
ynh_remove_logrotate
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the PostgreSQL database..."
|
||||
|
||||
# Remove a database if it exists, along with the associated user
|
||||
ynh_psql_remove_db --db_user="$db_user" --db_name="$db_name"
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..."
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
|
@ -72,23 +72,23 @@ ynh_secure_remove --file="$final_path"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Removing NGINX web server configuration..."
|
||||
|
||||
# Remove the dedicated nginx config
|
||||
# Remove the dedicated NGINX config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE LOGROTATE CONFIGURATION
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing logrotate configuration..."
|
||||
ynh_script_progression --message="Removing dependencies..."
|
||||
|
||||
# Remove the app-specific logrotate config
|
||||
ynh_remove_logrotate
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC REMOVE
|
||||
#=================================================
|
||||
# REMOVE LOG FILES
|
||||
# REMOVE VARIOUS FILES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing log files..."
|
||||
ynh_script_progression --message="Removing various files..."
|
||||
|
||||
# Remove the log files
|
||||
ynh_secure_remove --file="/var/log/$app.log"
|
||||
|
|
|
@ -23,7 +23,7 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading settings..."
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -44,13 +44,6 @@ test ! -d $final_path \
|
|||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the NGINX configuration..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
|
@ -80,6 +73,13 @@ ynh_script_progression --message="Reinstalling dependencies..."
|
|||
# Define and install dependencies
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the NGINX web server configuration..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
|
@ -87,7 +87,7 @@ ynh_script_progression --message="Restoring the PostregSQL database..."
|
|||
|
||||
ynh_psql_test_if_first_run
|
||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name"
|
||||
ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEMD
|
||||
|
@ -97,6 +97,13 @@ ynh_script_progression --message="Restoring the systemd configuration..."
|
|||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||
systemctl enable $app.service --quiet
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the logrotate configuration..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
|
@ -111,13 +118,6 @@ ynh_script_progression --message="Starting a systemd service..."
|
|||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Server available at"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the logrotate configuration..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
|
113
scripts/upgrade
113
scripts/upgrade
|
@ -35,6 +35,30 @@ ynh_script_progression --message="Checking version..."
|
|||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
|
@ -88,37 +112,6 @@ then
|
|||
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
||||
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
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
# restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
|
@ -143,14 +136,6 @@ 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..."
|
||||
|
||||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
|
@ -159,9 +144,19 @@ ynh_script_progression --message="Upgrading dependencies..."
|
|||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# CONFIGURE LSTU
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring Lstu..."
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
# UPDATE A CONFIG FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating a configuration file..."
|
||||
|
||||
if [ $is_public -eq 0 ];
|
||||
then
|
||||
|
@ -179,14 +174,6 @@ pushd $final_path
|
|||
carton install --deployment --without=sqlite --without=mysql
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading logrotate configuration..."
|
||||
|
||||
# Use logrotate to manage app-specific logfile(s)
|
||||
ynh_use_logrotate --non-append
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
|
@ -195,6 +182,16 @@ ynh_script_progression --message="Upgrading systemd configuration..."
|
|||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading logrotate configuration..."
|
||||
|
||||
# Use logrotate to manage app-specific logfile(s)
|
||||
ynh_use_logrotate --non-append
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
|
@ -202,11 +199,20 @@ ynh_script_progression --message="Integrating service in YunoHost..."
|
|||
|
||||
yunohost service add $app --log="/var/log/$app.log" --log="/var/www/$app/log/production.log"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action=reload --line_match="Reloaded Shortened URLs service." --log_path="systemd"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading SSOwat configuration..."
|
||||
ynh_script_progression --message="Configuring permissions..."
|
||||
|
||||
# Everyone can access the app.
|
||||
# The "main" permission is automatically created before the install script.
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
|
||||
if [ $is_public -eq 0 ]
|
||||
|
@ -221,13 +227,6 @@ then
|
|||
ynh_app_setting_set --app=$app --key=protected_regex --value="$domain_regex$path_url/login$","$domain_regex$path_url/logout$","$domain_regex$path_url/api$","$domain_regex$path_url/extensions$","$domain_regex$path_url/stats$","$domain_regex$path_url/d/.*$","$domain_regex$path_url/a$","$domain_regex$path_url/$"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action=reload --line_match="Reloaded Shortened URLs service." --log_path="systemd"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue