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() {
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() {

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."
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)

View file

@ -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)

View file

@ -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