diff --git a/scripts/_common.sh b/scripts/_common.sh index d1c3a0e..d387b1b 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -16,19 +16,19 @@ APP_VERSION=$(get_app_version_from_json) install_dependances() { ynh_install_app_dependencies rrdtool perl libwww-perl libmailtools-perl libmime-lite-perl librrds-perl libdbi-perl libxml-simple-perl libhttp-server-simple-perl libconfig-general-perl pflogsumm - ynh_package_update - dpkg -i /tmp/monitorix.deb - ynh_secure_remove /etc/monitorix/conf.d/00-debian.conf - ynh_package_install -f } -get_source() { +get_install_source() { wget -q -O '/tmp/monitorix.deb' "http://www.monitorix.org/monitorix_${APP_VERSION}-izzy1_all.deb" if [[ ! -e '/tmp/monitorix.deb' ]] || [[ $(sha256sum '/tmp/monitorix.deb' | cut -d' ' -f1) != $sha256sum ]] then ynh_die "Error : can't get monitorix debian package" fi + ynh_package_update + dpkg --force-confdef --force-confold -i /tmp/monitorix.deb + ynh_secure_remove /etc/monitorix/conf.d/00-debian.conf + ynh_package_install -f } config_nginx() { diff --git a/scripts/install b/scripts/install index d492f46..3cdf28a 100755 --- a/scripts/install +++ b/scripts/install @@ -17,12 +17,12 @@ path=$(ynh_normalize_url_path $YNH_APP_ARG_PATH) test $(ynh_webpath_available $domain $path) == 'True' || ynh_die "$domain$path is not available, please use an other domain or path." ynh_webpath_register $app $domain $path -# Download package -get_source - # Install package install_dependances +# Download package and install it +get_install_source + # # Generate MySQL user dbuser=$app dbpass=$(ynh_string_random 12) diff --git a/scripts/restore b/scripts/restore index 24173df..c396654 100755 --- a/scripts/restore +++ b/scripts/restore @@ -16,12 +16,12 @@ path=$(ynh_normalize_url_path $(ynh_app_setting_get "$app" path)) # Check domain/path availability ynh_webpath_available $domain $path || ynh_die "$domain/$path is not available, please use an other domain or path." -# Download package -get_source - # Install package install_dependances +# Download package and install it +get_install_source + # Create user for database dbuser=$app dbpass=$(ynh_app_setting_get "$app" mysqlpwd) diff --git a/scripts/upgrade b/scripts/upgrade index b06d5f8..af90ff9 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -18,12 +18,8 @@ dbuser=$app dbname=$app dbpass=$(ynh_app_setting_get "$app" mysqlpwd) -# Download package -get_source - -# Update package -dpkg -i /tmp/monitorix.deb -ynh_secure_remove /etc/monitorix/conf.d/00-debian.conf +# Download package and install it +get_install_source # Update nginx config config_nginx