1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/bludit_ynh.git synced 2024-09-03 18:06:13 +02:00
This commit is contained in:
ericgaspar 2020-10-14 13:04:23 +02:00
parent 20a78fd30b
commit e0c7f6b15e
No known key found for this signature in database
GPG key ID: 574F281483054D44
9 changed files with 18 additions and 242 deletions

View file

@ -1,11 +1,11 @@
# Bludit pour YunoHost
[![Integration level](https://dash.yunohost.org/integration/ttrss.svg)](https://dash.yunohost.org/appci/app/ttrss) ![](https://ci-apps.yunohost.org/ci/badges/ttrss.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/ttrss.maintain.svg)
[![Installer Tiny Tiny RSS avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=ttrss)
[![Integration level](https://dash.yunohost.org/integration/bludit.svg)](https://dash.yunohost.org/appci/app/bludit) ![](https://ci-apps.yunohost.org/ci/badges/bludit.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/bludit.maintain.svg)
[![Installer bludit avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=bludit)
*[Read this readme in english.](./README.md)*
> *Ce package vous permet dinstaller Tiny Tiny RSS rapidement et simplement sur un serveur YunoHost.
> *Ce package vous permet dinstaller bludit rapidement et simplement sur un serveur YunoHost.
Si vous navez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment linstaller.*
## Vue densemble
@ -27,7 +27,7 @@ Tiny Tiny RSS est un lecteur et agrégateur de flux d'actualités (RSS/Atom) en
## Documentation
* Documentation officielle :
* Documentation YunoHost : https://yunohost.org/#/app_blodit_fr
* Documentation YunoHost : https://yunohost.org/#/app_bludit_fr
## Caractéristiques spécifiques YunoHost
@ -38,8 +38,8 @@ Tiny Tiny RSS est un lecteur et agrégateur de flux d'actualités (RSS/Atom) en
#### Architectures supportées
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/ttrss%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/ttrss/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/ttrss%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/ttrss/)
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/bludit%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/bludit/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/bludit%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/bludit/)
## Limitations

View file

@ -10,7 +10,6 @@
setup_private=0
setup_public=0
upgrade=1
upgrade=1 from_commit=e27175c2dde0ebbd483b212dc76c5b27877e4ed2
backup_restore=1
multi_instance=1
incorrect_path=1
@ -22,6 +21,4 @@
Email=
Notification=none
;;; Upgrade options
; commit=e27175c2dde0ebbd483b212dc76c5b27877e4ed2
name=Merge pull request #79 from ericgaspar/update-to-upstream
manifest_arg=domain=DOMAIN&path=PATH

View file

@ -11,55 +11,3 @@ extra_php_dependencies="php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-json php$
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
# Check available space before creating a temp directory.
#
# usage: ynh_smart_mktemp --min_size="Min size"
#
# | arg: -s, --min_size= - Minimal size needed for the temporary directory, in Mb
ynh_smart_mktemp () {
# Declare an array to define the options of this helper.
declare -Ar args_array=( [s]=min_size= )
local min_size
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
min_size="${min_size:-300}"
# Transform the minimum size from megabytes to kilobytes
min_size=$(( $min_size * 1024 ))
# Check if there's enough free space in a directory
is_there_enough_space () {
local free_space=$(df --output=avail "$1" | sed 1d)
test $free_space -ge $min_size
}
if is_there_enough_space /tmp; then
local tmpdir=/tmp
elif is_there_enough_space /var; then
local tmpdir=/var
elif is_there_enough_space /; then
local tmpdir=/
elif is_there_enough_space /home; then
local tmpdir=/home
else
ynh_die "Insufficient free space to continue..."
fi
echo "$(sudo mktemp --directory --tmpdir="$tmpdir")"
}
#=================================================
# Execute a command as another user
# usage: ynh_exec_as USER COMMAND [ARG ...]
ynh_exec_as() {
local USER=$1
shift 1
if [[ $USER = $(whoami) ]]; then
eval "$@"
else
sudo -u "$USER" "$@"
fi
}

View file

@ -49,19 +49,6 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_backup --src_path="/etc/systemd/system/$app.service"
#=================================================
# BACKUP THE MYSQL DATABASE
#=================================================
ynh_print_info --message="Backing up the MySQL database..."
ynh_mysql_dump_db --database="$db_name" > db.sql
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -77,28 +77,6 @@ then
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
ynh_script_progression --message="Configuring $app..." --weight=1
domain="$new_domain"
path_url="$new_path"
ynh_backup_if_checksum_is_different --file="$final_path/config.php"
cp ../conf/config.php "$final_path/config.php"
# Change domain name in config.php
ynh_replace_string --match_string="__DBNAME__" --replace_string="$db_name" --target_file="$final_path/config.php"
ynh_replace_string --match_string="__DBPWD__" --replace_string="$db_pwd" --target_file="$final_path/config.php"
ynh_replace_string --match_string="__DOMAINPATH__" --replace_string="https://$domain$path_url" --target_file="$final_path/config.php"
# Recalculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="$final_path/config.php"
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX
#=================================================

View file

@ -157,8 +157,6 @@ ynh_script_progression --message="Configuring SSOwat..." --weight=1
# Make app public if necessary or protect it
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
#=================================================

View file

@ -20,35 +20,6 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE SERVICE FROM ADMIN PANEL
#=================================================
# Remove a service from the admin panel, added by `yunohost service add`
if yunohost service status $app >/dev/null 2>&1
then
ynh_script_progression --message="Removing $app service..." --weight=2
yunohost service remove $app
fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=2
# Remove the dedicated systemd config
ynh_remove_systemd_config
#=================================================
# REMOVE THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Removing the MySQL database..." --weight=4
# Remove a database if it exists, along with the associated user
ynh_mysql_remove_db --db_user=$db_name --db_name=$db_name
#=================================================
# REMOVE APP MAIN DIR
#=================================================
@ -78,10 +49,10 @@ ynh_remove_fpm_config
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
# ynh_script_progression --message="Removing the dedicated system user..." --weight=1
# Delete a system user
ynh_system_user_delete --username=$app
# # Delete a system user
# ynh_system_user_delete --username=$app
#=================================================
# END OF SCRIPT

View file

@ -57,10 +57,10 @@ ynh_restore_file --origin_path="$final_path"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=3
# ynh_script_progression --message="Recreating the dedicated system user..." --weight=3
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app
# # Create the dedicated user (if not existing)
# ynh_system_user_create --username=$app
#=================================================
# RESTORE USER RIGHTS
@ -68,7 +68,6 @@ ynh_system_user_create --username=$app
# Set permissions to app files
chown -R root: $final_path
chown -R $app $final_path/{cache,feed-icons,lock}
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
@ -79,24 +78,6 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_add_fpm_config --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies"
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Restoring the MySQL database..." --weight=5
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name --db_pwd=$db_pwd
ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ./db.sql
#=================================================
# RESTORE SYSTEMD
#=================================================
ynh_script_progression --message="Restoring the systemd configuration..." --weight=2
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service
ynh_systemd_action --service_name=$app --action=start
#=================================================
# GENERIC FINALIZATION
#=================================================

View file

@ -40,12 +40,6 @@ if [ -z "$final_path" ]; then
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi
# If db_name doesn't exist, create it
if [ -z "$db_name" ]; then
db_name=$(ynh_sanitize_dbid --db_name=$app)
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
@ -60,38 +54,6 @@ ynh_clean_setup () {
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# ENSURE DOWNWARD COMPATIBILITY BIS
#=================================================
# Do not remove the file before the backup, to not fail the backup.
# Remove old cron job
ynh_secure_remove --file="/etc/cron.d/$app"
#=================================================
# CHECK THE PATH
#=================================================
# Normalize the URL path syntax
path_url=$(ynh_normalize_url_path --path_url=$path_url)
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=7
# Create a temporary directory
tmpdir="$(ynh_smart_mktemp --min_size=10)"
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$tmpdir"
fi
#=================================================
# NGINX CONFIGURATION
#=================================================
@ -103,10 +65,10 @@ ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app
# # Create a dedicated user (if not existing)
# ynh_system_user_create --username=$app
#=================================================
# PHP-FPM CONFIGURATION
@ -126,44 +88,13 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Reconfiguring ttrss..." --weight=2
# Backup the config file in the temp dir
cp -a "$final_path/config.php" "$tmpdir/config.php"
# Replace the old ttrss by the new one
ynh_secure_remove --file="$final_path"
mv "$tmpdir" "$final_path"
ynh_secure_remove --file="$tmpdir"
ynh_secure_remove --file=$final_path
# Verify the checksum and backup the file if it's different
ynh_backup_if_checksum_is_different --file="$final_path/config.php"
cp ../conf/config.php "$final_path/config.php"
# Change variables in ttrss configuration
ynh_replace_string --match_string="__DBNAME__" --replace_string="$db_name" --target_file="$final_path/config.php"
ynh_replace_string --match_string="__DBPWD__" --replace_string="$db_pwd" --target_file="$final_path/config.php"
ynh_replace_string --match_string="__DOMAINPATH__" --replace_string="https://$domain$path_url" --target_file="$final_path/config.php"
# Recalculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="$final_path/config.php"
#=================================================
# UPGRADE DATABASE
#=================================================
ynh_script_progression --message="Upgrading ttrss database..." --weight=2
chown -R $app: $final_path
ynh_exec_as $app php"${phpversion}" ${final_path}/update.php --update-schema
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir=$final_path
fi
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Upgrading systemd configuration..." --weight=2
# Create a dedicated systemd config
ynh_add_systemd_config
#=================================================
# GENERIC FINALIZATION
#=================================================
@ -172,21 +103,6 @@ ynh_add_systemd_config
# Set permissions to app files
chown -R root: $final_path
chmod 0755 $final_path
chown -R $app $final_path/{cache,feed-icons,lock}
#=================================================
# RESTART TTRSS
#=================================================
ynh_script_progression --message="Restarting ttrss..." --weight=1
ynh_systemd_action --service_name=$app --action=restart
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
#=================================================
yunohost service add $app
#=================================================
# GENERIC FINALIZATION