1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mineweb_ynh.git synced 2024-09-03 19:45:54 +02:00
This commit is contained in:
ericgaspar 2020-11-05 17:12:07 +01:00
parent dfbb5f4c61
commit 707662108d
No known key found for this signature in database
GPG key ID: 574F281483054D44
5 changed files with 110 additions and 120 deletions

View file

@ -9,17 +9,13 @@
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview ## Overview
Quick description of this app. MineWeb est un CMS (c'est-à-dire un système de gestion de contenu), en plus simple, un site complètement personnalisable et intuitif, qui s'adaptera parfaitement à vos serveurs Minecraft !
**Shipped version:** 1.0 **Shipped version:** 1.10.3
## Screenshots ## Screenshots
![](Link to a screenshot of this app.) ![](https://mineweb.org/assets/img/features3_mb.png)
## Demo
* [Official demo](Link to a demo site for this app.)
## Configuration ## Configuration
@ -27,7 +23,7 @@ How to configure this app: From an admin panel, a plain file with SSH, or any ot
## Documentation ## Documentation
* Official documentation: Link to the official documentation of this app * Official documentation: https://docs.mineweb.org/
* YunoHost documentation: If specific documentation is needed, feel free to contribute. * YunoHost documentation: If specific documentation is needed, feel free to contribute.
## YunoHost specific features ## YunoHost specific features

View file

@ -3,12 +3,12 @@
"id": "mineweb", "id": "mineweb",
"packaging_format": 1, "packaging_format": 1,
"description": { "description": {
"en": "", "en": "Customizable and intuitive CMS.",
"fr": "" "fr": "CMS personnalisable et intuitif."
}, },
"version": "1.10.3~ynh1", "version": "1.10.3~ynh1",
"url": "https://mineweb.org/", "url": "https://mineweb.org/",
"license": "free", "license": "GPL-3.0 License",
"maintainer": { "maintainer": {
"name": "liberodark", "name": "liberodark",
"email": "liberodark@gmail.com" "email": "liberodark@gmail.com"

View file

@ -32,7 +32,7 @@ app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#================================================= #=================================================
ynh_script_progression --message="Validating installation parameters..." --time --weight=1 ynh_script_progression --message="Validating installation parameters..." --weight=1
final_path=/var/www/$app final_path=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder" test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
@ -43,28 +43,12 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#================================================= #=================================================
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
ynh_script_progression --message="Storing installation settings..." --time --weight=1 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=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=is_public --value=$is_public ynh_app_setting_set --app=$app --key=is_public --value=$is_public
#==============================================
# INSTALL DEPS
#==============================================
ynh_package_install php7.0-zip
#=================================================
# FIND AND OPEN A PORT
#=================================================
# Find a free port
port=$(ynh_find_port 8096)
# Open this port
yunohost firewall allow --no-upnp TCP $port 2>&1
ynh_app_setting_set $app port $port
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
#================================================= #=================================================
@ -133,26 +117,29 @@ ynh_store_file_checksum "$final_path/app/Config/database.php"
#================================================= #=================================================
# SECURE FILES AND DIRECTORIES # SECURE FILES AND DIRECTORIES
#================================================= #=================================================
ynh_script_progression --message="Securing files and directories..." --weight=1
# Set permissions to app files # Set permissions to app files
chown -R www-data:www-data $final_path chown -R $app: $final_path
chmod -R 775 $final_path chmod -R 775 $final_path
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
ynh_script_progression --message="Configuring SSOwat..." --weight=1
# If app is public, add url to SSOWat conf as skipped_uris # Make app public if necessary or protect it
if [ $is_public -eq 1 ]; then if [ $is_public -eq 1 ]
# unprotected_uris allows SSO credentials to be passed anyway. then
ynh_app_setting_set "$app" unprotected_uris "/" # Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission "main" --add "visitors"
fi fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
@ -160,5 +147,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Installation of $app completed" --time --last ynh_script_progression --message="Installation of $app completed" --last

View file

@ -1,52 +1,101 @@
#!/bin/bash #!/bin/bash
# Note: each files and directories you've saved using the ynh_backup helper #=================================================
# will be located in the current directory, regarding the last argument. # GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Exit on command errors and treat unset variables as an error source ../settings/scripts/_common.sh
set -eu
# See comments in install script
app=$YNH_APP_INSTANCE_NAME
# Source YunoHost helpers
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
# Retrieve old app settings #=================================================
domain=$(ynh_app_setting_get "$app" domain) # MANAGE SCRIPT FAILURE
path_url=$(ynh_app_setting_get "$app" path_url) #=================================================
# Check domain/path availability ynh_abort_if_errors
sudo yunohost app checkurl "${domain}${path_url}" -a "$app" \
|| ynh_die "Path not available: ${domain}${path_url}"
# Restore sources & data #=================================================
src_path="/var/www/${app}" # LOAD SETTINGS
sudo cp -a ./sources "$src_path" #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
# Restore permissions to app files app=$YNH_APP_INSTANCE_NAME
# you may need to make some file and/or directory writeable by www-data (nginx user)
sudo chown -R root: "$src_path"
### MySQL (remove if not used) ### domain=$(ynh_app_setting_get --app=$app --key=domain)
# If a MySQL database is used: path_url=$(ynh_app_setting_get --app=$app --key=path)
# # Create and restore the database final_path=$(ynh_app_setting_get --app=$app --key=final_path)
# dbname=$app db_name=$(ynh_app_setting_get --app=$app --key=db_name)
# dbuser=$app db_user=$db_name
# dbpass=$(ynh_app_setting_get "$app" mysqlpwd) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
# ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass"
# ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < ./dump.sql
### MySQL end ###
# Restore NGINX configuration #=================================================
sudo cp -a ./nginx.conf "/etc/nginx/conf.d/${domain}.d/${app}.conf" # CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1
### PHP (remove if not used) ### ynh_webpath_available --domain=$domain --path_url=$path_url \
# If a dedicated php-fpm process is used: || ynh_die --message="Path not available: ${domain}${path_url}"
# # Copy PHP-FPM pool configuration and reload the service test ! -d $final_path \
# sudo cp -a ./php-fpm.conf "/etc/php5/fpm/pool.d/${app}.conf" || ynh_die --message="There is already a directory: $final_path "
# sudo service php5-fpm reload
### PHP end ###
# Restart webserver #=================================================
sudo service nginx reload # STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=4
ynh_restore_file --origin_path="$final_path"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app
#=================================================
# RESTORE USER RIGHTS
#=================================================
# Restore permissions on app files
chown -R $app: $final_path
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Restoring the MySQL database..." --weight=3
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=2
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app" --last

View file

@ -116,46 +116,13 @@ ynh_add_fpm_config --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependenc
if [ "$upgrade_type" == "UPGRADE_APP" ] if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
ynh_script_progression --message="Reconfiguring ttrss..." --weight=2 ynh_script_progression --message="Reconfiguring..." --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 # Replace the old ttrss by the new one
ynh_secure_remove --file="$final_path" ynh_secure_remove --file="$final_path"
mv "$tmpdir" "$final_path"
ynh_secure_remove --file="$tmpdir"
# 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
fi fi
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Upgrading systemd configuration..." --weight=2
# Create a dedicated systemd config
ynh_add_systemd_config
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================
@ -166,14 +133,6 @@ ynh_add_systemd_config
chown -R root: $final_path chown -R root: $final_path
chmod 0755 $final_path chmod 0755 $final_path
#=================================================
# RESTART TTRSS
#=================================================
ynh_script_progression --message="Restarting ttrss..." --weight=1
ynh_systemd_action --service_name=$app --action=restart
#================================================= #=================================================
# ADVERTISE SERVICE IN ADMIN PANEL # ADVERTISE SERVICE IN ADMIN PANEL
#================================================= #=================================================