mirror of
https://github.com/YunoHost-Apps/monitorix_ynh.git
synced 2024-09-03 19:46:06 +02:00
49 lines
1.3 KiB
Text
49 lines
1.3 KiB
Text
|
#!/bin/bash
|
||
|
|
||
|
# Import common cmd
|
||
|
source ./_common.sh
|
||
|
|
||
|
# Init script
|
||
|
init_script
|
||
|
|
||
|
# Note: each files and directories you've saved using the ynh_backup helper
|
||
|
# will be located in the current directory, regarding the last argument.
|
||
|
|
||
|
# Retrieve old app settings
|
||
|
domain=$(ynh_app_setting_get "$app" domain)
|
||
|
path=$(ynh_app_setting_get "$app" path)
|
||
|
|
||
|
# Correct path if it is not correct
|
||
|
correct_path
|
||
|
|
||
|
# Check domain/path availability
|
||
|
sudo yunohost app checkurl "${domain}${path}" -a "$app" \
|
||
|
|| ynh_die "Path not available: ${domain}${path}"
|
||
|
|
||
|
# Download package
|
||
|
get_source
|
||
|
|
||
|
# Install package
|
||
|
ynh_package_update
|
||
|
ynh_package_install rrdtool perl libwww-perl libmailtools-perl libmime-lite-perl librrds-perl libdbi-perl libxml-simple-perl libhttp-server-simple-perl libconfig-general-perl
|
||
|
sudo dpkg -i /tmp/monitorix.deb
|
||
|
ynh_package_install -f
|
||
|
|
||
|
# # Create and restore the database
|
||
|
dbname=$app
|
||
|
dbuser=$app
|
||
|
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
|
||
|
ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass"
|
||
|
ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < ./dump.sql
|
||
|
|
||
|
# Restore NGINX configuration
|
||
|
sudo cp -a ./nginx.conf "/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
||
|
sudo cp -a ./monitorix_status.conf "/etc/nginx/conf.d/monitorix_status.conf"
|
||
|
|
||
|
# Restore Monitorix configuration
|
||
|
sudo cp -a ./config "/etc/monitorix"
|
||
|
|
||
|
|
||
|
# Restart webserver
|
||
|
sudo service nginx reload
|