1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/movim_ynh.git synced 2024-09-03 19:46:19 +02:00

cleaning up

This commit is contained in:
ericgaspar 2020-09-22 19:18:47 +02:00
parent 7a8467d409
commit 8d7da107d6
No known key found for this signature in database
GPG key ID: 574F281483054D44
3 changed files with 9 additions and 84 deletions

View file

@ -97,8 +97,8 @@ ynh_script_progression --message="Setting up source files..." --weight=4
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
#ynh_setup_source --dest_dir="$final_path"
git clone https://github.com/movim/movim.git "$final_path" --quiet
ynh_setup_source --dest_dir="$final_path"
#git clone https://github.com/movim/movim.git "$final_path" --quiet
#=================================================
# NGINX CONFIGURATION
@ -134,14 +134,9 @@ ynh_script_progression --message="Modifying a config file..." --weight=1
cp ../conf/db.example.inc.php $final_path/config/db.inc.php
#ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$final_path/config/db.inc.php"
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/config/db.inc.php"
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/config/db.inc.php"
## TODO: consider installation in a subpath
#ynh_replace_string --match_string="'ws/'" --replace_string="'${path_url%/}/ws/'" \
# --target_file="$final_path/public/scripts/movim_websocket.js"
ynh_store_file_checksum --file="$final_path/config/db.inc.php"
#=================================================
@ -176,35 +171,18 @@ cache_dir="/home/$app"
# Create cachedir folder
mkdir -p $cache_dir
chown -R $app $cache_dir
# chown -R $app /home/movim/.composer/cache/repo/https---repo.packagist.org/
# chown -R $app /home/movim/.composer/cache/files/
cd "$final_path"
cd "$final_path"
ynh_exec_as $app php"${phpversion}" composer.phar $app:migrate
php"${phpversion}" daemon.php config --username=$admin --password=$password
# (
# cd "$final_path"
# php"${phpversion}" mud.php db --set
# php"${phpversion}" mud.php config --loglevel=1 \
# --locale="$language" --timezone="$timezone" \
# --username="$admin" --password="$password"
# )
#=================================================
# GENERIC FINALIZATION
#=================================================
# SET PERMISSIONS
#=================================================
# TODO: use more strict permissions
# chown -R "$app":www-data "$final_path"
# find "${final_path}/" -type f -print0 | xargs -0 chmod 0644
# find "${final_path}/" -type d -print0 | xargs -0 chmod 0755
# chmod 400 "${final_path}/config/db.inc.php"
chown -R $app:www-data $final_path
#chmod u+rwx $final_path
chown -R $app $final_path/src/Movim/
#=================================================
@ -233,16 +211,6 @@ then
ynh_permission_update --permission "main" --add "visitors"
fi
# # SSOwat configuration
# if [[ "$ssoenabled" -eq 0 ]]; then
# ynh_app_setting_set "$app" skipped_uris "/"
# #(cd "$final_path" && php"${phpversion}" mud.php config --xmppwhitelist="$domain")
# undo_sso_patch
# else
# ynh_app_setting_set "$app" unprotected_uris "/"
# fi
#=================================================
# RELOAD NGINX
#=================================================

View file

@ -74,7 +74,8 @@ ynh_system_user_create --username=$app
#=================================================
# Restore permissions on app files
chown -R www-data $final_path
chown -R $app:www-data $final_path
chown -R $app $final_path/src/Movim/
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
@ -104,7 +105,7 @@ ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
#=================================================
# RESTORE SYSTEMD
#=================================================
ynh_script_progression --message="Restoring the systemd configuration..." --time --weight=1
ynh_script_progression --message="Restoring the systemd configuration..." --weight=4
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service
@ -118,7 +119,7 @@ yunohost service add $app --description "Responsive web-based XMPP client" --log
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --time --weight=1
ynh_script_progression --message="Starting a systemd service..." --weight=2
ynh_systemd_action --service_name=$app --action="start" #--log_path="/var/log/$app/$app.log"
@ -127,7 +128,7 @@ ynh_systemd_action --service_name=$app --action="start" #--log_path="/var/log/$a
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
ynh_script_progression --message="Reloading nginx web server and PHP-FPM..." --time --weight=1
ynh_script_progression --message="Reloading nginx web server and PHP-FPM..." --weight=1
ynh_systemd_action --service_name=php${phpversion}-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload
@ -136,4 +137,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app" --time --last
ynh_script_progression --message="Restoration completed for $app" --last

View file

@ -100,10 +100,6 @@ then
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
## TODO: consider installation in a subpath
ynh_replace_string "'ws/'" "'${path_url%/}/ws/'" \
"$final_path/public/scripts/movim_websocket.js"
fi
#=================================================
@ -144,13 +140,7 @@ phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion)
# SET PERMISSIONS
#=================================================
# chown -R "$app":www-data "$final_path"
# find "${final_path}/" -type f -print0 | xargs -0 chmod 0644
# find "${final_path}/" -type d -print0 | xargs -0 chmod 0755
# chmod 400 "${final_path}/config/db.inc.php"
chown -R $app:www-data $final_path
#chmod u+rwx $final_path
chown -R $app $final_path/src/Movim/Bootstrap.php
#=================================================
@ -173,45 +163,11 @@ ynh_script_progression --message="Configuring database.." --weight=1
ynh_exec_as $app php"${phpversion}" composer.phar movim:migrate
)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
# # Reset SSO parameters
# ynh_app_setting_delete "$app" protected_uris
# ynh_app_setting_delete "$app" skipped_uris
# yunohost app clearaccess "$app"
# # Replace old public_site variable (if exists) by ssoenabled
# # TODO: add clean support for old/new setting public_site/ssoenabled
# if [ ! -z "$public_site" ]; then
# [[ $public_site = "Yes" ]] \
# && ssoenabled="No" \
# || ssoenabled="Yes"
# ynh_app_setting_delete "$app" public_site
# ynh_app_setting_set "$app" ssoenabled "$ssoenabled"
# fi
#=================================================
# SETUP SSOWAT
#=================================================
# # SSOwat configuration
# if [[ "$ssoenabled" = "No" ]]; then
# ynh_app_setting_set "$app" skipped_uris "/"
# (cd "$final_path" && php mud.php config --xmppwhitelist="$domain")
# yunohost app ssowatconf
# undo_sso_patch
# else
# ynh_app_setting_set "$app" unprotected_uris "/"
# fi
#=================================================
# SETUP SYSTEMD
#=================================================
# Create a dedicated systemd config
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file=../conf/systemd.service
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file=../conf/systemd.service
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file=../conf/systemd.service