1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/galene_ynh.git synced 2024-09-03 18:36:31 +02:00

Cleaning up

This commit is contained in:
ericgaspar 2021-05-25 09:13:33 +02:00
parent 7bd8d4ab51
commit 4342431a4b
4 changed files with 55 additions and 67 deletions

View file

@ -6,7 +6,7 @@
"en": "Videoconferencing server that is easy to deploy", "en": "Videoconferencing server that is easy to deploy",
"fr": "Serveur de visioconférence facile à déployer" "fr": "Serveur de visioconférence facile à déployer"
}, },
"version": "0.3.5~ynh1", "version": "0.3.5~ynh2",
"url": "https://galene.org/", "url": "https://galene.org/",
"upstream": { "upstream": {
"license": "MIT", "license": "MIT",
@ -71,6 +71,7 @@
{ {
"name": "group_description", "name": "group_description",
"type": "string", "type": "string",
"optional" : true,
"ask": { "ask": {
"en": "Choose a description for the group you want to create", "en": "Choose a description for the group you want to create",
"fr": "Décrivez le groupe que vous souhaitez créer" "fr": "Décrivez le groupe que vous souhaitez créer"

View file

@ -76,6 +76,14 @@ ynh_script_progression --message="Configuring firewall..." --weight=1
ynh_exec_warn_less yunohost firewall allow Both $turn_port ynh_exec_warn_less yunohost firewall allow Both $turn_port
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=3
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
@ -85,6 +93,10 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" --source_id="$architecture" ynh_setup_source --dest_dir="$final_path" --source_id="$architecture"
# Set permissions to app files
chown -R $app: $final_path
chmod -R 750 $final_path
#================================================= #=================================================
# CREATE DATA AND GROUPS FOLDER # CREATE DATA AND GROUPS FOLDER
#================================================= #=================================================
@ -118,12 +130,15 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2
ynh_add_nginx_config ynh_add_nginx_config
#================================================= #=================================================
# CREATE DEDICATED USER # MODIFY A CONFIG FILE
#================================================= #=================================================
ynh_script_progression --message="Configuring system user..." --weight=3
# Create a system user ynh_add_config --template="../conf/passwd" --destination="$final_path/data/passwd"
ynh_system_user_create --username=$app --home_dir="$final_path"
ynh_add_config --template="../conf/groupname.json" --destination="$final_path/groups/$group_name.json"
chmod 400 "$final_path/data/passwd"
chown $app:$app "$final_path/data/passwd"
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
@ -135,24 +150,6 @@ public_ip4="$(curl -s ip.yunohost.org)" || true
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config ynh_add_systemd_config
#=================================================
# MODIFY A CONFIG FILE
#=================================================
ynh_add_config --template="../conf/passwd" --destination="$final_path/data/passwd"
ynh_add_config --template="../conf/groupname.json" --destination="$final_path/groups/$group_name.json"
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Set permissions to app files
chown -R $app: $final_path
chmod -R 750 $final_path
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================

View file

@ -51,13 +51,6 @@ test ! -d $final_path \
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" 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=1
ynh_restore_file --origin_path="$final_path"
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
#================================================= #=================================================
@ -67,8 +60,11 @@ ynh_script_progression --message="Recreating the dedicated system user..." --wei
ynh_system_user_create --username=$app --home_dir="$final_path" ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# RESTORE USER RIGHTS # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1
ynh_restore_file --origin_path="$final_path"
# Restore permissions on app files # Restore permissions on app files
chown -R $app: $final_path chown -R $app: $final_path

View file

@ -31,24 +31,6 @@ architecture=$(ynh_detect_arch)
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# If final_path doesn't exist, create it
if [ -z "$final_path" ]; then
final_path=/opt/yunohost/$app
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
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 # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
@ -72,6 +54,32 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=3
ynh_systemd_action --service_name=$app --action=stop --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name=$app --action=stop --log_path="/var/log/$app/$app.log"
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# If final_path doesn't exist, create it
if [ -z "$final_path" ]; then
final_path=/opt/yunohost/$app
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
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
#=================================================
# CREATE DEDICATED USER
#=================================================
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 --home_dir="$final_path"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
@ -110,6 +118,10 @@ then
popd popd
fi fi
# Set permissions on app files
chown -R $app: $final_path
chmod -R 750 $final_path
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
@ -118,14 +130,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
# Create a dedicated NGINX config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
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 --home_dir="$final_path"
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================
@ -136,16 +140,6 @@ public_ip4="$(curl -s ip.yunohost.org)" || true
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config ynh_add_systemd_config
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Set permissions on app files
chown -R $app: $final_path
chmod -R 750 $final_path
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================