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

Refactor debian package install

This commit is contained in:
Josué Tille 2017-10-31 23:08:23 +01:00
parent cb28a2f77f
commit b39f2d81b0
4 changed files with 13 additions and 17 deletions

View file

@ -16,19 +16,19 @@ APP_VERSION=$(get_app_version_from_json)
install_dependances() { 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_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" 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 ]] if [[ ! -e '/tmp/monitorix.deb' ]] || [[ $(sha256sum '/tmp/monitorix.deb' | cut -d' ' -f1) != $sha256sum ]]
then then
ynh_die "Error : can't get monitorix debian package" ynh_die "Error : can't get monitorix debian package"
fi 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() { config_nginx() {

View file

@ -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." 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 ynh_webpath_register $app $domain $path
# Download package
get_source
# Install package # Install package
install_dependances install_dependances
# Download package and install it
get_install_source
# # Generate MySQL user # # Generate MySQL user
dbuser=$app dbuser=$app
dbpass=$(ynh_string_random 12) dbpass=$(ynh_string_random 12)

View file

@ -16,12 +16,12 @@ path=$(ynh_normalize_url_path $(ynh_app_setting_get "$app" path))
# Check domain/path availability # Check domain/path availability
ynh_webpath_available $domain $path || ynh_die "$domain/$path is not available, please use an other domain or path." 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 package
install_dependances install_dependances
# Download package and install it
get_install_source
# Create user for database # Create user for database
dbuser=$app dbuser=$app
dbpass=$(ynh_app_setting_get "$app" mysqlpwd) dbpass=$(ynh_app_setting_get "$app" mysqlpwd)

View file

@ -18,12 +18,8 @@ dbuser=$app
dbname=$app dbname=$app
dbpass=$(ynh_app_setting_get "$app" mysqlpwd) dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
# Download package # Download package and install it
get_source get_install_source
# Update package
dpkg -i /tmp/monitorix.deb
ynh_secure_remove /etc/monitorix/conf.d/00-debian.conf
# Update nginx config # Update nginx config
config_nginx config_nginx