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

More example_ynh

This commit is contained in:
yalh76 2022-06-08 22:30:14 +02:00
parent 26067a20f0
commit ea731c8427
3 changed files with 41 additions and 15 deletions

View file

@ -7,7 +7,6 @@
#=================================================
source _common.sh
source ynh_add_config
source /usr/share/yunohost/helpers
#=================================================
@ -141,14 +140,25 @@ if [ $sudo ]; then
fi
fi
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..."
ynh_add_config --template="common.config.php" --destination="$final_path/core/config/common.config.php"
chmod 400 "$final_path/core/config/common.config.php"
chown $app:$app "$final_path/core/config/common.config.php"
# Cron
ynh_add_config --template="cronjeedom" --destination="/etc/cron.d/${app}"
ynh_add_config --template="cronjeedom_watchdog" --destination="/etc/cron.d/${app}_watchdog"
#=================================================
# INSTALL JEEDOM
#=================================================
ynh_script_progression --message="Installing Jeedom..."
# Configure Jeedom database
ynh_add_config --template="common.config.php" --destination="$final_path/core/config/common.config.php"
# Install Jeedom
php$phpversion $final_path/install/install.php mode=force
@ -156,10 +166,6 @@ php$phpversion $final_path/install/install.php mode=force
ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="../conf/config.sql"
ynh_mysql_execute_file_as_root --file="../conf/config.sql" --database=$db_name
# Cron
ynh_add_config --template="cronjeedom" --destination="/etc/cron.d/${app}"
ynh_add_config --template="cronjeedom_watchdog" --destination="/etc/cron.d/${app}_watchdog"
# Check
#sudo php $final_path/install/sick.php
@ -183,11 +189,10 @@ chown www-data:www-data -R /tmp/jeedom
#=================================================
ynh_script_progression --message="Configuring permissions..."
# Remove the public access
ynh_app_setting_delete --app=$app --key=skipped_uris
# Access to API without SSO
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/core/api/jeeApi.php"
# Everyone can access the API part
# We don't want to display the tile in the SSO so we put --show_tile="false"
# And we don't want the YunoHost admin to be able to remove visitors group to this permission, so we put --protected="true"
ynh_permission_create --permission="api" --url="/core/api/jeeApi.php" --allowed="visitors" --show_tile="false" --protected="true"
#=================================================
# RELOAD NGINX

View file

@ -45,6 +45,14 @@ test ! -d $final_path \
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================

View file

@ -7,7 +7,6 @@
#=================================================
source _common.sh
source ynh_add_config
source /usr/share/yunohost/helpers
#=================================================
@ -94,7 +93,7 @@ then
ynh_script_progression --message="Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
ynh_setup_source --dest_dir="$final_path" --keep="/core/config/common.config.php"
fi
chmod 750 "$final_path"
@ -157,6 +156,20 @@ if [ $sudo ]; then
fi
fi
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a configuration file..."
ynh_add_config --template="common.config.php" --destination="$final_path/core/config/common.config.php"
chmod 400 "$final_path/core/config/common.config.php"
chown $app:$app "$final_path/core/config/common.config.php"
# Cron
ynh_add_config --template="cronjeedom" --destination="/etc/cron.d/${app}"
ynh_add_config --template="cronjeedom_watchdog" --destination="/etc/cron.d/${app}_watchdog"
#=================================================
# UPGRADE JEEDOM
#=================================================