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:
parent
26067a20f0
commit
ea731c8427
3 changed files with 41 additions and 15 deletions
|
@ -7,7 +7,6 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source ynh_add_config
|
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -141,14 +140,25 @@ if [ $sudo ]; then
|
||||||
fi
|
fi
|
||||||
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
|
# INSTALL JEEDOM
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing 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
|
# Install Jeedom
|
||||||
php$phpversion $final_path/install/install.php mode=force
|
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_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
|
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
|
# Check
|
||||||
#sudo php $final_path/install/sick.php
|
#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..."
|
ynh_script_progression --message="Configuring permissions..."
|
||||||
|
|
||||||
# Remove the public access
|
# Everyone can access the API part
|
||||||
ynh_app_setting_delete --app=$app --key=skipped_uris
|
# 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"
|
||||||
# Access to API without SSO
|
ynh_permission_create --permission="api" --url="/core/api/jeeApi.php" --allowed="visitors" --show_tile="false" --protected="true"
|
||||||
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/core/api/jeeApi.php"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
|
|
|
@ -45,6 +45,14 @@ test ! -d $final_path \
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD RESTORATION STEPS
|
# 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
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source ynh_add_config
|
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -94,7 +93,7 @@ then
|
||||||
ynh_script_progression --message="Upgrading source files..."
|
ynh_script_progression --message="Upgrading source files..."
|
||||||
|
|
||||||
# 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"
|
ynh_setup_source --dest_dir="$final_path" --keep="/core/config/common.config.php"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
chmod 750 "$final_path"
|
||||||
|
@ -157,6 +156,20 @@ if [ $sudo ]; then
|
||||||
fi
|
fi
|
||||||
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
|
# UPGRADE JEEDOM
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue